Event listener for variables?

0 favourites
  • 6 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color 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

  • 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?

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

  • Try Construct 3

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

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