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 

Short Script Not sure what is wrong.

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


Joined: 01 Feb 2013
Posts: 2

PostPosted: Fri Feb 01, 2013 1:32 am    Post subject: Short Script Not sure what is wrong. Reply with quote

Is there anything blatantly wrong with this? This is the entire script. It is supposed to op me when I join my channel. I'm just getting my feet wet with bot scripting. Thanks in advance!

-Adam
Code:

putlog "Op loaded"

bind join o adamSs@hellagood.org join:me
proc join:me { chan nick } {
if { [isop $chan $botnick] == 1 } { pushmode $chan +o $nick }
}
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Fri Feb 01, 2013 2:05 am    Post subject: Reply with quote

Not sure how good an idea this script is, but...

The bind mask for join is matched against "#channel nick!user@host"
So we'll assume your username is: adamSs

The proc associated with a bind trigger, takes 4 arguments, like...
procname <nick> <user@host> <handle> <channel>

$botnick is a global variable that would require either a global tag
or using like $::botnick for it to be used in a proc.

Correct format for the isop command is: isop <nickname> [channel]
but i wouldn't use that command at all, and would use: botisop [channel]
and we won't need the global botnick line at all:)

Other than that, it's perfect.
Why not just add yourself to the bot's user file with +ao if that's all you want to do?

For security reasons, neither of these plans is really a good idea,
but this script may do what you want, if you have a global +o flag in the bot's user file.

Code:
putlog "Op loaded"

bind join o "*!adamSs@hellagood.org" join:me

proc join:me {nick uh hand chan} {
  if {[botisop $chan]} { pushmode $chan +o $nick }
}


Note: If adamSs is your nick, and not your username, change that bind mask to something more like: "* adamSs!*@hellagood.org"
_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.


Last edited by SpiKe^^ on Fri Feb 01, 2013 2:09 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Fri Feb 01, 2013 2:09 am    Post subject: Reply with quote

According to TCL manual:
Quote:

bind join <flags> <mask> <proc>
procname <nick> <user@host> <handle> <channel>

Description: triggered by someone joining the channel. The mask in
the bind is matched against "#channel nick!user@host" and can contain wildcards.
Module: irc

so..
Code:

bind join o "% *!adamSs@hellagood.org" join:me
proc join:me {nick uhost hand chan} {
   if {[botisop $chan]} {
      pushmode $chan +o $nick
   }
}

adjust the hostmask if needed.
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Fri Feb 01, 2013 9:40 am    Post subject: Re: Short Script Not sure what is wrong. Reply with quote

adamSs wrote:

...
I'm just getting my feet wet with bot scripting.
...



Some very useful and helpful reference material for you to read and bookmark:

A nice place for beginners to start.
"Guide to TCL scripting for Eggdrop"
http://suninet.the-demon.de/


Link to the doc that caesar mentioned:
(Eggdrop related TCL commands)
http://www.eggheads.org/support/egghtml/1.6.21/tcl-commands.html

The rest of TCL commands:
http://www.tcl.tk/man/tcl8.5/TclCmd/contents.htm

I hope this helps.
Back to top
View user's profile Send private message
adamSs
Voice


Joined: 01 Feb 2013
Posts: 2

PostPosted: Fri Feb 01, 2013 2:44 pm    Post subject: Reply with quote

Thanks a lot for all of the replies! Also, Thanks for the documentation links! I appreciate it folks.

-Adam
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