Also in this section: Aliases | Triggers | Examples and importable scripts
A variable is something that holds a value for you, and which can be changed easily either by aliases, triggers, or a manual command. This value can be an alias, a number, a phrase, a word, it can be empty, etc.
My new spellup script relies heavily on variables. I will post it on here as soon as I have it complete.
To use variables: In the Script Parser section of Preferences, "Expand vars" must have a tick mark. Under the "Characters" tab, check what the variable character is at. It should be @. I will explain usage assuming that it is so. If you change your variable character, remember to insert that wherever you see I use @.
To create a variable, you can either click on variables and then click new, type the name, and insert the value. You can also type in the command line: "variablename=value" ex. inagroup=0
To do something with the variable, you need to put @ in front of it (no space).
Typing "#ECHO In a group variable is set to @inagroup" will tell you what inagroup is currently set to.
If inagroup is 1, you will see on the screen (without having the commands sent to the server):
In a group variable is set to 1
Now where might you use a variable
like this?
Let's say you have a tick timer
that warns on 10 seconds (i.e. "timeout" is set to 10 seconds)
You'd have a trigger that looks
like this:
pattern:
TICK IN 10 SECONDS.
command:
#IF @inagroup=1 {gt tick in 10}
Note: I don't use the tick timer's built-in command-on-timeout feature, because I have MANY different triggers that all need to run on tick in 10, but I toggle between them all the time.
Thus, you can use a variable
to only send "gt tick in 10" to the mud if you are actually grouped (i.e.
inagroup is set to 1)
I have many such anti-spam triggers. :-)
Another use for variables would be to store how much xp you need for your next Con train or whatever. Either make a trigger to record the value whenever you hit "train" at a guildmaster, or just type "contrain=51372" in the command line. Then you can view the variable later with "#ECHO Next con train: @contrain" or however you feel.
Also in this section: Aliases | Triggers | Examples and importable scripts