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.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Plugins ➜ Trigger help

Trigger help

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


Posted by Talahari   (1 post)  Bio
Date Wed 11 Apr 2007 12:29 AM (UTC)
Message
Alright, Im still learning this whole scriptoing trigger thing...could one of you really smart guys tell me how I need to do this simple task. I am writing a trigger simaler to

You say, test *

then I wish it to print %1 + 1 so when i say "test 1" itll print "test 2".

any ideas?
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #1 on Wed 11 Apr 2007 01:04 AM (UTC)

Amended on Wed 11 Apr 2007 01:05 AM (UTC) by Shaun Biggs

Message
If you are using Lua, then it would be this:
<triggers>
  <trigger
   enabled="y"
   match="You say, test *"
   send_to="12"
   sequence="350"
  >
  <send>print( "test "..tonumber(%1)+1 )
</send>
  </trigger>
</triggers>

I also note that there are no quotes around test 1 in your example. You might have to put them in so the match would be something more similar to:
match="You say, 'test *'"

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #2 on Wed 11 Apr 2007 03:09 AM (UTC)
Message
In "send to script" the substitution is done literally, so this would also work:


<triggers>
  <trigger
   enabled="y"
   match="You say, test *"
   send_to="12"
   sequence="350"
  >
  <send>print( "test ", %1 + 1 )
</send>
  </trigger>
</triggers>

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


15,377 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.