Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ General ➜ Adding aliases via trigger

Adding aliases via trigger

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Serreth   (2 posts)  Bio
Date Thu 25 Jun 2009 05:02 AM (UTC)
Message
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.
Top

Posted by WillFa   USA  (525 posts)  Bio
Date Reply #1 on Thu 25 Jun 2009 05:46 AM (UTC)
Message
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.
Top

Posted by Serreth   (2 posts)  Bio
Date Reply #2 on Thu 25 Jun 2009 06:03 AM (UTC)
Message
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.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


12,705 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.