Detecting when an attribute changes value within a rule that is already true
tatiang
Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
I know other people have figured this out before but I think they've used a different method. I've always found it hard to get this working until I thought of the way a metronome works and applied that.
The idea is that normally when you set a rule condition such as game.count > 5, the rule will trigger (run) when game.count is 6 but not ever again as game.count increases to 7, 8, etc., unless of course game.count goes below 6 again first.
This demo allows you to set up a rule condition so that any time game.count increases after the first time it reached 6, it will trigger a rule.
Also posted in Spare Code at http://forums.gamesalad.com/discussion/comment/449558/#Comment_449558
The idea is that normally when you set a rule condition such as game.count > 5, the rule will trigger (run) when game.count is 6 but not ever again as game.count increases to 7, 8, etc., unless of course game.count goes below 6 again first.
This demo allows you to set up a rule condition so that any time game.count increases after the first time it reached 6, it will trigger a rule.
Also posted in Spare Code at http://forums.gamesalad.com/discussion/comment/449558/#Comment_449558
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Comments
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I was actually wondering if you could use something like this to prevent a value from constantly checking.
I have a menu system in which I want to select on release to move to another set of menu options. However, using on release (with (value+1)%2 to toggle off and on) the loop never ends because release is always true somehow. I've tried fading it out after release, then adding when alpha=1 to only make it selectable then. But if you press the back button and soon as it fades back in, it triggers it again and goes back to the options menu. Pressed solves the problem, but release just feels more natural in terms of my animation and menu set up.
Not trying to jack your thread btw :P
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User