0 Favourites

Event listener for variables?

  • What would be the best way to tie a variable change to a conditional event trigger? IE the window.addeventlistener which doesnt accept variable changes. How can I trigger an event on variable changes. So

    var a = '1'

    when var a changes to '2' trigger the condition.

  • Never mind, I figured it out :) goofball moment

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Could you tell me what you did to resolve? Maybe im dumb (probably) but I cant seem to think of a simple way to trigger something to happen ONCE when a variable changes. Like "On Click" type events..

    Any time I use something like:

    • If x = 3 then

       -- do "Action A"

    it continually does Action A over and over and over again as long as x = 3... Other than manually programming another variable called "Action A complete" and then saying:

    • if x = 3
    • and action a is not complete

    -- Do Action A

    or maybe thats the only way?

  • I just finished a small behavior that does the trick, if anyone is interested.

    On variable change plugin

  • Could you tell me what you did to resolve? Maybe im dumb (probably) but I cant seem to think of a simple way to trigger something to happen ONCE when a variable changes. Like "On Click" type events..

    Any time I use something like:

    - If x = 3 then

       -- do "Action A"

    it continually does Action A over and over and over again as long as x = 3... Other than manually programming another variable called "Action A complete" and then saying:

    - if x = 3

    - and action a is not complete

    -- Do Action A

    or maybe thats the only way?

    @80bit You can use the 'Trigger once while true' system condition maybe

  • Aphrodite, actually, that was exactly what i needed - thank you so much! I found it in the manual yesterday after i posted and it has since changed my life haha. :) Much much easier now!

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
64 12,948
trollface's avatar
trollface
Unread hot topic
59 13,721
holi's avatar
holi
Unread hot topic Locked topic
55 4,192
Ashley's avatar
Ashley Construct Team Founder