this is my first script....before I new how to use notes but its pretty simple but fun...also, fairly random...very noobish
on *:text:!8ball*:#: {
set %randxc $r(1,26) {
if (%randxc == 1) { msg $chan $nick, 4Ask again later }
if (%randxc == 2) { msg $chan $nick, 4Not a chance }
if (%randxc == 3) { msg $chan $nick, 4As I see it, yes }
if (%randxc == 4) { msg $chan $nick, 4Better not tell you now }
if (%randxc == 5) { msg $chan $nick, 4Cannot predict now }
if (%randxc == 6) { msg $chan $nick, 4Concentrate and ask again }
if (%randxc == 7) { msg $chan $nick, 4Don't count on it }
if (%randxc == 8) { msg $chan $nick, 4It is certain }
if (%randxc == 9) { msg $chan $nick, 4It is decidedly so }
if (%randxc == 10) { msg $chan $nick, 4Most likely }
if (%randxc == 11) { msg $chan $nick, 4My reply is no }
if (%randxc == 12) { msg $chan $nick, 4My sources say no }
if (%randxc == 13) { msg $chan $nick, 4Outlook good }
if (%randxc == 14) { msg $chan $nick, 4Outlook not so good }
if (%randxc == 15) { msg $chan $nick, 4Reply hazy, try again }
if (%randxc == 16) { msg $chan $nick, 4Signs point to yes }
if (%randxc == 17) { msg $chan $nick, 4Very doubtful }
if (%randxc == 18) { msg $chan $nick, 4Without a doubt }
if (%randxc == 19) { msg $chan $nick, 4Yes }
if (%randxc == 20) { msg $chan $nick, 4Yes - definitely }
if (%randxc == 21) { msg $chan $nick, 4You may rely on it }
if (%randxc == 22) { msg $chan $nick, 4Do I Look Like I Care? }
if (%randxc == 23) { msg $chan $nick, 4Yeah, Right }
if (%randxc == 24) { msg $chan $nick, 4Ask a better question }
if (%randxc == 25) { msg $chan $nick, 4Well, $rand(1,50) years, $rand(17,364) days, $rand(0,23) hours, $rand(0,59) minutes, and some odd seconds...wait, what was the question? }
if (%randxc == 26) { msg $chan $nick, 4lol, seriously? You can ask me any question and you ask " $+ $2- $+ " }
}
}
or you can use regex to make sure it is in a question format.
trigger 8ball question here? it has to have 8ball at the start and a ? at the end for it to work also add a bit of flood control to it.
on *:text:*:#:{
if ($regex($1-,/^(8ball\s(.*)\?)$/S) && !$($+(%,ball8flood),2)) {
set -u3 $+(%,ball8flood) $nick
var %^ = Ask again later.|Not a chance.|As I see it, yes.|Don't count on it.|My sources say no.|Yes.
describe # shakes up the 8ball...
.timer8ball 1 2 msg # The magic 8ball says: $gettok(%^,$r(1,6),124)
}
}
Aucun: I don't think it really matters if you change everything else after the first one to 'elseif', because the variable, according to his script, can't be 1 or 6 or 18..different numbers at the same time.
I think the bot should question the user if he or she supplied an answer or not. You can't really answer a question without one, can you? :P
Maybe add something like:
if (!$2-) { notice $nick Please supply a question! }
?
You can completely ignore what I say from here, xero_art:
You can also use tokens:
on *:text:!8ball*:#: {
if (!$2-) { notice $nick Please supply a question! }
else { var %randxc Ask again later|Not a chance|As I see it, yes|Better not tell you now|Cannot predict now|Concentrate and ask again|Don't count on it|It is certain|It is decidedly so|Most likely|My reply is no|My sources say no|Outlook good|Outlook not so good|Reply hazy, try again|Signs point to yes|Very doubtful|Without a doubt|Yes|Yes - definitely|You may rely on it|Do I look like I care?|Yeah, right|Ask a better question|Well, $rand(1,50) years, $rand(17,364) days, $rand(0,23) hours, $rand(0,59) minutes, and some odd seconds...wait, what was the question?|lol, seriously? You can ask me any question and you ask $+(",$2-,")
msg $chan $+($nick,$chr(58)) $+($chr(3),4,$gettok(%randxc,$rand(1,$numtok(%randxc,124)),124)) } }
Set all of the possibilities into one variable, dividing them with the character "|" (aka $chr(124)), and finally using $gettok to get a random token from 1 to 26 (all tokens in %randxc, or $numtok(%randxc)) all in the variable %randxc,
In English: You can use tokens to significantly shorten your scripts. :]