mIRC Home    About    Download    Register    News    Help

Print Thread
Help with randomisation script #245245 14/04/14 10:52 AM
Joined: Apr 2014
Posts: 9
B
barkingpanda Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Apr 2014
Posts: 9
Hello. I'm completely new to scripting (just started today), and I'm working on a Twitch.tv bot for a lazy friend of mine.

I need (or rather, would like) a script that'll generate a random message (out of a list of options) on command.

For example, "!heyexample", triggering: "hey friend", or "how are ya" or "whats going on?"

If anyone can help I'd greatly appreciate it. smile Thanks.

Re: Help with randomisation script [Re: barkingpanda] #245246 14/04/14 10:55 AM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Make a textfile in your mircdir (default: C:\Users\Username\AppData\Roaming\mIRC) called Greets.txt

Code:
on *:text:!heyexample:#: { msg # $read(Greets.txt) }


What $read does is read a random line out of the text file you present.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: Help with randomisation script [Re: Nillen] #245247 14/04/14 11:00 AM
Joined: Apr 2014
Posts: 9
B
barkingpanda Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Apr 2014
Posts: 9
That works perfectly. smile Thanks a lot for the help <3

Re: Help with randomisation script [Re: barkingpanda] #245257 14/04/14 02:35 PM
Joined: Mar 2014
Posts: 215
J
judge2020 Offline
Fjord artisan
Offline
Fjord artisan
J
Joined: Mar 2014
Posts: 215
another way to do it is make a random variable then have different responses for the number
Code:
var %hi = $rand(1,3)
if (%hi == 1) { msg # Hello $nick }
if (%hi == 2) { msg # what's up $nick }
if (%hi == 3) { msg # Welcome $nick }


#imAbeginner
i made a chat bot for mark_paintball! http://twitch.tv/mark_paintball
Re: Help with randomisation script [Re: judge2020] #245259 14/04/14 02:50 PM
Joined: Jan 2004
Posts: 1,319
L
Loki12583 Online
Hoopy frood
Online
Hoopy frood
L
Joined: Jan 2004
Posts: 1,319
Originally Posted By: judge2020
another way to do it is make a random variable then have different responses for the number
Code:
var %hi = $rand(1,3)
if (%hi == 1) { msg # Hello $nick }
if (%hi == 2) { msg # what's up $nick }
if (%hi == 3) { msg # Welcome $nick }


Code:
var %hi = $rand(1,3)
if (%hi == 1) { msg # Hello $nick }
elseif (%hi == 2) { msg # what's up $nick }
elseif (%hi == 3) { msg # Welcome $nick }