egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Joke Script Wont reply to commands, help please

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
chaokusc
Voice


Joined: 25 Apr 2006
Posts: 18

PostPosted: Tue Apr 25, 2006 6:46 am    Post subject: Joke Script Wont reply to commands, help please Reply with quote

Im not sure whats wrong with my script, only !jokes and !joke yomama work

Yes im new to tcl script but i would like to learn it, but im not sure what is wrong with this script... if anyone can tell me that would be great
( Jokes cut down to 2 jokes from the whole list in order to make script shorter )

Code:
# !Jokes
bind pub - !jokes pub_jokes
bind pub - "!joke" pub:redneck
bind pub - "!joke" pub:annoy
bind pub - "!joke" pub:blonde
bind pub - "!joke" pub:computers
bind pub - "!joke" pub:condoms
bind pub - "!joke" pub:elevator
bind pub - "!joke" pub:misc
bind pub - "!joke" pub:thoughts
bind pub - "!joke" pub:yomama

proc pub_jokes {nick uhost hand chan text} {
putserv "NOTICE $nick : 4\[7»»4\] Joke Commands 4\[7««4\]"
putserv "NOTICE $nick : 4!joke 7Random Joke"
putserv "NOTICE $nick : 4!joke annoy 7 101 Ways To Annoy Someone"
putserv "NOTICE $nick : 4!joke blonde 7 Blonde Jokes"
putserv "NOTICE $nick : 4!joke computers 7 Computer Jokes"
putserv "NOTICE $nick : 4!joke elevator 7 52 Fun Things To Do In An Elevator"
putserv "NOTICE $nick : 4!joke condoms 7 Condom Jokes"
putserv "NOTICE $nick : 4!joke misc 7 Misc Jokes"
putserv "NOTICE $nick : 4!joke redneck 7 Redneck Jokes"
putserv "NOTICE $nick : 4!joke thoughts 7 Whats On Your Mind"
putserv "NOTICE $nick : 4!joke yomama 7 Yo Mama Jokes"
}

set redneckjokes {
"More than one living relative is named after a Southern Civil War general"
"You think the stock market has a fence around it"
}

proc pub:redneck { nick uhost handle channel text } {
global redneckjokes
if {$text == "redneck"} {
   set respond [lindex $redneckjokes [rand [llength $redneckjokes]]]
   putserv "PRIVMSG $channel :\002$nick\002 You Might Be A Redneck If: $respond"
   }
}

set annoyjokes {
"Get to know a friends bookie and place bets for them. Insist on keeping half of any money they win."
"Accuse people of \"glue sniffing addictions\" in public."
}

proc pub:annoy { nick uhost handle channel text } {
global annoyjokes
if {$text == "annoy"} {
   set respond [lindex $annoyjokes [rand [llength $annoyjokes]]]
   putserv "PRIVMSG $channel :101 Ways To Annoy People: $respond"
   }
}

set blonejokes {
"Q: How do blonde brain cells die ? A: Alone."
"Q: How do you change a blonde's mind? A: Blow in her ear."
}

proc pub:blone { nick uhost handle channel text } {
global blonejokes
if {$text == "blone"} {
   set respond [lindex $blonejokes [rand [llength $blonejokes]]]
   putserv "PRIVMSG $channel :$respond"
   }
}

set computersjokes {
"Your stationery is more cluttered than Warren Beatty's address book. The letterhead lists a fax number, e-mail addresses for two on-line services, and your Internet address, which spreads across the breadth of the letterhead and continues to the back. In essence, you have conceded that the first page of any letter you write *is*letterhead"
"You have never sat through an entire movie without having at least one device on your body beep or buzz"
}

proc pub:computers { nick uhost handle channel text } {
global computersjokes
if {$text == "computers"} {
   set respond [lindex $computersjokes [rand [llength $computersjokes]]]
   putserv "PRIVMSG $channel :You Know Your a Computer Addict When: $respond"
   }
}

set condomsjokes {
"Nike Condoms: Just do it."
"Toyota Condoms: Oh what a feeling."
}

proc pub:condoms { nick uhost handle channel text } {
global condomsjokes
if {$text == "condoms"} {
   set respond [lindex $condomsjokes [rand [llength $condomsjokes]]]
   putserv "PRIVMSG $channel : $respond"
   }
}

set elevatorjokes {
"#1: Make race car noises when anyone gets on or off."
"#2: Blow your nose and offer to show the contents of your kleenex to other passengers."
}

proc pub:elevator { nick uhost handle channel text } {
global elevatorjokes
if {$text == "elevator"} {
   set respond [lindex $elevatorjokes [rand [llength $elevatorjokes]]]
   putserv "PRIVMSG $channel :52 Fun Things To Do In An Elevator $respond"
   }
}

