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.

PM?

Help for those learning Tcl or writing their own scripts.
Post Reply
d
dq
Voice
Posts: 32
Joined: Mon Apr 03, 2006 12:28 am

PM?

Post by dq »

Code: Select all

bind PUB n|-  ${trigger}join  pub:join

proc pub:join {nickname hostname handle channel arguments} {
  if {![llength [split $arguments]] || [validchan [set channel [lindex [split $arguments] 0]]]} {
    putserv "NOTICE $nickname :Please use $::lastbind #channel"
  } else {
    channel add $channel
  }
}
@Join #Channel, if the owner displays that command in a public channel the bot will obey, however is it possible to pm the bot with the @join command and it will obey?
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Change PUB to MSG.
d
dq
Voice
Posts: 32
Joined: Mon Apr 03, 2006 12:28 am

Post by dq »

lol.. thanks

gotta learn somewhere ;p

EDIT: Can it work for both pub and msg?
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

The way your proc is written, yes it can work. And if you want to learn about Eggdrop binds, read Tcl-commands.doc.
d
dq
Voice
Posts: 32
Joined: Mon Apr 03, 2006 12:28 am

Post by dq »

Sorry for such a late reply, hadn't had time to check it out.. it still doesn't work it wont respond via PM
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

dq wrote:Sorry for such a late reply, hadn't had time to check it out.. it still doesn't work it wont respond via PM
Do you expect

Code: Select all

putserv "NOTICE $nickname :Please use $::lastbind #channel"
to result in a PRIVMSG? :P
Have you ever read "The Manual"?
User avatar
BarkerJr
Op
Posts: 104
Joined: Sun Mar 30, 2003 1:25 am
Contact:

Post by BarkerJr »

Here ya go...

Code: Select all

bind PUB n|-  ${trigger}join {dojoin $_pub1 $_pub5; #}
bind MSG n|-  ${trigger}join {dojoin $_msg1 $_msg4; #}

proc dojoin {nickname channel} {
  if {![llength [split $channel]] || [validchan [set channel [lindex [split $channel] 0]]]} {
    putserv "NOTICE $nickname :Please use $::lastbind #channel"
  } else {
    channel add $channel
  }
}
What you see as the last argument of the bind is like an anonymous function.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

a wonderful example of using eggdrop's hardcoded argument names
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
User avatar
BarkerJr
Op
Posts: 104
Joined: Sun Mar 30, 2003 1:25 am
Contact:

Post by BarkerJr »

Thanks. I wrote a document about it tonight... http://barkerjr.net/irc/eggdrop/Scripting/Binds
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Excellent documentation, I didn't know you can do that :!: :)
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

I don't want to destroy this great idea... I haven't thought on using the vars directly till now and I am sure you can make very simple scripts with it, but wouldn't a:

Code: Select all

bind PUB n|-  ${trigger}join dojoin
bind MSG n  ${trigger}join dojoin

proc dojoin {nickname uhost hand args} {
   if {[validchan [set channel [lindex $args end]]] || $channel == ""} {
...
be also very simple and short in that particular case? :)
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Post Reply