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.

Bot action response

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
g
gasak
Halfop
Posts: 45
Joined: Mon Aug 09, 2010 11:09 pm

Bot action response

Post by gasak »

Code: Select all

set crazybib {
"$nick are the real crazy"
}

bind pubm - *v1rus?crazy* pub_crazy

proc pub_crazy {nick uhost handle chan args} {
   global crazybib oldreplytime botnick
   
   set replytime [unixtime]

   if { $replytime - $oldreplytime  > 7} {
      set crazyline [lindex $crazybib [rand [llength $crazybib]]]
      puthelp "PRIVMSG $chan :$crazyline"
      set oldreplytime $replytime
   }
}

set oldreplytime 0
Can someone help me on change that script above to ACTION? means of somone on channels using action (/me) with mention the bot name with specific word the bot will answer also with the specific word to encounter the person.

Thanks a lot before for the help.
Learning Knows No Boundaries!!
User avatar
Ashoq
Voice
Posts: 11
Joined: Sat Jul 17, 2010 4:35 pm

Post by Ashoq »

im a newbie in TCL but ...

for ACTION (/me)
change this:

Code: Select all

puthelp "PRIVMSG $chan :$crazyline" 
to this:

Code: Select all

puthelp "PRIVMSG $chan :ACTION: $crazyline" 
if isnt work try this script (from fishbot.tcl):

Code: Select all

bind pubm -|- "% crazy*" crazybot_crazy
bind pubm -|- "% hello*" crazybot_hello

#crazy
proc crazybot_crazy { nick host hand chan text } {
    putmsg $chan "action: $nick are the real crazy" 
}
#hello
proc crazybot_hello{ nick host hand chan text } {
    putmsg $chan "action: says hello to $nick " 
}
L
Luminous
Op
Posts: 146
Joined: Fri Feb 12, 2010 1:00 pm

Post by Luminous »

Does that script work? It doesn't look like it would. There is no check to see if $oldreplytime exists. Also, you have a var set after the last close brace, which isn't doing anything at all.

I will answer the questions first. There are two ways to send an action to the channel. You can use

Code: Select all

putserv "PRIVMSG $chan :\001ACTION does something.\001"
or, if you have have alltools.tcl loaded:

Code: Select all

putact $chan "does a /me action"
is a shortcut for that essentially. Second, if you want this wo work on actions, you must also change the bind and procs:

Code: Select all

bind ctcp * ACTION pub_crazy
proc pub_crazy {nick host hand chan kw arg} {
  if {[string match -nocase "*v1rus?crazy*" $arg]} { ... }
So you'll need to make a few changes there in order to make that work. I would suggest fixing the proc itself first though. :)

See here as well: http://www.eggheads.org/support/egghtml ... mands.html That whole page is very useful.
Last edited by Luminous on Tue Aug 10, 2010 5:14 pm, edited 1 time in total.
g
gasak
Halfop
Posts: 45
Joined: Mon Aug 09, 2010 11:09 pm

Post by gasak »

Thanks for the response. But what i mean is not the bot that reply with action. But the bot will reply to to channel when some one on channel do an action (/me) that mention the bot name.

For example the bot name is "v1rus". Than i make an action on channel such "/me v1rus is crazy" then the bot will react for the action because the bot name mention on the action.

please advice.

many thanks
Learning Knows No Boundaries!!
L
Luminous
Op
Posts: 146
Joined: Fri Feb 12, 2010 1:00 pm

Post by Luminous »

Yes, that is what the last part is for. :) You have to use a different bind/method to capture /me action text. The first two bits of code I showed was to make the bot send a /me.
Post Reply