[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Adding aliases via trigger
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Adding aliases via trigger

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


Posted by Serreth   (2 posts)  [Biography] 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.
[Go to top] top

Posted by WillFa   USA  (525 posts)  [Biography] 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.
[Go to top] top

Posted by Serreth   (2 posts)  [Biography] 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.
[Go to top] 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.


3,187 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]