set miscjokes {
"How come wrong numbers are never busy?"
"Do people in Australia call the rest of the world \"up over\"?"
}

proc pub:misc { nick uhost handle channel text } {
global miscjokes
if {$text == "misc"} {
   set respond [lindex $miscjokes [rand [llength $miscjokes]]]
   putserv "PRIVMSG $channel :$respond"
   }
}

set thoughtsjokes {
"Hackers: We're explorers, not criminals"
"In the realm of the blind, the one-eyed man is king"
}

proc pub:thoughts { nick uhost handle channel text } {
global thoughtsjokes
if {$text == "thoughts"} {
   set respond [lindex $thoughtsjokes [rand [llength $thoughtsjokes]]]
   putserv "PRIVMSG $channel :$respond"
   }
}

set yomamajokes {
"Fat, That when the casier at KFC asked her what size bucket of chicken she wanted, she said the one on the roof"
"Fat, That she has more rolls than the bakery"
}

proc pub:yomama { nick uhost handle channel text } {
global yomamajokes
if {$text == "yomama"} {
   set respond [lindex $yomamajokes [rand [llength $yomamajokes]]]
   putserv "PRIVMSG $channel :\002$nick\002 Yo Mama So $respond"
   }
}


putlog "* Jokes Loaded."


Last edited by chaokusc on Tue Apr 25, 2006 10:34 am; edited 1 time in total
Back to top
View user's profile Send private message
GeeX
Voice


Joined: 19 Sep 2005
Posts: 29

PostPosted: Tue Apr 25, 2006 7:58 am    Post subject: Reply with quote

You bind !joke with 9 different procs? Shocked
Back to top
View user's profile Send private message
chaokusc
Voice


Joined: 25 Apr 2006
Posts: 18

PostPosted: Tue Apr 25, 2006 9:45 am    Post subject: Reply with quote

yes but all procs have a different name such as annoy would bring up the annoy list
Code:
if {$text == "annoy"} {


I want !joke * for all of them
such as !joke annoy would pull up the post for the annoy jokes

I have tried to do this
Code:
bind pub - "!joke annoy" pub:annoy

But this did not work

Another thing i tried was
Code:
bind pub - !jokes pub_jokes
bind pub - "!joke1" pub:redneck
bind pub - "!joke2" pub:annoy
bind pub - "!joke3" pub:blonde
bind pub - "!joke4" pub:computers
bind pub - "!joke5" pub:condoms
bind pub - "!joke6" pub:elevator
bind pub - "!joke7" pub:misc
bind pub - "!joke8" pub:thoughts
bind pub - "!joke9" pub:yomama

But that also did not work
Back to top
View user's profile Send private message
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Tue Apr 25, 2006 11:18 am    Post subject: Reply with quote

Code:

bind pub - !joke pub:jokesort

proc pub:jokesort {n u h c t} {
   switch -nocase $t {
      redneck {pub:redneck $n $u $h $c $t}
      annoy {pub:annoy $n $u $h $c $t}
      blonde {pub:blonde $n $u $h $c $t}
      computers {pub:computers $n $u $h $c $t}
      condoms {pub:condoms $n $u $h $c $t}
      elevator {pub:elevator $n $u $h $c $t}
      misc {pub:misc $n $u $h $c $t}
      thoughts {pub:thoughts $n $u $h $c $t}
      yomama {pub:yomama $n $u $h $c $t}
      default {pub_jokes $n $u $h $c $t}
   }
}


switch can very effective for things like this
Back to top
View user's profile Send private message
chaokusc
Voice


Joined: 25 Apr 2006
Posts: 18

PostPosted: Tue Apr 25, 2006 12:12 pm    Post subject: Reply with quote

DragnLord i now get this error message in party chat when i try a command in channel
Code:
[17:08] <testbot> [12:07] Tcl error [pub:jokesort]: bad option "-nocase": must be -exact, -glob, -regexp, or --
Back to top
View user's profile Send private message
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Tue Apr 25, 2006 12:21 pm    Post subject: Reply with quote

chaokusc wrote:
DragnLord i now get this error message in party chat when i try a command in channel
Code:
[17:08] <testbot> [12:07] Tcl error [pub:jokesort]: bad option "-nocase": must be -exact, -glob, -regexp, or --

Then remove the nocase switch. Common sense says to remove an option that is not supported by installed tcl. The -nocase option is not really needed, it only helps when "Yomama" is used instead of "yomama". To get the same effect you can set $t to all lowercase before the switch evaluation.
Back to top
View user's profile Send private message
chaokusc
Voice


Joined: 25 Apr 2006
Posts: 18

PostPosted: Tue Apr 25, 2006 12:43 pm    Post subject: Reply with quote

DragnLord Thank You So Much ^^ I luv u Rolling Eyes
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber