Local variables can't be changed

Bugs will be moved here once resolved.

Post » Fri Sep 23, 2011 1:38 am

It seems that once Global variable is turned into a local variable - by dragging it inside the group in my case, can be set only once.
You can't add, substract, or set that local value later in runtime. If you set it like ie. "Local number Variable = 0" it stays 0.

It happens on Win 7 64bit, C2 r57. Not sure about previous releasses.
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Fri Sep 23, 2011 2:00 am

Can you post a .capx? Was working OK last I checked.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,528

Post » Fri Sep 23, 2011 2:12 am

I't happening with every new project. Create a global variable move it to a group an try to add, substract or set that variable to something different.
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Fri Sep 23, 2011 2:25 am

Sorry shinkan, I tested what you say, and it works as intended (I can change, add, substract to the value). Tested in XP sp3
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Fri Sep 23, 2011 2:36 am

can you do a quick capx file and post it?
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Fri Sep 23, 2011 2:46 am

New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Fri Sep 23, 2011 2:55 am

"On start of layout" works for me to, but try to change it to every tick or every 1.0 sec... or add a Mouse: On Left button Clicked - > Add 1
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Fri Sep 23, 2011 3:02 am

All those work for me as well, shinkan! Can't reproduce any issue.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,528

Post » Fri Sep 23, 2011 3:11 am

hmm ok. to be sure, step by step
- New project
- add text object
- add mouse object
- create Global Variable = 0
- create Group
- move Global Variable into the Group - it's now Local Variable = 0
- Every tick set text to Local Variable
- on left click add 1 to Local Variable

after previewing this layout text object shows 0 - thats correct, but clicking mouse buttons doesnt do anything.
I did that with keybord object too and with Every xx seconds and still Text object displays Local Variable initial value 0.
:/

I've also add another sprite to see maybe text object is not displaying it properly.
if local variable = 0 - set sprite opacity to 100
if local variable = 1 - set sprite opacity to 50

Nothing happens. Local Variable stays at 0, sprite stays with 100 opacity.
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Fri Sep 23, 2011 3:17 am

[QUOTE=shinkan] "On start of layout" works for me to, but try to change it to every tick or every 1.0 sec... or add a Mouse: On Left button Clicked - > Add 1[/QUOTE]

Indeed, in r57 and using my previous capx, replacing the start of layout event, every tick and every X sec seem to just run once. The var gets set, but don't change afterwards.
Left click was already a known issue.

Same thing happens with a keyboard event.
http://dl.dropbox.com/u/36472942/construct/forumhelp/glob2loc_var2.capx
Variable3 was created as a local variable in the group directly.

But in the end, isn't that the supposed behavior ?
I mean, each time the group gets called/executed, the local variable is "reset". If you want an increasing counter, have a local variable out of the scope of the group (a containing condition and/or group for example) or just a global variable.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Next

Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 4 guests