mIRC Home    About    Download    Register    News    Help

Print Thread
how do i get my bot to select random line #245714 04/05/14 03:23 PM
Joined: May 2014
Posts: 2
E
EyeofSauron Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
E
Joined: May 2014
Posts: 2
ok, so im really new to this, i got the basics down, but i dont know how to get the bot to just pick a random line on a command.

for example i have:
on *:JOIN:#: { msg $chan Welcome $nick }


now i want for example 3 different welcome lines, for example:
welcome to the channel, $nick
Hello there, $nick
good evening $nick

is there any possibilty to do this?
ive looked for like 5 hours all around the internet, but apparently i dont have the right search terms or im just stupid.

thx for the help, cheers!

Last edited by EyeofSauron; 04/05/14 03:23 PM.
Re: how do i get my bot to select random line [Re: EyeofSauron] #245715 04/05/14 03:32 PM
Joined: May 2014
Posts: 13
S
Shakar Offline
Pikka bird
Offline
Pikka bird
S
Joined: May 2014
Posts: 13
You could do something like this
Code:
on *:join:#: {
var %greet = $rand(1,3)
if (%greet == 1) { msg $chan welcome to the channel, $nick }
elseif (%greet == 2) { msg $chan Hello there, $nick }
elseif (%greet == 3) { msg $chan good evening $nick }
}

Last edited by Shakar; 04/05/14 03:38 PM.
Re: how do i get my bot to select random line [Re: Shakar] #245717 04/05/14 03:38 PM
Joined: May 2014
Posts: 2
E
EyeofSauron Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
E
Joined: May 2014
Posts: 2
thx so much shakar, it works perfectly, i even tried it with the TEXT command, also works perfectly!

you are a godsent laugh

Re: how do i get my bot to select random line [Re: EyeofSauron] #245718 04/05/14 03:48 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Originally Posted By: EyeofSauron
is there any possibilty to do this?
ive looked for like 5 hours all around the internet, but apparently i dont have the right search terms or im just stupid.
http://lmgtfy.com/?q=mirc+random+line
As it suggest, the easiest way to do this with 1 line is to use $read(textfile.txt) this returns the value of a random line from textfile.txt which is located in your mircdir.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net