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.

Short Script Not sure what is wrong.

Help for those learning Tcl or writing their own scripts.
Post Reply
a
adamSs
Voice
Posts: 2
Joined: Fri Feb 01, 2013 1:29 am

Short Script Not sure what is wrong.

Post by adamSs »

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: Select all

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 } 
}
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

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: Select all

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"
Last edited by SpiKe^^ on Fri Feb 01, 2013 2:09 am, edited 1 time in total.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

According to TCL manual:
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: Select all

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.
w
willyw
Revered One
Posts: 1209
Joined: Thu Jan 15, 2009 12:55 am

Re: Short Script Not sure what is wrong.

Post by willyw »

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 ... mands.html

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

I hope this helps.
a
adamSs
Voice
Posts: 2
Joined: Fri Feb 01, 2013 1:29 am

Post by adamSs »

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

-Adam
Post Reply