8Ball script

By MackBot on Oct 07, 2009

its a basic !8ball script

all you have to do is type !8ball and it works.

stupid and simple but eh its something.

and my second script so... enjoy :D

on *:TEXT:!8ball*:#:{
  /set %an $rand(1,8)
  if (%an == 1) /msg $chan Yes, $nick
  if (%an == 2) /msg $chan No, $nick
  if (%an == 3) /msg $chan Quite possibly, $nick
  if (%an == 4) /msg $chan Without a doubt, $nick
  if (%an == 5) /msg $chan Absolutely not, $nick
  if (%an == 6) /msg $chan Please ask again, $nick - I can't tell right now
  if (%an == 7) /msg $chan Certainly, $nick
  if (%an == 8) /msg $chan Impossible, $nick
}

Comments

Sign in to comment.
Jethro   -  Dec 17, 2009

you can do a different take by making it into a socket script.I like that, and it doesn't require the necessity of txt to store the 8ball info, which frees up a little hard drive space.

 Respond  
napa182   -  Dec 17, 2009

you can do a different take by making it into a socket script. to use it you ask in the form of a question.

<~napa182> 8ball will i ever find my car keys?
<~Sick0> [The magic 8ball says:] Outlook good.

on $*:text:/^(8ball\s(.+)\?)$/S:#:{ 
  if (!%ball8flood) { 
    set -u3 %ball8flood $nick 
    if ($sock(8ball)) .sockclose 8ball 
    sockopen 8ball pages.cs.wisc.edu 80 
    sockmark 8ball # 14[04The magic 8ball says:14]
  }
}
on *:sockopen:8ball: {
  sockwrite -nt $sockname GET /~craft/8ball.cgi HTTP/1.1 
  sockwrite -nt $sockname Host: $+(pages.cs.wisc.edu,$str($crlf,2)) 
}
on *:sockread:8ball: {
  var %8ball | sockread %8ball
  if ($regex(%8ball,/<h4>(.+)<\/h4>/)) { msg $sock(8ball).mark $regml(1) | sockclose 8ball }
}

just a different take

 Respond  
briggy   -  Oct 12, 2009

didn't say you're wrong! I just said my opinion :)

 Respond  
Jethro   -  Oct 12, 2009

briggy, this is the same philosophy of why we all look different in appearance. Oval, square and triangle faces; blond, brown, brunette and red hairs, as well as the eye and skin colors. As human beings, we all like things differently...and we can't make every one of us to fancy the same thing, can we?

 Respond  
briggy   -  Oct 12, 2009

why not use $read?

on :text:!8ball:#: { if ($2 == $null) msg $chan Specify a question!
else msg $chan $read 8ball.txt }

after that just put a file in your irc directory called 8ball.txt
every answer is separed by a new line.
Here some answers i got:
My answer is: cake.
rawr.
Yes.
No.
Maybe.
I think so.
Are you serious?
Are you kidding?
I thought that too.
Damn you're totally right!
Unfortunately, my answer is no.
Hell Yeah!
No way!
F U PAL

-hope that helped ;)

 Respond  
Cracker200   -  Oct 11, 2009

LOL

 Respond  
Jethro   -  Oct 09, 2009

There you have it. gooshie's terse, valid point says it all.

 Respond  
gooshie   -  Oct 09, 2009

Global variables require a harddrive write/read
local variables are held in ram. Also, by avoiding
set variables as much as possible you 'future proof'
your scripts come the day you wish to run it off a
solid state harddrive or flash memory device. I try
to only use a set global variable if I need to retain
the data across sessions and make it available to all
scripts and connections. Another nice thing about using
local variables is less likely to have variable name
collisions. They only work within that one alias, event,
or menu item. Makes it easy to use single letter variable
names.

 Respond  
hackmaster   -  Oct 08, 2009

ah okey Jethro_ thx alot man :) has been wondering over that a long time...

 Respond  
Jethro   -  Oct 08, 2009

The thing is, if you set %an as a global variable, it'll be stored in your mirc variables at all times. With the local one, it's unset after the %an has been processed. Why add a space in your variables when you don't have to?

 Respond  
hackmaster   -  Oct 08, 2009

But does that metter Jethro_? Dont know what different it makes, does the script run faster or something? Im not complaining about your comment, I just want to know. :)

 Respond  
Jethro   -  Oct 07, 2009

Ack, another 8-ball script with global variable, which isn't necessary, considering the fact that you can utilize the local one to achieve the same result:

var %an = $rand(1,8)
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.