Writing an IF routine (?) to do a certain action once a requirement is met

Posted by Natasi on Fri 12 Nov 2004 06:36 PM — 4 posts, 17,055 views.

#0
When using a skill to peer at someones mana I would like the cleint to see when they are under half mana and if so perform a certain action. I figured this would have to be written through an IF routine, but unsure as to do the this with %1 = type stuff.

This is how it looks when I contemplate someone:

Midget's mana stands at 3142/3142.

I want it set so that if say it read:

Midget's mana stands at 1245/3142.

then it would send a command to slap Midget...it has to be set also so I can use it against others, so the mana total will never be the same. Thanks for any help guys
USA #1

<triggers>
  <trigger
   enabled="y"
   expand_variables="y"
   ignore_case="y"
   match="@target's mana stands at */*."
   send_to="12"
   sequence="100"
  >
  <send>if (%1*2 &lt;= %2) then
send &quot;slap @target&quot;
end if</send>
  </trigger>
</triggers>

<variables>
  <variable name="target">midget</variable>
</variables>


Copy between <triggers> and </triggers> and then paste in the trigger window, and do the same with <variables>.

You set the variable 'target' with whatever the name of the thing was (midget in this case) WITHOUT the apostrophe.
USA #2
You can use this alias to set that other variable as well.


<aliases>
  <alias
   match="target *"
   enabled="y"
   echo_alias="y"
   variable="target"
   send_to="9"
   ignore_case="y"
   sequence="100"
  >
  <send>%1</send>
  </alias>
</aliases>


Obviously, you can alter the match text to suit your needs, as well as changing the variable name (you'll have to do it to the trigger, and the alias, TWO locations in the trigger, and then one in the alias's "variable" field.
The trigger is in the match text, as well as the send field.
#3
works perfectly! Thanks for the help