[r110.2] Local Variable Issue

0 favourites
  • 13 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • 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

  • I had no issues when i made some game with global variables, would you mind share your .capx?

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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).

  • 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.

  • 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.

  • Hey,

    here's the reproduction of my code

    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.

  • 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.

  • Well, this thread started as a question weather I'm doing something wrong or not. But I will post in bug section now.

  • 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?

  • Already did that, but no change.

  • megatronx, I have downloaded your file, and it works perfectly, no issues at all. You might want to check if you indeed downloaded the right one. No harm downloading the latest update again and reinstalling.

  • I already did that several hours ago - downloaded 110.2 again and installed it.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)