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.

long text help

Help for those learning Tcl or writing their own scripts.
Post Reply
t
tdmondo
Voice
Posts: 5
Joined: Wed Feb 26, 2014 12:04 pm

long text help

Post by tdmondo »

hello guys anyone can give me advise about scripting??

look i`ll explain

i want my eggdrop bot answer someone which will say hello on main channel

Code: Select all

bind pub - hello pub:hello
proc pub:hello {nick host handle chan text} {
  putserv "PRIVMSG $chan :hello $nick"
}
thats working super but..... i want something like this

i want my eggdrop bot answer someone which will say hello guys on main channel

for this what script i must to do?? i want my bot response only on hello guys and not only on hello

i made something this

Code: Select all

bind pub - hello_guys pub:hello_guys
proc pub:hello_guys {nick host handle chan text} {
  putserv "PRIVMSG $chan :hello $nick"
}
i type hello baby on main channel but my eggdrop still answering.... now u understood what i mean? i wanna only response on hello guys and not only on word hello

thanks before
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

See pubm bind in tcl-commands.doc file.

Edit: I talked with tdmondo via PM's and helped him out with a piece of code. I'll post it here maybe someone else will find it useful.

Code: Select all

dict set responses "hello" "heya %nick, welcome to %chan channel!"
dict set responses "beer?" "yeah %nick, hand me a cold one please!"

bind pubm * * fetch:response

proc fetch:response {nick uhost hand chan text} {
   global responses
   set text [split $text]
   if {[lsearch -nocase [dict keys $responses] $text] != -1} {
      set message [string map [list %chan $chan %nick $nick] [dict get $responses $text]]
      puthelp "PRIVMSG $chan :$message"
   }
}
In the first line the "hello" is the word it will trigger and the "heya %nick, welcome to %chan channel!" is the answer it will give to that.

Notice the presence of %nick and %chan that will be replaced with actual nick of the user that triggered the response and the %chan will be replaced with the actual name of the channel.

Haven't tested anything but he said it's working. ;)
Once the game is over, the king and the pawn go back in the same box.
Post Reply