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
!add8ball
!del8ball
!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.
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? }
}
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.
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
}
}
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:
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?
$nick(#,$nick,a,rv).pnick
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:
$nick(#,$nick,~&@%)
@ 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