{{tag>dragonscript behavior}} [[:start|Start Page]] >> [[main|DragonScript Scripting Language]] >> [[dragengine:modules:dragonscript:abstractions|Abstraction Layers: How you want to build your Game]] >> [[dragengine:modules:dragonscript:behavior_elements|Behavior Elements]] >> **GABehaviorFlags** ====== GABehaviorFlags ====== Game app behavior adding flags support to state machines. Adds actions, conditions and events allowing state machines to set, clear and check named flags. Flags that are not set are considered cleared. To access this behavior from other application behaviors use ''GABehaviorFlagsiorStateMachine.getBehaviorInApp()''. This behavior can be added only once to a game app. ====== State Machine Actions ====== This behavior adds these state machine actions if state machines are present. ===== flags.update ===== Update flags. Action always succeeds. ^Parameter^Value^Description^ |set|string|Set named flag.| |clear|string|Clear named flag.| This is an example of setting a flag: arrived at target This is an example of setting and clearing a flag in the same action: arrived at target stay seated ====== State Machine Conditions ====== This behavior adds these state machine conditions if state machines are present. ===== flags.check ===== Check flag parameters. Condition returns true if all parameter values match their respective flag state. ^Parameter^Value^Description^ |flags.flag|string|Flag to check.| |flags.set|''true'', ''false''|Flag is set or not.| This is an example of using this condition: flags.check arrived at target true ====== State Machine Events ====== This behavior sends these state machine events. ===== flags.set: ===== Flag named ''name'' changed from cleared to set. The name of the flag is appended to the event name. This is an example of a transition that runs if the flag "arrived at target" has been set: ===== flags.cleared: ===== Flag named ''name'' changed from set to cleared. The name of the flag is appended to the event name. This is an example of a transition that runs if the flag "arrived at target" has been cleared: ====== Required Behaviors ====== This behavior requires no other behaviors. ====== Optional Behaviors ====== * [[gabehavior_statemachine|GABehaviorStateMachine]]: Add actions and conditions for state machine to use and events to send to the state machine. ====== API Documentation ====== #@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1GABehaviorFlags.html,GABehaviorFlags~@#. Since DragonScript Module Version ''1.35'' ====== Use Cases ====== * Remember that an event has happened. * Share a yes/no state between state machines. * Wait until another part of the game sets a flag before continuing. ====== Live Examples ====== * [[https://github.com/LordOfDragons/deexamples|DEExamples Repository]]