Construct 2 version 242 global variables

Discussion and feedback on Construct 2

Post » Tue Feb 21, 2017 9:17 am

Hi

I am using Construct 2 version 242 (beta) and when I have created global number variables , it appears to be setting these as static is this normal because I do not seem to be able to increment these variables now.

When I look inside of the capx file and then view the event sheet xml , they are set as static="0" but when I look at their settings within the event sheet and double click on one of them, the static box is ticked.
Regards

TimCS
B
23
S
8
Posts: 132
Reputation: 1,921

Post » Tue Feb 21, 2017 9:32 am

It is normal for a global variable to be static by default.
Static means that the value it contains is stored and stays the same between an execution tick to another (which is what you do want from a global variable, for the value it contains to be stored and not reset each tick).

What prevents from modifying the value is the fact that the variable is Constant (its value cannot be modified at runtime).
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
292
S
115
G
96
Posts: 7,295
Reputation: 70,795

Post » Tue Feb 21, 2017 1:25 pm

Kyatric wrote:It is normal for a global variable to be static by default.
Static means that the value it contains is stored and stays the same between an execution tick to another (which is what you do want from a global variable, for the value it contains to be stored and not reset each tick).

What prevents from modifying the value is the fact that the variable is Constant (its value cannot be modified at runtime).



Hi Kyatric

Thanks for your reply, I had looked at what it was set to but it is not constant so I am really perplexed to why it will not increment in value :(
Regards

TimCS
B
23
S
8
Posts: 132
Reputation: 1,921

Post » Tue Feb 21, 2017 3:18 pm

Show a screenshot or a capx. Is the event that increments the variable running? Could you have another similarly named variable that you're accidentally incrementing instead?
B
92
S
32
G
109
Posts: 5,294
Reputation: 70,999

Post » Tue Feb 21, 2017 11:04 pm

Got this worked out, it seems that either using the touch or mouse click event on a button object for some reason is not working, however adding a sprite and clicking on that does action the commands that I need it to do .

I am sure I have used the button object before with similar set ups and not had the problem
Regards

TimCS
B
23
S
8
Posts: 132
Reputation: 1,921

Post » Wed Feb 22, 2017 3:22 am

The button object has its own "on clicked" condition. Maybe that's what you used before?
B
92
S
32
G
109
Posts: 5,294
Reputation: 70,999

Post » Wed Feb 22, 2017 8:27 am

R0J0hound wrote:The button object has its own "on clicked" condition. Maybe that's what you used before?


Yes you are right and again egg on face , this is what happens when the brain is tired :(
Regards

TimCS
B
23
S
8
Posts: 132
Reputation: 1,921


Return to Construct 2 General

Who is online

Users browsing this forum: tarek2 and 16 guests