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 ➜ Tips and tricks ➜ Need help with a script

Need help with a script

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


Posted by Kaervos   USA  (11 posts)  Bio
Date Mon 24 Dec 2007 05:44 PM (UTC)
Message
In the MUD I play (Aetolia), I have a bad habit of trying to do things (like take the corpse of a recent kill, for example) before my character has regained balance or equilibrium. I would like to make a script so that when I get the message "You must regain balance/equilibrium first." it will automatically resend the command after getting the message "You have recovered balance/equilibrium." How would I do this?
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Tue 25 Dec 2007 08:22 PM (UTC)
Message
You can do this with two triggers. The first detects a failed attempt to do something, and saves the last command. The second detects the other message, sends the command, and clears it so it doesn't get sent again later.


<triggers>

  <trigger
   enabled="y"
   match="You have recovered balance/equilibrium."
   send_to="12"
   sequence="100"
  >
  <send>

if failed_command then
  Send (failed_command [1])
  failed_command = nil
end -- previous command failed

</send>

  </trigger>
  <trigger
   enabled="y"
   match="You must regain balance/equilibrium first."
   send_to="12"
   sequence="100"
  >
  <send>

failed_command = GetCommandList (1)

</send>
  </trigger>

</triggers>

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Kaervos   USA  (11 posts)  Bio
Date Reply #2 on Tue 25 Dec 2007 09:41 PM (UTC)
Message
Okay...I see how that should work, but I don't know how to put it into MUSHclient so that it _does_ work. I'm a little slow on this scripting stuff...
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Tue 25 Dec 2007 10:01 PM (UTC)
Message
http://www.mushclient.com/pasting

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Kaervos   USA  (11 posts)  Bio
Date Reply #4 on Wed 26 Dec 2007 12:52 AM (UTC)
Message
Thanks!
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.


19,743 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.