mIRC Homepage
Posted By: barkingpanda Help with randomisation script - 14/04/14 10:52 AM
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.
Posted By: Nillen Re: Help with randomisation script - 14/04/14 10:55 AM
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.
Posted By: barkingpanda Re: Help with randomisation script - 14/04/14 11:00 AM
That works perfectly. smile Thanks a lot for the help <3
Posted By: judge2020 Re: Help with randomisation script - 14/04/14 02:35 PM
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 }
Posted By: Loki12583 Re: Help with randomisation script - 14/04/14 02:50 PM
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 }
© mIRC Discussion Forums