This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

help with my custom 8ball

Help for those learning Tcl or writing their own scripts.
Post Reply
m
monie089
Halfop
Posts: 76
Joined: Sat Jul 29, 2006 11:13 pm

help with my custom 8ball

Post by monie089 »

Code: Select all

######################################################
#coded by monie @ moniestcl.awardspace.com           #
#server :Friendcodes irc.friendcodes.info            #
#Channels #NintendoXG,#Ircsupport,#eggdrop|windrop   #
#simple 8ball script 1.0                             #
#for more of my scripts check out my site            #
######################################################
bind pub -|- !8ball pub:8ball
proc pub:8ball {nick hand channel args } {
global reply
putquick "PRIVMSG $channel :[lindex $reply [rand [llength $reply]]]"
}
#sets the response for the 8ball answer
set reply {
  "\"Try asking when you get smater.\""
  "\"Absolutely yes!\""
  "\"Answer hazy."
  "\"Prospect looks bleak.\""
  "\"No."
  "\"That's a question you should ask yourself.\""
  "\"Prospect looks hopeful.\""
  "\"I like to think so.\""
  "\"Not even on a GOOD day.\""
  "\"It would take a disturbed person to even ask.\""
  "\"Maybe -- give me more money and ask again.\""
  "\"Yes, yes, yes, and yes again.\""
  "\"You wish.\""
  "\"Not bloody likely.\""
  "\"I'm busy.\""
  "\"Concentrate and ask again.\""
  "\"Most likely.\""
  "\"I wouldn't know anything about that.\""
  "\"No way.\""
  "\"All signs point to yes.\""
  "\"Never.\""
  "\":\""
}
putlog "simple 8ball script 1.0 by monie loaded..."
it doesnt respond to the channel
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

First off, I'd suggest you build your list using the "list" command
ie:

Code: Select all

set reply [list "line 1" "line 2" ...]
Secondly, the proc head is incorrect...
Public bind calls the proc with the following arguments: nick host handle channel text. In your case you've forgotten host. However, you do use the special variable "args", which can hold 1 more more arguments, so you won't get a tcl-error.. instead, you send the reply to the hostmask of the caller, which in most cases, is'nt a valid nick or channel...

simple fix:

Code: Select all

proc pub:8ball {nick host hand chan text} {
...
Also, avoid using "args" whenever possible, as it requires some special attention...
NML_375
m
monie089
Halfop
Posts: 76
Joined: Sat Jul 29, 2006 11:13 pm

Post by monie089 »

thanks it worked i just wanted to make a simpler 8ball script
Post Reply