Top

!8ball revisited


mIRC Code
+ 0 likes
Please Register to submit score.
Bookmark and Share
Average Score  0.0 (of 0 scores)
Date Added  Sep 22, 2009
Last Updated  Sep 22, 2009
Tags  8ball  bot  channel  fun 

Description

Well here it is. 8ball refined!

This will automatically create the needed text file to read from plus put some default entries in it for you when its loaded.

Triggers are :

!8ball <question>
!add8ball <reply to add>
!del8ball <reply to delete>

!8ball is fairly obvious ask a question get a reply.
!add8ball allows people with the proper permissions add replies directly to the .txt file for future use
!del8ball allows people with the proper permissions to delete replies from the .txt

for bot owners theres Nick protection of sorts. replace "PUT YOUR NICK HERE" in this line :
if (PUT YOUR NICK HERE isin $2-) { $_jibb($chan) } with your own nick.

Not sure im totally done with this one but enjoy for now. As always im open to ideas and suggestions.

Grab the Code

on *:LOAD: {
  echo -a JibbaNet 8ball v1.0 Loaded
  echo -a 8ball.txt + Default Replies written.
  write $scriptdir8ball.txt Ask again later
  write $scriptdir8ball.txt Not a chance
  write $scriptdir8ball.txt As I see it, yes
  write $scriptdir8ball.txt Better not tell you now
  write $scriptdir8ball.txt Cannot predict now
  write $scriptdir8ball.txt Concentrate and ask again
  write $scriptdir8ball.txt Don't count on it
  write $scriptdir8ball.txt It is certain
  write $scriptdir8ball.txt It is decidedly so
  write $scriptdir8ball.txt Most likely
  write $scriptdir8ball.txt My reply is no
  write $scriptdir8ball.txt My sources say no
  write $scriptdir8ball.txt Outlook good
  write $scriptdir8ball.txt Outlook not so good
  write $scriptdir8ball.txt Reply hazy, try again
  write $scriptdir8ball.txt Signs point to yes
  write $scriptdir8ball.txt Very doubtful
  write $scriptdir8ball.txt Without a doubt
  write $scriptdir8ball.txt Yes
  write $scriptdir8ball.txt Yes - definitely
  write $scriptdir8ball.txt You may rely on it
  write $scriptdir8ball.txt Do I Look Like I Care?
  write $scriptdir8ball.txt Yeah, Right
  write $scriptdir8ball.txt Ask a better question
  write $scriptdir8ball.txt 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?
  write $scriptdir8ball.txt lol, seriously? You can ask me any question and you ask " $+ $2- $+ "
  write $scriptdir8ball.txt zzzZZZzzz
  write $scriptdir8ball.txt screw off, ask later
  write $scriptdir8ball.txt hell no!
  write $scriptdir8ball.txt how the hell should i know?
  write $scriptdir8ball.txt penis!
  write $scriptdir8ball.txt ah too drunk, i'll just say yes....
  write $scriptdir8ball.txt SCREW OFF YOU SMELL
  write $scriptdir8ball.txt why the hell not? sure!
  write $scriptdir8ball.txt 01110101010101100001100101001000100100011001011001111010100100001001000010010
  write $scriptdir8ball.txt Give me a cookie and I will say yes
  write $scriptdir8ball.txt thats what she said
  write $scriptdir8ball.txt i'm to lazy to choose
  write $scriptdir8ball.txt ohhhhhhh..... shiny.....
  write $scriptdir8ball.txt hello, is this thing on? i said NO!
  write $scriptdir8ball.txt ask again.. ah never
  write $scriptdir8ball.txt uh no frigging way
  write $scriptdir8ball.txt $@Q%Q##_I(_(@#)^*#$_@!_%(*~!*)&@%!*%^@!
  write $scriptdir8ball.txt Your mommy said no 
}
 
