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 

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

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


Joined: 08 Apr 2007
Posts: 10

PostPosted: Mon Apr 09, 2007 1:01 pm    Post subject: [solved] catch a word in a sentance and /me command Reply with quote

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:
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
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Mon Apr 09, 2007 5:43 pm    Post subject: Reply with quote

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:
bind ctcp - ACTION yourporc

Read about the ctcp bind in Tcl-commands.doc.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
prassel
Voice


Joined: 08 Apr 2007
Posts: 10

PostPosted: Mon Apr 09, 2007 6:43 pm    Post subject: Reply with quote

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 Embarassed


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

Code:
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?
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Mon Apr 09, 2007 7:42 pm    Post subject: Reply with quote

Quote:
Code:
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:
if {[string match -nocase "*dogs*" $text]} {
 # dogs is in $text
}

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
prassel
Voice


Joined: 08 Apr 2007
Posts: 10

PostPosted: Mon Apr 09, 2007 7:54 pm    Post subject: Reply with quote

sry but i dont understand at all Embarassed

i've figured it out now, thx

Code:
bind pubm - "*<word>*" <procname>
proc <procname> {nick host hand chan text} {
 putserv "privmsg $chan :\001ACTION slaps $nick \001"
}
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