[Behavior] On instance variable change

0 favourites
  • 7 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • I just finished writing a small behavior that triggers events when certain instance variable changes.

    If there is someone interested in it I could upload it for public use.

    So far it has the following functionality:

    Enable/disable trigger events for specific/any variables

    Add variable to watch list (with variable name)

    Remove variable from watch list (with variable name)

    Add all variables to watch list

    Triggers events when:

    A watched variable has changed (filters by variable name)

    Any variable in the list has changed

    Basically it handles two arrays, one with the variable names and another with the values (just as the instances do with their instance variables), on each tick, if it sees any change in a variable, it stores the latest value and triggers an event.

    *Saves the hassle of duplicating instance variables to keep track of changes (value/oldValue)

    *Easier to maintain

    *Adds the possibility to add new trigger events to an object without writing new behaviors, just add an instance variable name with the name of the event and add 1 to that variable each time you want to trigger that event

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm interested in this! :D Where do I sign?

  • I will write the save/load code now and I will upload it as a c2addon then.

  • There you go, I haven't tested the save/load part of the code, but it should work without problems.

    Please report any bugs.

    Variable watcher 1.0

  • nevermind, it seems it doesn't work after exporting the project. I'm looking if this can be fixed...

  • No new version? <img src="smileys/smiley13.gif" border="0" align="middle" />

  • broken link... I was planning on trying the old version without save and load...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)