[r110.2] Local Variable Issue

Discussion and feedback on Construct 2

Post » Thu Nov 22, 2012 5:13 am

Hi,

So I've just downloaded latest beta version and seams like local non-static variable is not working in my events code anymore. Where in r110 as we know it was broken because it treat it as a global Var, now it seams that it is not updating it at all. So I want to check with you guys If it means that it was broken and now it is fixed, or in fact it was working well and now it is not before I submit the bug?

So simplified version of my events looks like this:

- On button x pressed: set LocalVar to 1
- LocalVar = 1: do stuff
- Local number (non-static) LocalVar = 0

Thanks
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
71
S
19
G
19
Posts: 1,919
Reputation: 16,910

Post » Thu Nov 22, 2012 6:09 am

I had no issues when i made some game with global variables, would you mind share your .capx?
B
96
S
25
G
20
Posts: 3,052
Reputation: 22,638

Post » Thu Nov 22, 2012 6:24 am

Hey,

I guess i could but there is already around 550 event, so not sure if it's good idea?

That local variable is responsible for turning on and off refreshing of the inventory. When i set that local variable to 1 in the event's sheet it just loops endlessly. That's why I suspect that local variables work now as statics even if static is ticked off. megatronx2012-11-22 08:26:32
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
71
S
19
G
19
Posts: 1,919
Reputation: 16,910

Post » Thu Nov 22, 2012 12:33 pm

Works fine for me. Local variables need to be declared before events they are used in. Also, make sure you are using the 110.2 (Ashley accidentally 110 as 110.2), check within Construct 2 (the info button to top right).
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Thu Nov 22, 2012 2:04 pm

it's 110.2 .

I've tired both options

( original build in 108 )
- On button x pressed: set LocalVar to 1
- LocalVar = 1: do stuff
- Local number (non-static) LocalVar = 0

and

- Local number (non-static) LocalVar = 0
- On button x pressed: set LocalVar to 1
- LocalVar = 1: do stuff

and none of them work, which is very bizarre because i did not change anything but suddenly just stopped working with an update!

;(

EDIT@ Ok, so I'm pretty sure non-static Local Variables are broken. Here is the reason why:

- On button x pressed: set LocalVar to 1
- LocalVar = 1: do stuff
               Set LocalVar to 0
- Local number (static) LocalVar = 0

And this way it works but as we know there shouldn't be a need for that if i only want to trigger local var once per loop by keeping it non-static.megatronx2012-11-22 15:19:01
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
71
S
19
G
19
Posts: 1,919
Reputation: 16,910

Post » Thu Nov 22, 2012 6:42 pm

Your pseudo-code makes little sense, it would be really easier if you could reproduce the issue in a blank capx.
Even if in the end the program does nothing, at least we would be able to visualize exactly what you did.

As far as I've tested local variables, I haven't had a single issue with those, so I'd be inclined to think it's an issue in your code, but can't pinpoint it from the pseudo code here.

Anytime you request for help, just try to provide a small capx, it helps a lot.
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 Nov 23, 2012 2:18 pm

Hey,

here's the reproduction of my code

Http://www.box.com/s/ac712pzrptap98amy5z7

Not working neither when local variable is on the bottom nor on top of the group.

The original code was made in 108 and was working as intended. megatronx2012-11-23 14:21:00
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
71
S
19
G
19
Posts: 1,919
Reputation: 16,910

Post » Fri Nov 23, 2012 3:31 pm

Please make a thread in the Bugs forum with a repro .capx made from scratch if you think it's a bug, otherwise I probably won't investigate this on my next bug run.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,528

Post » Fri Nov 23, 2012 3:34 pm

Well, this thread started as a question weather I'm doing something wrong or not. But I will post in bug section now.
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
71
S
19
G
19
Posts: 1,919
Reputation: 16,910

Post » Fri Nov 23, 2012 4:04 pm

I've faced the same issue previously in some of my test capx, but it seems after reinstalling scirra, there's no longer such issue. Perhaps you could try that?
B
27
S
9
G
5
Posts: 108
Reputation: 5,744

Next

Return to Construct 2 General

Who is online

Users browsing this forum: Mirlas, wrighthill and 15 guests