Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
1 registered members (AndrewAMD), 599 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Watched arrays - Debugging Arrays? #254922
03/06/09 12:51
03/06/09 12:51
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline OP
User
Carlos3DGS  Offline OP
User

Joined: Oct 2008
Posts: 513
Hello, I am working on a project and am getting unexpected results but no crashes.
It would really help me to be able to see the information being put into an array to find out what is going wrong.

I have tried adding the array to the "watched variables" in sed and running in debug mode but it dosent seem to work.

My array is a global array declared like this:
var MyBoard[10][10];

and in the "watched variables" in sed I add things like this:
MyBoard[4][6]
MyBoard[0][0]
etc...

But it dosent show me the value of the variables like it does when I watch other global variables, it only says "Not Available".
It works fine when I watch other things like "MyIndex" or "MyVector.x" or things like that.
Does anyone know how I can see the values of my array to debug it?

Any help is welcome


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1
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 Offline
Expert
EvilSOB  Offline
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 Offline OP
User
Carlos3DGS  Offline OP
User

Joined: Oct 2008
Posts: 513
I have never used diag_var()
How does it work?

Do I just do this?:
Code:
diag_var(MyArray);


Or do i put that in a for loop and use:
Code:
for (i=0...blablabla...)
{
   for (j=0...blablabla...)
   {
      diag_var(MyArray[i][j]);
   }
}


Do I need to do anything else?


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1
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 Offline
Expert
EvilSOB  Offline
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] #254952
03/06/09 16:03
03/06/09 16:03
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline OP
User
Carlos3DGS  Offline OP
User

Joined: Oct 2008
Posts: 513
Thanks smile


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1
Re: Watched arrays - Debugging Arrays? [Re: Carlos3DGS] #254959
03/06/09 17:06
03/06/09 17:06
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Anytime...


"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 Offline OP
User
Carlos3DGS  Offline 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:
Code:
 		//******* -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?


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1
Re: Watched arrays - Debugging Arrays? [Re: Carlos3DGS] #255019
03/07/09 00:06
03/07/09 00:06
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline OP
User
Carlos3DGS  Offline OP
User

Joined: Oct 2008
Posts: 513
Sorry for that dumb question, I found it.
I had to set the comand line option -diag
laugh


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1