on *:TEXT:*:#: {
  var %a = 1
  var %totlines = $lines($scriptdir8ball.txt)
  if ($1 == !add8ball) { 
    if ($regex($nick($chan,$nick).pnick,[&~])) {
      if ($2) {
        while (%a <= %totlines) {
          if ($2- == $read($scriptdir8ball.txt, %a)) { set %_8ballfound 1 }
          inc %a
        }
        if (%_8ballfound) { msg $chan $+(,",$2-,",) has already been added. | unset %_8ballfound  }
        else {
          write $scriptdir8ball.txt $2-
          msg $chan $+(,",$2-,",) has been added to the reply list.
        }
      }
      else { msg $chan No Reply Was Stated. }
    }
    else { msg $chan access denied }
  }
  elseif ($1 == !del8ball) {
    if ($regex($nick($chan,$nick).pnick,[&~])) {
      if ($2) {
        while (%a <= %totlines) {
          if ($2- == $read($scriptdir8ball.txt, %a)) { set %_8ballfound2 %a }
          inc %a
        }
        if (%_8ballfound2) { write -dl $+ %_8ballfound2 $scriptdir8ball.txt | msg $chan $+(,",$2-,",) has been deleted. | unset %_8ballfound2 %a }
        else { msg $chan No Matching Entries Found }
      }
      else { msg $chan Please Enter Something To Delete. }
    }
    else { msg $chan access denied }
  }
  elseif ($1 == !8ball) {
    if ($2) {
      var %8ball = $read($scriptdir8ball.txt,n, $rand(1,$lines($scriptdir8ball.txt)))
      if (PUT YOUR NICK HERE isin $2-) { $_jibb($chan) }
      else { msg $chan %8ball }
    }
    else { msg $chan Please Enter A Question Silly }
  }
}
 
alias -l _jibb {
  var %chan = $1
  var %jibb = $rand(1,4)
  if (%jibb = 1) { msg %chan $nick If you dont stop picking on him im gonna kick u in the nutz! }
  if (%jibb = 2) { msg %chan $nick flattery will get you nowhere }
  if (%jibb = 3) { msg %chan $nick Ill lick you for 0.50 cents }
  if (%jibb = 4) { msg %chan im sorry $nick hes not here right now can i help you? }
}

Comments

  (14)  RSS
VinX
Comments: 61
 
mIRC Snippet:  !8ball revisited
Posted on Sep 22, 2009 3:27 am
* /msg: insufficient parameters (line 89, 8ball)
-

89'th line : else { msg $chan %8ball }



Jibberish
Comments: 16
 
mIRC Snippet:  !8ball revisited
Posted on Sep 22, 2009 9:04 am
did you replace "PUT NICK HERE" with your nick?
sunslayer
Comments: 419
 
