Just Say !8ball <Question / sentence>
on *:text:!8ball*:#: {
set %randxc $r(1,28) {
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 == 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- $+ " }
if (%randxc == 27) { msg $chan $nick, 4Is this a trick? Or you are just stupid? }
if (%randxc == 28) { msg $chan $nick, 7Hello is this John? (I'm sorry , he left in an hour ago.Try calling back later ok?) ok. Oh sorry i was'nt listenning what was your question again?
}
}
Well, for flood control, I typically add this line to non-essential public triggers:
if (%FUN.FLOOD > 6) { return } | inc -z %FUN.FLOOD 3
That prevents more than 3 triggers in a 3 second period, and will only allow 1 extra trigger per 3 seconds until the flood cools down (until people get bored).
Since most networks sustain a user flood cool-down of 1 command per 2 seconds (after an initial 4 commands), that allows plenty of room for essential commands to get through when people are horsing around with my !triggers.
raccoon, in spite of you feeling spited, using play command has one advantage: it comes with a default delay of 1000 milliseconds. (it's adjustable to a longer delay)
While your method works the way it should, it doesn't prevent people from flooding the client running the code if abuse happens. You should consider adding a trigger flood control to it as a minimal precaution.
These are also responses from my yellow smiley face 8ball (sold as Affirmation Ball):
affirmation.txt
At least I love you.
You're a winner!
People like you.
You're good enough.
Nice job!
You look marvelous.
You can do it!
Nice try!
Nice outfit!
Pure Genius!
Who says you're stupid?
The sky's the limit.
It can't be all that bad.
Have you lost weight?
Look on the bright side.
Your breath is so minty.
You're 100% fun!
That's O.K.
Half-full.
Brilliant idea!
And from Sarcastic Ball:
sarcastic.txt
What do you think?
Yeah, right.
You wish.
In your dreams.
Who cares?
Well, maybe.
Not a chance.
Dumb question, ask another.
Yea, and I'm the pope!
Whatever!
Get a clue.
Forget about it.
Sure.
As if.
Ask me if I care.
You've got to be kidding.
Obviously.
Oh, please.
That's ridiculous.
Not!
And from my Lemony Snicket ball:
lemony.txt
As I See It, Grim
Calamity Confirmed
Circumstances Unfavorable
Concentrate And Go Away
Depressingly True
Devastation Assured
Don't Ask Again
Future Glum
Happiness Unlikely
Miserably Correct
Misfortune Imminent
My Reply Is Gloomy
My Sources Say Tragedy
Outlook Wretched
Reply Dismal, Try Again
Ruin Is Certain
Signs Point To Bleak
Sorrowfully Yes
Tragically So
Unfortunately Yes
If you like, you can add them all together for one massive 8ball.txt
For completeness, if anyone's looking for a list of official 8ball responses (as found on an actual Magic 8-Ball 20 sided die), they are as follows:
8ball.txt
Signs point to yes.
Yes.
Reply hazy, try again.
Without a doubt.
My sources say no.
As I see it, yes.
You may rely on it.
Concentrate and ask again.
Outlook not so good.
It is decidedly so.
Better not tell you now.
Very doubtful.
Yes - definitely.
It is certain.
Cannot predict now.
Most likely.
Ask again later.
My reply is no.
Outlook good.
Don't count on it.
There have been changes to the Magic 8-Ball over the years, but this is from one I actually took apart.
You'll notice 10 YES, 5 NO, and 5 TRY AGAIN, which seems to be common across all Magic 8-Ball variations. (Either half-yes and half-no, or 10 / 5 / 5)
Ok. roman, ignore everyone suggesting the use of /play. It is a ridiculous solution. It would be like using a flame thrower to light a cigarette; /play is way overpowered for the simple task you wish to perform.
Scroll up to my previous comment that uses /msg with $read(8ball.txt). It will draw a random line from a text file, while allowing you to prefix your /msg with $nick and color codes, etc, without having to contaminate your 8ball.txt with that markup.
Seriously folks. /play? Do you do this to spite me?
What I meant was you place all of your random 8ball messages into 8ball.txt as such:
.msg %cn 4Ask again later
.msg %cn 4Not a chance
.msg %cn 4As I see it, yes
.msg %cn 4Better not tell you now
.msg %cn 4Cannot predict now
.msg %cn 4Concentrate and ask again
.msg %cn 4It is certain
.msg %cn 4It is decidedly so
.msg %cn 4Most likely
.msg %cn 4My reply is no
.msg %cn 4My sources say no
.msg %cn 4Outlook good
.msg %cn 4Outlook not so good
.msg %cn 4Reply hazy, try again
.msg %cn 4Signs point to yes
.msg %cn 4Very doubtful
.msg %cn 4Without a doubt
.msg %cn 4Yes
.msg %cn 4Yes - definitely
.msg %cn 4You may rely on it
.msg %cn 4Do I Look Like I Care?
.msg %cn 4Yeah, Right }
.msg %cn 4Ask a better question
.msg %cn 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?
.msg %cn 4lol, seriously? You can ask me any question and you ask " $+ $2- $+ "
.msg %cn 4Is this a trick? Or you are just stupid? }
.msg %cn 7Hello is this John? (I'm sorry , he left in an hour ago.Try calling back later ok?) ok. Oh sorry i was'nt listenning what was your question again?Then place this code in the remote of the running client:
on *:TEXT:!8ball*:#: {
set -e %cn $chan $nick $+ ,
.play -cr $chan 8ball.txt
}
and voila.
8ball codes all look the same. Maybe instead of making it the way you did, or using a txt like everyone else.. Try making it a bit different. I went a different route then most. I made it as a socket.
trigger it like...
<~napa182> 8ball, will i ever find my keys?
<&Sick0> :[The magic 8ball says]: Better not tell you now.
on $*:text:/^8ball,?\s.+\?$/iS:#:{
if (!%f) { inc -u4 %f
if ($sock(8b)) sockclose 8b
sockopen 8b pages.cs.wisc.edu 80
sockmark 8b msg # :[The magic 8 ball says]:
}
}
on *:sockopen:8b: {
sockwrite -nt 8b GET /~craft/8ball.cgi HTTP/1.1
sockwrite -nt 8b Host: $+($sock(8b).addr,$str($crlf,2))
}
on *:sockread:8b: {
var %8b | sockread %8b
if ($regex(%8b,/<h4>(.+?)<\/h4>/)) {
$sock(8b).mark $regml(1)
sockclose $sockname
}
}