Adding aliases via trigger

Posted by Serreth on Thu 25 Jun 2009 05:02 AM — 3 posts, 16,685 views.

#0
I've been working on a trigger function to help me setup healing aliases for a game I play, and it's ended up being a bigger challenge than I thought. I managed to get the triggers to work in a slipshod manner, but for some reason I can only get one aliases created off the multi-line input;


Your group of 9 members consists of:
  Member           Hits      Move      Position  Fly Inv Water Here Light Mem
-----------------------------------------------------------------------------
  Dranel           perfect   rested    standing   N   Y    N    Y     0    0
  Simsao           perfect   rested    standing   N   Y    N    Y     1    0
  Quizzel          perfect   rested    standing   Y   N    N    Y     0    0
  Seraeth          perfect   rested    standing   Y   Y    N    Y     0    2
  Constant         perfect   rested    standing   Y   N    N    Y     0    2
  Syrnt            perfect   rested    standing   Y   N    N    Y     0    0
  Vyyr             perfect   rested    standing   Y   N    N    Y     1    0
  Ryama            perfect   rested    standing   Y   N    N    Y     0    0
  Vandal           perfect   rested    standing   Y   N    N    Y     1    0


My goal is to create an aliases utilizing the first two letters of each name. Ie; hRy, hOn, hVy.

My trigger is as follows;

<triggers>
  <trigger
   enabled="y"
   group="healsetup"
   lines_to_match="10"
   keep_evaluating="y"
   match="^(.*?) (\w)(\w)(.*?) (perfect|v.good|good|fair|bad|v.bad|awful)"
   regexp="y"
   send_to="10"
   sequence="100"
  >
  <send>/world.addalias "heal_alias", "h%2%3", "cast 'heal' %2%3%4", 1 + 32, ""
</send>
  </trigger>
</triggers>


Thanks.
USA #1
Try out:


<triggers>
  <trigger
   enabled="y"
   match="^  (\w{2})(\w+)\s++(perfect|v.good|good|fair|bad|v.bad|awful)"
   regexp="y"
   send_to="12"
   sequence="100"
   lowercase_wildcard="y"
  >
  <send>AddAlias ("Heal%1%2", "h%1", "cast 'heal' %1%2", 1+1024, "")

</send>
  </trigger>
</triggers>


Some things that are different from yours:

The pattern is a bit more efficient, fewer captures are easier to work with.
SendTo "Script" vs "World". World always sends to the mud. Send to Execute will send it through the command parser so the / in /AddAlias would work, but sending to script cuts out that middle man.
It's not a multiline trigger. You were trying to match 10 lines with a pattern that matches half of 1 line. This way will trigger 10 times, one for each line.
#2
Took the parenthesis from around the addalias in the new syntax you recommended and it works perfectly.

Thank you very much for the upgrade; I've got alot to learn.