Variables in a trigger

Posted by Melanosol on Wed 24 Apr 2013 12:09 PM — 3 posts, 13,400 views.

#0
Hello there.

I'm trying to set up a series of aliases and triggers for weapon swapping/disarms, so that I don't have a tonne of needless spam going off. What I've reduced it to is; When I change to a different weapon set, it records the mainhand to variable MainHand, and offhand/shield to OffHand. Mostly it's working out, allowing me to specifically remove and wear what I need rather than having it spam to remove 5 items at once before it wears new things. Where I'm struggling is with having it not remove and re-wear my shield. An example trigger as follows;


<aliases>
  <alias
   match="^iced$"
   enabled="y"
   expand_variables="y"
   group="Frelia"
   regexp="y"
   send_to="12"
   ignore_case="y"
   sequence="100"
  >
  <send>OffHand = GetVariable("OffHand")

if OffHand == 'arcanium shield' then
  Send ("wear 'spirit whip'")
  SetVariable ("MainHand", "'spirit whip'")
else
  Send ("remove @OffHand")
  Send ("wear 'arcanium shield'")
  Send ("wear 'spirit whip'")
  SetVariable ("MainHand", "'spirit whip'")
  SetVariable ("OffHand", "'arcanium shield'")
end</send>
  </alias>
</aliases>


What I'm hoping for it to do is to check the OffHand variable, notice if it's my shield or not and then reduce the spam, because I'd rather it not remove and wear my shield again each time (potentially leaving me vulnerable if my timing sucks). I'm using apostrophes around the names as the MUD allows use of them to recognise the entire string, otherwise a space will have it recognise it as a secondary command on the line. Since I sucked at explaining that, an example would be:

<get 'potion of sanctuary' 'robe of pockets'> would have it look for 'potion of sanctuary' within a 'robe of pockets', without them it would tunicate to <get potion of> and simply look for item 'potion' inside 'of'. By using this, I can thus differentiate between multiple shields, whips, swords, whatever.

I appreciate any assistance anyone can offer!
Australia Forum Administrator #1
I can't see anything obviously wrong. Is it not working? If not, in what way?
#2
It was never meeting the condition to do the first set. Worked it out just now, the apostrophes around it were merely functioning as the quotation marks would have, so it was trying to detect arcanium shield instead of 'arcanium shield'.

Changing it to the following fixed it;

if OffHand == "'arcanium shield'" then