Flags
Conditional Variables

Flags are the only variables you have in TSC. They can each hold one of two values - true and false.

To set a flag to true, use <FL+, and to set a flag to false, use <FL-.
<FL+4010<FL-4010
The useful thing about flags is that you can jump to different events depending on whether or not a flag is set. Also, they can make entities appear or disappear based on their Entity ID (FlagID).

Here's some code to demonstrate:
#0701
<KEY<DNP0701<IT+0001<MSG
Got =Arthur's Key=.<NOD<FL+5000<END
Make a sparkling item (NPC 70) and put it in Mimiga Village. Set the event number to 701, and the Entity ID (or FlagID) to 5000. Now, check options 0x2000 and 0x4000. The 0x4000 option will let the item disappear once flag 5000 is set. Notice that flag 5000 is set to true inside TSC event #701.

Pick up the item and you'll notice that it disappears because we used <DNP0701. When you re-enter the map from a different map, the item will still be gone because flag 5000 is set.

Here's a different example:
#0702
<KEY<MSG<FLJ5001:0703Hey, I haven't seen you before.<FL+5001<NOD<END

#0703
You already talked to me.<NOD<END
Create a human or mimiga and place him or her in Mimiga Village. Give the NPC event number 702 and check option 0x2000. Talk to the NPC once and then twice, and you'll see the second message because of flags.

Navigation
Previous Lesson: TSC
Next Lesson: Animations
Table of Contents