0 Favourites

How Construct runs through events

This forum is currently in read-only mode.
  • 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)

  • I tried to replicate this in CC with the following:

    + 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 ""
    

    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.

  • 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 :)

  • Construct 3

    Buy Construct 3

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

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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic Locked topic
0 Favourites
Construct 3 any news?
889 125,562
uzumiapps's avatar
uzumiapps
Unread hot topic
353 32,066
yojona's avatar
yojona
Unread hot topic
313 26,484
Juryiel's avatar
Juryiel