Local variable value gone after wait

Bugs will be moved here once resolved.

Post » Wed Jan 23, 2013 3:14 am

I found this using r115 and seems like it still occur in r116. So basically I defined a value for a local variable, and do a wait, but after the wait, the value I just entered for the local variable is missing. Google chrome console gives me:

Check: local var stack not big enough

This doesn't happen for global variables. Another thing is, even with wait time set to 0, local variable value is still gone. Sometimes the wait can happen forever (more than the value I entered, even for 1 second).

Plugins used: Function, XML, and Chrome Console.

CAPXsoybean2013-01-23 03:16:02
B
21
S
5
G
5
Posts: 58
Reputation: 5,232

Post » Wed Jan 23, 2013 12:02 pm

As per how to report bugs, please do not use third party plugins in submitted .capx files.
Scirra Founder
B
359
S
214
G
72
Posts: 22,948
Reputation: 178,532

Post » Wed Jan 23, 2013 2:44 pm

Oops, sorry @Ashley

Here's a modification without third party plugin: CAPX
B
21
S
5
G
5
Posts: 58
Reputation: 5,232

Post » Wed Jan 23, 2013 4:43 pm

I don't think we can fix this. To support recursive functions, local variables have a separate value inside triggers. So in 'On start of layout' you actually assign to a separate value reserved for that trigger. When the 'On start of layout' event ends, the local variable reverts to its default value. Then after the 'Wait' action, since you're no longer in the trigger, the local value has lost its value that was set in the trigger.

I can't think how to fix this without breaking recursive functions. Can you work around by making the local variable static?
Scirra Founder
B
359
S
214
G
72
Posts: 22,948
Reputation: 178,532

Post » Thu Jan 24, 2013 1:00 am

I see. Yeah no problem. Something to note about local variables then. Thanks!
B
21
S
5
G
5
Posts: 58
Reputation: 5,232


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest