How Construct runs through events

For questions about using Classic.

Post » Wed Sep 07, 2011 11:27 am

Construct goes through the event list from top to bottom and checks if the condition is true, otherwise it ignores it.

(event 1)
+ if switch is 1
-> say "1"

(event 2)
+ if switch is 2
-> set switch to 1
-> say "2"
-> set switch to 2

My expectation would be (when switch = 2) what construct would do:
- ignore event 1
- go inside event 2, change switch to 1
- say "2"
- set switch to 2
Screen result: "2".

But when I preview this, it seems to also do something with event 1!
I don't understand this.

(using v0.99.84)rogerty2011-09-07 11:28:43
B
16
S
5
G
7
Posts: 599
Reputation: 5,000

Post » Wed Sep 07, 2011 11:44 am

I tried to replicate this in CC with the following:
[code]
+ System: Is global variable 'switch' Equal to 1
-> Text: Set text to "1"

+ System: Is global variable 'switch' Equal to 2
-> System: Set global variable 'switch' to 1
-> Text2: Set text to "2"
-> System: Set global variable 'switch' to 2

+ Button: On Button clicked
-> System: Add 1 to global variable 'switch'
-> Text: Set text to ""
-> Text2: Set text to ""
[/code]
It works as it should. With 'switch' = 0 both textboxes are empty, with 'switch' = 1 the first one is filled, and with 'switch' = 2 the second one is filled.
It may be .84 or a special case (e.g. if you are using the function object. Functions are aside of the order of events)
Other than that I'm clueless.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Wed Sep 07, 2011 11:53 am

Just out of interest, rogerty, why haven't you upgraded to r1.2?

I haven't had a crash with this version for....well, I can't actually remember :)
If your vision so exceeds your ability, then look to something closer.
Moderator
B
120
S
28
G
68
Posts: 4,839
Reputation: 48,279

Post » Wed Sep 07, 2011 2:04 pm

@rogerty
Well you don't have anything telling it not to continuously run through events so it may just be that its running that event again before the variable is switched.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests