Sum of Global Variables

For questions about using Classic.

Post » Thu Nov 29, 2012 5:13 pm

I'm trying to add together the value of three global variables, and see if they add up to more than 0. Right now, I have this:

System - Compare:

Value 1: 'GMoteForest1-1' + 'GMoteForest1-2' + 'GMoteForest1-3'

Greater Than

Value 2: 0


Pressing "Finish" shows the window close normally as though Construct has understood and accepted the command, yet it never shows up in the event list. The event I'm trying to insert this condition into stays blank. Usually when there's an error with the code I've inserted it won't allow me to press "Finish", and pops up with an error message when I try to press it.

Am I doing something wrong? Is there another way to calculate and compare the sum of those three variables?

Many thanks for reading -Silver-2012-11-29 17:13:35
B
15
S
7
G
7
Posts: 250
Reputation: 5,298

Post » Thu Nov 29, 2012 6:34 pm

From what I see, the names of the globals are causing the problem. You need to use the global-tag:
global('GMoteForest1-1') + global('GMoteForest1-2'), etc.

But there might also be a problem with the naming itself. Try to abandon the dash, use something like
global('GMoteForest1_1')

Hope it helps
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Thu Nov 29, 2012 7:40 pm

Thanks! The "global" part was exactly what I needed :)
B
15
S
7
G
7
Posts: 250
Reputation: 5,298


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 6 guests