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.

Cant find the bug...

Old posts that have not been replied to for several years.
Locked
P
ProXy
Op
Posts: 126
Joined: Sun Aug 11, 2002 3:09 pm

Cant find the bug...

Post by ProXy »

Hi there, I wrote a script to kick a user via public command!
Now i changed something and the error is already: USER not in the channel!

Can anyone find an error?

Code: Select all

set lamerusage "Usage: $lamercommand <nick> \[time\]"
bind pub $lamerglobalflag|$lamerlocalflag $lamercommand pub:lamer
proc pub:lamer { nick uhost handle channel arg } {
	global botnick lamerdefaulttime lamerusage
	if {([llength $arg]==0) || (![string is digit [lindex [split $arg] 1]]) || ([llength [lindex [split $arg] 2]])} {
		putserv "PRIVMSG $channel :$lamerusage"
	} elseif {[lsearch -exact [string tolower [chanlist $channel]] [string tolower [lindex [split $arg] 0]]]==-1} {
		putserv "PRIVMSG $channel :Error: \"[lindex [split $arg] 0]\" ist nicht in diesem Channel! $lamerusage"
	} elseif {![botisop $channel]} {
		putserv "PRIVMSG $channel :$nick: Ja, du Scherzkeks, dann gib mir OP!"
	} elseif {[string tolower [lindex [split $arg] 0]]==[string tolower $botnick]} {
		putserv "PRIVMSG $channel :$nick: So blöd bin ich nun wirklich nicht..."
	} else {
		if {[llength [lindex [split $arg] 1]]!=0} {
			set lamerbantime [lindex [split $arg] 1]
		} else {
			set lamerbantime $lamerdefaulttime
		}
		set lamerhost [getchanhost [lindex [split $arg] 0] $channel]
		putserv "MODE $channel +b [lindex [split $arg] 0]!$lamerhost"
		if {$bantime==1} {
			set lamermins "minute"
		} else {
			set lamermins "minutes"
		}
		utimer 2 [list putkick $channel [lindex [split $arg] 0] "banned for $lamerbantime $lamermins"] 
		timer $lamerbantime [list putserv "MODE $channel -b [lindex [split $arg] 0]!$lamerhost"]
	}
}
P
ProXy
Op
Posts: 126
Joined: Sun Aug 11, 2002 3:09 pm

Re: Cant find the bug...

Post by ProXy »

ProXy wrote:Hi there, I wrote a script to kick a user via public command!
Th script works fine with most nicks, but with some it says that the user is not in the channel! Does anyone know how to write it to catch all possible nicks?

Code: Select all

set lamerusage "Usage: $lamercommand <nick> \[time\]"
bind pub $lamerglobalflag|$lamerlocalflag $lamercommand pub:lamer
proc pub:lamer { nick uhost handle channel arg } {
	global botnick lamerdefaulttime lamerusage
	if {([llength $arg]==0) || (![string is digit [lindex [split $arg] 1]]) || ([llength [lindex [split $arg] 2]])} {
		putserv "PRIVMSG $channel :$lamerusage"
	} elseif {[lsearch -exact [string tolower [chanlist $channel]] [string tolower [lindex [split $arg] 0]]]==-1} {
		putserv "PRIVMSG $channel :Error: "[lindex [split $arg] 0]" ist nicht in diesem Channel! $lamerusage"
	} elseif {![botisop $channel]} {
		putserv "PRIVMSG $channel :$nick: Ja, du Scherzkeks, dann gib mir OP!"
	} elseif {[string tolower [lindex [split $arg] 0]]==[string tolower $botnick]} {
		putserv "PRIVMSG $channel :$nick: So blöd bin ich nun wirklich nicht..."
	} else {
		if {[llength [lindex [split $arg] 1]]!=0} {
			set lamerbantime [lindex [split $arg] 1]
		} else {
			set lamerbantime $lamerdefaulttime
		}
		set lamerhost [getchanhost [lindex [split $arg] 0] $channel]
		putserv "MODE $channel +b [lindex [split $arg] 0]!$lamerhost"
		if {$bantime==1} {
			set lamermins "minute"
		} else {
			set lamermins "minutes"
		}
		utimer 2 [list putkick $channel [lindex [split $arg] 0] "banned for $lamerbantime $lamermins"] 
		timer $lamerbantime [list putserv "MODE $channel -b [lindex [split $arg] 0]!$lamerhost"]
	}
}
d
darko``
Op
Posts: 121
Joined: Sun Sep 08, 2002 5:33 pm
Location: Malta

Post by darko`` »

Who says that user is not on channel: eggdrop itself or your script? What nicks seem to be breaking your bot?

Also, there is a neat 'onchan' command - read doc/tcl-commands.doc
Ignorant and lazy people will save 30 minutes by chosing simple config file. Smart ones will save 3000 minutes of *everyone's* time by opting for complete config file.
P
ProXy
Op
Posts: 126
Joined: Sun Aug 11, 2002 3:09 pm

Post by ProXy »

The Script answer when a user is not on the chan. Some nicks only use a pipe and the script stops working. Other nicks use pipes too and the script works fine...
P
ProXy
Op
Posts: 126
Joined: Sun Aug 11, 2002 3:09 pm

Post by ProXy »

And please look there again. THX

http://forum.egghelp.org/viewtopic.php?t=2592
Locked