Commands

Posted by Daruto on Fri 27 Feb 2004 03:28 PM — 3 posts, 13,209 views.

#0
What is the command for if? Lets say i wanna make a trigger "test" and i want the trigger to check a variable "horse". The trigger would be like, if horse equals to 1, then it executes "dog".

And how do you change a variables content with a trigger like, trigger is "test" and i want it to execute a command that would change variable "vars" from 0 to 1, how would i do it?

Any help is greatly appreciated
Australia Forum Administrator #1
Your first question:


<triggers>
  <trigger
   enabled="y"
   match="test"
   send_to="12"
   sequence="100"
  >
  <send>if GetVariable ("horse") = "1" then
  world.Execute "dog"
end if</send>
  </trigger>
</triggers>


Your second question:


<triggers>
  <trigger
   enabled="y"
   match="test"
   send_to="12"
   sequence="100"
  >
  <send>SetVariable "vars", "1"</send>
  </trigger>
</triggers>





Both of these use scripting - the send_to="12" means send the "send" stuff to the script engine. You need to enable scripting and select VBscript for this to work.

Amended on Fri 27 Feb 2004 09:11 PM by Nick Gammon
Australia Forum Administrator #2
Note that variables are stored as strings, if you are storing a number that is fine, but convert it back when you retrieve it.

eg.

hit_points = CInt (GetVariable ("hp"))