[Solved] Why do group scope variables reset?

Discussion and feedback on Construct 2

Post » Sat Mar 07, 2015 7:54 pm

So this took a looooong time to figure out what was happening. It appears that group scoped variables get reset on every event end or perhaps begin. In the screen shot below, the line that says "Add_Message" ( "SequenceIdx=" & nextTileMoveSequenceNum ), this dispays 1 over and over and over. Never increments from 1. Now, if you move the group variable nextTileMoveSequenceNum up into the global scope, it works just fine. The sequence increments as a normal person would expect.

This can't be by design. A bug I'm guessing?...

C2GroupScopeVarResets.PNG
You do not have the required permissions to view the files attached to this post.
Last edited by locohost on Mon Mar 09, 2015 11:28 am, edited 1 time in total.
B
13
S
4
Posts: 280
Reputation: 1,566

Post » Sat Mar 07, 2015 7:57 pm

It's by design. To make group variables like globals make then static.
B
82
S
26
G
63
Posts: 4,843
Reputation: 45,726

Post » Sat Mar 07, 2015 8:35 pm

R0J0hound wrote:It's by design. To make group variables like globals make then static.

Damn. So I missed that in the docs? :?

Regardless, thank you @R0J0hound! :D
B
13
S
4
Posts: 280
Reputation: 1,566


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 5 guests