on *:text:!somesay:#channel: { random_quote $chan }
Another observation, my alias works %100, but if you're worried that if on the client that the script is loaded in, you dont see any output coming from you, its because i made the /msg command silent (.msg instead of msg). If you want to see yourself on the same client actually message the channel with a random quote, remove the . from msg.
Now, if you want this to happen in multiple channels, there are a few ways you can go about that, but I'll let you figure that one out on your own.
Because I didn't specify alias -l in the alias, they can be stored in seperate files. You can keep them together if you want. I just provided the alias that will generate a random line and message it to a #target. The on TEXT event is in regards to your trigger since you didn't understand how that worked.
; usage: /random_quote #channel
; you must be in #channel for this to work
; you must include the # when using command
;ex: /random_quote #mychannel would msg the channel with a random line read from textfile (you specify the location to the file you want to read from)
alias random_quote {
if ($1) && ($chr(35) !isin $1) { echo -a ERROR: $1 isn't a valid channel | return }
else {
var %l = $rand(0,$lines(textfile.txt))
$iif($me ison $1,.msg $1 $read(textfile.txt,%l))
}
}
with some basic error checking.