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 ➜ General ➜ Random outputs

Random outputs

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


Posted by Absolute Zero   (3 posts)  Bio
Date Sat 05 Feb 2011 06:42 AM (UTC)

Amended on Sat 05 Feb 2011 12:15 PM (UTC) by Absolute Zero

Message
Ok so I don't know how simple or complex this is but I would like to make a simple trigger and alias to do two different things

My trigger is to match '* attacks you!'

What I'd like it to do is output one of four different things at random:

1) yell OH HELP

2) page fcpd %1 is killing me!

3) say Dead or alive you're coming with me

and the alias is 'grief *'

I want it to attack %1 and also output one of three different things at random

1) yell DEAD OR ALIVE YOU'RE COMING WITH ME

2) -%1 You are being greifed please hold still

3) -%1 hey check out my new camera

I'd also like space to add extra ones as I think of them with an equal chance of any among them being used...

I don't know how to do this myself so thanks for any help you can give.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 05 Feb 2011 08:27 PM (UTC)
Message
The trigger would look like this:


<triggers>
  <trigger
   enabled="y"
   match="* attacks you!"
   send_to="12"
   sequence="100"
  >
  <send>

local responses = {
  "yell OH HELP",
  "page fcpd %1 is killing me!",
  "say Dead or alive you're coming with me",

-- more here

}

Send (responses  [math.random (1, #responses)])

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


The alias will be similar.

- Nick Gammon

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

Posted by Absolute Zero   (3 posts)  Bio
Date Reply #2 on Sun 06 Feb 2011 08:23 AM (UTC)
Message
Ok and how do I implement this? I've been adding triggers through the in game trigger menu.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #3 on Sun 06 Feb 2011 08:26 AM (UTC)
Message
Template:pasting For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.

- Nick Gammon

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

Posted by Absolute Zero   (3 posts)  Bio
Date Reply #4 on Tue 28 Feb 2012 11:45 AM (UTC)
Message
Hate to ressurect this thread, But I can't figure out how to transfer this script into a similar scenario but for a timer.


I'd like to make a timer that every time it fires, sends a random input from a list, but this time each repetition of the timer should be able to do two inputs, for instance

option one:
ping
@me doing is=option one

option two:
ping
@me doing is=this is option two

option three:
ping
@me doing is=and this is option three

It should be similar to the previous in that those two inputs could be anything, and that more should be readily addable to the list... I look forward to your reply and would like to thank you for your previous help and hope you can help me again.
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.


17,726 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.