|
1 registered members (AndrewAMD),
599
guests, and 3
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Watched arrays - Debugging Arrays?
[Re: Carlos3DGS]
#254925
03/06/09 13:32
03/06/09 13:32
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Ive never had any luck with the watches is SED, seems rather buggy still to me. Try writing a small function that dumps the entire array (or the important bit) down to the acklog.txt file using the diag_var() function.
Then call the function at points in the code you want to check, or assign an on_key to the function so you can hit a key to get a dump.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Watched arrays - Debugging Arrays?
[Re: EvilSOB]
#254936
03/06/09 14:37
03/06/09 14:37
|
Joined: Oct 2008
Posts: 513
Carlos3DGS
OP
User
|
OP
User
Joined: Oct 2008
Posts: 513
|
I have never used diag_var() How does it work? Do I just do this?: Or do i put that in a for loop and use: for (i=0...blablabla...)
{
for (j=0...blablabla...)
{
diag_var(MyArray[i][j]);
}
}Do I need to do anything else?
|
|
|
Re: Watched arrays - Debugging Arrays?
[Re: Carlos3DGS]
#254937
03/06/09 14:47
03/06/09 14:47
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Not quite. diag_var(STRING* format, var number); See 'digits' in the manual to get an understanding of the "format" structure. Also see str_cat_num for a similar type of "number into text" conversion.
But basically, to just dump text, use diag("test to dump and a line feed\n"); //"\n" is the line-feed, and "\t" is a tab-space But to dump numbers, use diag_var("MyArray-(Column1, Row2) = %.0f \n", MyArray[1][2]); //will dump an integer of the MyArray element diag_var("MyArray-(Column1, Row2) = %.3f \n", MyArray[1][2]); //will dump an number to 3 decimal places of the MyArray element The number gets inserted into the string where the %.0f is.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Watched arrays - Debugging Arrays?
[Re: EvilSOB]
#255012
03/06/09 23:48
03/06/09 23:48
|
Joined: Oct 2008
Posts: 513
Carlos3DGS
OP
User
|
OP
User
Joined: Oct 2008
Posts: 513
|
I cannot find that acklog.txt anywhere. Where is it created, in my script folder? Or in the GameStudio folder? I have added the following lines in my program: //******* -DEBUG- *******
diag_var("\n VUELTA: %.0f \n", dVueltas);
dVueltas ++;
diag_var("\n \n NodosAbiertos = %.0f \n", NodosAbiertos);
for(dX=0; dX<=NodosAbiertos; dX++)
{
diag_var(" %.0f \t", BusquedaID[dX]);
}
diag_var("\n \n \n NodosVistos = %.0f ", NodosVistos);
for(dX=0;dX<=NodosVistos;dX++)
{
diag_var("\n NODO %.0f : \t", dX);
diag_var("Padre %.0f , ", InfoNodos[dX][0]);
diag_var("X %.0f , ", InfoNodos[dX][1]);
diag_var("Y %.0f , ", InfoNodos[dX][2]);
diag_var("CosteRuta %.0f , ", InfoNodos[dX][3]);
diag_var("CosteDestino %.0f , ", InfoNodos[dX][4]);
diag_var("CosteTotal %.0f , ", InfoNodos[dX][5]);
}
//******* -DEBUG- ******* Do I have to add anything else for that to get written somewhere?
|
|
|
|