Global Settings: Flags
Many of your app's scenarios will be fairly cut-and-dry. For example, a scenario such as "Examine sandwich" might simply produce the output, "It's a ham sandwich and it looks tasty."
But eventually you'll want to create more advanced scenarios where different things happen based on the state of an item or character. That "state" is achieved using flags you've defined in the Flags editor:
Let's assume the aforementioned ham sandwich is in a character's inventory. The character is standing next to a microwave. The player executes the scenario "Use microwave" and the character heats up the sandwich. If the player tries to use the microwave again, the character should refuse.
You would accomplish this using a script and a flag such as is-heated. The "Use microwave" scenario would execute a script, and the general outline of the script would look something like this:
Test: ItemFlagExists (item: sandwich, flag: is-heated)
- Action: Output ("OK, I heated up the sandwich.")
- Action: AddItemFlag (item: sandwich, flag: is-heated)
- Action: Output ("I already used the microwave, the sandwich is hot.")
In the outline above, the sandwich is being tested for the presence of the is-heated flag. The actions under the Fail or Pass paths will be executed based on whether the flag is found or not.
When a game is saved, the flags associated with characters/items are also saved in order to properly preserve and restore state.