Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (ozgur, degenerate_762, 7th_zorro), 1,081 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Wild variable! Variable amok! #343282
10/05/10 01:47
10/05/10 01:47
Joined: Apr 2010
Posts: 38
D
deianthropus Offline OP
Newbie
deianthropus  Offline OP
Newbie
D

Joined: Apr 2010
Posts: 38
I have initialized a variable, and assigned a debug variable to it just to watch the value. I have an error() function to break up the frames. After 2 frames, the initialized variable jumps to 94700! WTF is up with this?

Re: Wild variable! Variable amok! [Re: deianthropus] #343295
10/05/10 07:33
10/05/10 07:33
Joined: Mar 2006
Posts: 1,993
Karlsruhe
PadMalcom Offline
Serious User
PadMalcom  Offline
Serious User

Joined: Mar 2006
Posts: 1,993
Karlsruhe
Sounds like you are assigning an address/a pointer? It would be easier for us to help you if you post your source code.

Last edited by PadMalcom; 10/05/10 07:33.
Re: Wild variable! Variable amok! [Re: PadMalcom] #343337
10/05/10 16:22
10/05/10 16:22
Joined: Apr 2010
Posts: 38
D
deianthropus Offline OP
Newbie
deianthropus  Offline OP
Newbie
D

Joined: Apr 2010
Posts: 38
Sorry for the vagueness; I was pressed for time last night. It would be difficult to post the source code, as it is broken into several includes, but the relevant lines of code are:


Code:
//debugvars[] is an array of variables to send through
//my debug_display function using digits(). 
//That part works fine.

function myfunc(ENTITY* obj)//obj is used in the functions that are currently disabled
{
var zmot;
debugvars[11]=zmot;

while (1)
 {
 //functions that set and respond to zmot, 
 //currently commented out
 debugvars[11]=zmot;
 error("step break");
 wait(1);
 }

}



again, the variable does initialize to 0, but after several steps unexpectedly jumps to 94700, or a close number. Most often it is 94700.

NOTE: this is not the actual code, just a selection of relevant lines in a similar format (the variable is defined in a function). The function is called once when a script that creates an entity loads:

Code:
function init_ent()
{
myobj=ent_create(blah, blah, blah,parameters,not the issue, entity is fine);
myfunc(myobj);

}



Last edited by deianthropus; 10/05/10 16:25.
Re: Wild variable! Variable amok! [Re: deianthropus] #343339
10/05/10 16:37
10/05/10 16:37
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
The variable "zmot" is NOT initialized anywhere. Try using var zmot = 0; instead of var zmot;

Re: Wild variable! Variable amok! [Re: Lukas] #343379
10/05/10 20:52
10/05/10 20:52
Joined: Apr 2010
Posts: 38
D
deianthropus Offline OP
Newbie
deianthropus  Offline OP
Newbie
D

Joined: Apr 2010
Posts: 38
Originally Posted By: Lukas
The variable "zmot" is NOT initialized anywhere. Try using var zmot = 0; instead of var zmot;


Duh. That would work, since I am running the while() loop within the function, instead of an earlier script wherein the function was itself called within a while script running the content of the loop once per call. I don't know why I didn't think of that when I changed it to the format as I've described here. lol. thanks. I'll let you know.


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