Random outputs

Posted by Absolute Zero on Sat 05 Feb 2011 06:42 AM — 5 posts, 22,703 views.

#0
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.
Amended on Sat 05 Feb 2011 12:15 PM by Absolute Zero
Australia Forum Administrator #1
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.
#2
Ok and how do I implement this? I've been adding triggers through the in game trigger menu.
Australia Forum Administrator #3
Template:pasting
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.
#4
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.