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.

[solved] catch a word in a sentance and /me command

Help for those learning Tcl or writing their own scripts.
Post Reply
p
prassel
Voice
Posts: 10
Joined: Sun Apr 08, 2007 6:52 pm

[solved] catch a word in a sentance and /me command

Post by prassel »

i cant get the bot to catch a word with my script. someone know what im doing wrong?

function: catch the word 'dogs' and send "dogs?! WHERE?!" to the channel that 'fubu' was written in.

Code: Select all

bind pub - "% *dogs*" askDogs
proc askDogs {nick host hand chan text} {
 putserv "privmsg $chan :dogs?! WHERE?!"
}  
also could someone tell me what the /me command is in tcl?
cant find it anywhere, or im searching on the wrong words :/

thx
Last edited by prassel on Tue Apr 10, 2007 12:29 pm, edited 1 time in total.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

You need yo use the pubm bind and not pub bind. Read Tcl-commands.doc about both binds (pub does not accept wildcards in its mask).

As for actions, actions are CTCPs so you should use a bind like

Code: Select all

bind ctcp - ACTION yourporc
Read about the ctcp bind in Tcl-commands.doc.
p
prassel
Voice
Posts: 10
Joined: Sun Apr 08, 2007 6:52 pm

Post by prassel »

i didnt get any wiser by reading tcl-commands.doc about ctcp :/
but i did get the other thing to find the words and reply, thx.

but what should the ACTION be? the text i write in the channel or something else? im lost :oops:


hmm i think im getting close now, found this after googling
http://www.baschny.de/eggdrop/faq/faq-f.html

Code: Select all

bind ctcp - "ACTION" action_proc
proc action_bind { nick uhost hand dest keyword text } {  
     if {[string index $dest 0] != "#"} { return 0 }
  }
$dest should be $chan, that i know.

what is the reply text and what is the trigger text?
and what is the "#" for?
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

bind ctcp - "ACTION" action_proc
proc action_bind { nick uhost hand dest keyword text } { 
     if {[string index $dest 0] != "#"} { return 0 }
  }
The condition checks if the first character of $dest is '#' (meaning if it is a channel name). $text is the text you want to match from, so you can use something like

Code: Select all

if {[string match -nocase "*dogs*" $text]} {
 # dogs is in $text
}
p
prassel
Voice
Posts: 10
Joined: Sun Apr 08, 2007 6:52 pm

Post by prassel »

sry but i dont understand at all :oops:

i've figured it out now, thx

Code: Select all

bind pubm - "*<word>*" <procname>
proc <procname> {nick host hand chan text} {
 putserv "privmsg $chan :\001ACTION slaps $nick \001"
}
Post Reply