Denizen/Commands/Flag: Difference between revisions

From Citizens Wiki

< Denizen‎ | Commands

No edit summary
Line 13: Line 13:


...Too much for you? Let's slow it down.
...Too much for you? Let's slow it down.
=== Examples ===
=== Strings ===
The first, most used, most basic flag you need is a string flag. Strings are basically just variables that represent words or phrases that you can change at any time.
 
For example, <pre>- flag "RandomFlag:Blah something whatever"</pre> would set the flag 'RandomFlag' on the player who's interacting with the script as 'Blah something whatever'.

Revision as of 07:25, 19 June 2013

Introduction

Flags are variables that can be checked anywhere in a script and in other scripts by using flag replaceable tags or the flagged requirement. A flag can be placed on the player, the NPC or globally. Flags placed on a player only apply to that player, and flags placed on an NPC only apply to that individual NPC based on its ID, so NPCs with the same name have different flags because they have different IDs. However, a global flag applies to the entire server and can easily be read from any script.

If a flag's type (player, npc or global) is not specified, the flag is placed on the player by default, and if a value for the flag is not specified, the value is "true" by default.

Usage

To start off, you should set a flag. You can do this by using

- flag ({player}|npc|global) [name([#])](:action)[:value] (duration:#)

You can then use the replaceable tags to call back the flag in any script.

...Too much for you? Let's slow it down.

Strings

The first, most used, most basic flag you need is a string flag. Strings are basically just variables that represent words or phrases that you can change at any time.

For example,

- flag "RandomFlag:Blah something whatever"

would set the flag 'RandomFlag' on the player who's interacting with the script as 'Blah something whatever'.