mIRC Home    About    Download    Register    News    Help

Print Thread
Random Line #81415 01/05/04 12:39 AM
Joined: Sep 2003
Posts: 122
Gar Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Sep 2003
Posts: 122
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

Re: Random Line #81416 01/05/04 12:43 AM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
The -r switch forces a single line to be chosen randomly from a file and played.

/play -r action.txt 1500


Re: Random Line #81417 01/05/04 12:46 AM
Joined: Sep 2003
Posts: 122
Gar Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Sep 2003
Posts: 122
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?

Re: Random Line #81418 01/05/04 04:25 AM
Joined: Apr 2003
Posts: 25
S
SS217 Offline
Ameglian cow
Offline
Ameglian cow
S
Joined: Apr 2003
Posts: 25
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

Re: Random Line #81419 02/05/04 01:35 AM
Joined: Aug 2003
Posts: 325
W
Wolfie Offline
Fjord artisan
Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
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