mIRC Homepage
Posted By: Gar Random Line - 01/05/04 12:39 AM
What I was trying to do was set something ups so when I type /play it would do one of several things.

I tried to do a $rand, but it did all three at once.

So I come asking for help. When I type

/play

I want it to do one of three things randomly and only one of them

/say message 1
/say message 2
/say message 3
Posted By: Iori Re: Random Line - 01/05/04 12:43 AM
The -r switch forces a single line to be chosen randomly from a file and played.

/play -r action.txt 1500

Posted By: Gar Re: Random Line - 01/05/04 12:46 AM
what's the 150o for?

Also, say if I wanted it to do one of the follwing random:

/notice $1 $2-
/msg $1 $2-
/ms send $1 $2-

how would I do that?
Posted By: SS217 Re: Random Line - 01/05/04 04:25 AM
You could use a small script.
Code:
alias random_message {
var %num = $rand(1,3) 
if (%num == 1) return message 1 here
elseif (%num == 2) return message 2 here
elseif (%num == 3) return message 3 here
}

Then you could use /timerrndmmsg numberofplays intervalinsecs msg channeloruserhere $random_message

Example : /timerrndmmsg 0 10 msg $me $random_message
That would message me with a random message every 10 seconds until you disconnect.

If you need more information /help /timer /help $rand /help /alias /help if-then-else /help variables

Those articles fully explain everything you need to improve or edit my script
Posted By: Wolfie Re: Random Line - 02/05/04 01:35 AM
Code:
msg $target $read(textfile.txt)

That'll read 1 random line from "textfile.txt" and message it to the channel or person that triggered it.

You can replace $target with $active if it's an alias and you want it to only do it in the current room/query you are in.

If you want it to be a random line that is also a command...
Code:
$read(textfile.txt)

That *should* do it. If not, let me know and I'll get you a line that will work.

grin
© mIRC Discussion Forums