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 

PM?

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


Joined: 03 Apr 2006
Posts: 32

PostPosted: Fri May 05, 2006 11:37 am    Post subject: PM? Reply with quote

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


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri May 05, 2006 11:56 am    Post subject: Reply with quote

Change PUB to MSG.
_________________
Follow me on GitHub

- Opposing

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


Joined: 03 Apr 2006
Posts: 32

PostPosted: Fri May 05, 2006 12:09 pm    Post subject: Reply with quote

lol.. thanks

gotta learn somewhere ;p

EDIT: Can it work for both pub and msg?
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri May 05, 2006 7:15 pm    Post subject: Reply with quote

The way your proc is written, yes it can work. And if you want to learn about Eggdrop binds, read 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
dq
Voice


Joined: 03 Apr 2006
Posts: 32

PostPosted: Fri May 26, 2006 9:23 am    Post subject: Reply with quote

Sorry for such a late reply, hadn't had time to check it out.. it still doesn't work it wont respond via PM
Back to top
View user's profile Send private message
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Fri May 26, 2006 9:52 am    Post subject: Reply with quote

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:
putserv "NOTICE $nickname :Please use $::lastbind #channel"
to result in a PRIVMSG? Razz
_________________
Have you ever read "The Manual"?
Back to top
View user's profile Send private message
BarkerJr
Op


Joined: 30 Mar 2003
Posts: 104

PostPosted: Sun Jun 11, 2006 5:49 pm    Post subject: Reply with quote

Here ya go...

Code:

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.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sun Jun 11, 2006 10:24 pm    Post subject: Reply with quote

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] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
BarkerJr
Op


Joined: 30 Mar 2003
Posts: 104

PostPosted: Sun Jun 11, 2006 10:52 pm    Post subject: Reply with quote

Thanks. I wrote a document about it tonight... http://barkerjr.net/irc/eggdrop/Scripting/Binds
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Mon Jun 12, 2006 8:50 am    Post subject: Reply with quote

Excellent documentation, I didn't know you can do that Exclamation Smile
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Tue Jun 13, 2006 6:37 am    Post subject: Reply with quote

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:
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? Smile
_________________
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...
Back to top
View user's profile Send private message MSN Messenger
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