mIRC Snippet:  !8ball revisited
Posted on Sep 22, 2009 3:28 pm
Code:
    if ($regex($nick($chan,$nick).pnick,[&~])) {
not all networks support ~&
Jethro_
Comments: 936
 
mIRC Snippet:  !8ball revisited
Posted on Sep 22, 2009 4:51 pm
Why use the regex engine when you can do:
Code:
if ($nick(#,$nick,a,rv).pnick) {
this will exclude regular and voiced users and make it available to the rest of usermodes.
Jibberish
Comments: 16
 
mIRC Snippet:  !8ball revisited
Posted on Sep 24, 2009 10:09 pm
@ sunslayer yea ur right it wont work on all nets was coded on unrealircd so should work on any net using that or similar.

@ Jethro_ i only used it because it was something i had recently learned, either way will work.

and i wanted to restrict it to only & and up for the delete entry and add entry parts for personal reasons. you can easily change it tho to include other access levels
Jethro_
Comments: 936
 
mIRC Snippet:  !8ball revisited
Posted on Sep 24, 2009 11:30 pm
Yes, that's good for every one of us to learn something new, but then the question remains, why go the extra mile when you can do something in a shorter fashion? We should always find efficient, clean and non-redundant ways to go about scripting.
gooshie
Comments: 181
 
mIRC Snippet:  !8ball revisited
Posted on Sep 25, 2009 1:17 pm
Code:
$nick(#,$nick,a,rv).pnick

Quote:
<Jethro_> this will exclude regular and voiced users and make it available to the rest of usermodes


No need for the .pnick propery. This $nick(#,$nick,a,rv) will actually
evaluate false for ALL users with voice even if they have a higher mode.
To get the results you want use:

Code:
$nick(#,$nick,~&@%)
Jethro_
Comments: 936
 
mIRC Snippet:  !8ball revisited
Posted on Sep 25, 2009 1:25 pm
gooshie, while I agree the .pnick property is needless, I have to disagree with you regarding my example. If you test it, it works exactly the same per your suggestion:
Code:
on event {
  if $nick(#,$nick,a,rv) {
    echo -a true
  }
}
If I'm incorrect, please give me an explanation why it'll be evaluated falsely?
gooshie
Comments: 181
 
mIRC Snippet:  !8ball revisited
Posted on Sep 25, 2009 1:50 pm
Jethro_

Code:
$nick(#,$nick,a,rv) != $nick(#,$nick,~&@%)


Same number of keystrokes different results.
Test it for yourself. Make a random room so
you have ops and then voice yourself and then:

Code:
//echo ==> $nick(#,$me,a,rv) != $nick(#,$me,~&@%)
Jethro_
Comments: 936
 
mIRC Snippet:  !8ball revisited
Posted on Sep 25, 2009 2:23 pm
Ok, I see what you mean now. Thanks for the demonstration, gooshie.
gooshie
Comments: 181
 
mIRC Snippet:  !8ball revisited
Posted on Sep 25, 2009 5:28 pm
Glad to help Jethro_
gooshie
Comments: 181
 
mIRC Snippet:  !8ball revisited
Posted on Oct 12, 2009 8:43 am
Needs an if $exists for the file on load event.
I only put enough file writes to demonstrate.
Eliminated set/global variables.
Eliminated _jibb alias.
Simplified while loops.
Changed !commands so !8ball* could
be used in on TEXT event filter.

Code:
on *:TEXT:!8ball*:#: {
  var %i 1,%x,%f $scriptdir8ball.txt
  if $1 == !8balladd {
    if $nick(#,$nick,~&@) {
      if $2 {
        while $read(%f,%i) {
          if $2- == $v1 { %x = 1 }
          inc %i
        }
        if %x { msg # $+(,",$2-,",) has already been added. }
        else { write %f $2- | msg # $+(,",$2-,",) has been added to the reply list. }
      }
      else { msg # No Reply Was Stated. }
    }
    else { msg # access denied }
  }
  elseif $1 == !8balldel {
    if $nick(#,$nick,~&@) {
      if $2 {
        while $read(%f,%i) {
          if $2- == $v1 { %x = %i }
          inc %i
        }
        if %x { write -dl $+ %x %f | msg # $+(,",$2-,",) has been deleted. }
        else { msg # No Matching Entries Found }
      }
      else { msg # Please Enter Something To Delete. }
    }
    else { msg # access denied }
  }
  elseif $1 == !8ball {
    if $2 {
      if $me isin $2- {
        goto $r(1,4)
        :1 | msg # $nick if you dont stop picking on $me I'm gonna kick you in the nutz! | halt
        :2 | msg # I'm sorry $nick he's not here right now can I help you? | halt
        :3 | msg # Flattery will get you nowhere $nick $+ . | halt
        :4 | msg # $nick $+ , I'll lick you for 50 cents.
      }
      else { msg # $read(%f) }
    }
    else { msg # Please Enter A Question Silly }
  }
}
on *:LOAD: {
  echo -a JibbaNet 8ball v1.0 Loaded
  var %f $scriptdir8ball.txt
  if !$exists(%f) {
    echo -a Default Replies written to: %f
    %f = write %f
    %f Ask again later
    %f Not a chance
    %f As I see it, yes
    %f Cannot predict now
    %f Don't count on it
    %f It is certain
  }
}
Jibberish
Comments: 16
 
mIRC Snippet:  !8ball revisited
Posted on Nov 26, 2009 12:15 am
nice. been a while since i logged in here :D i like what u did thanks for the tips.
bugboy1028
Comments: 32
 
mIRC Snippet:  !8ball revisited
Posted on Jan 29, 2010 5:42 pm
I want script to work with me also.... how i do that?

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  

Bottom