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.

kickban script problem

Old posts that have not been replied to for several years.
Locked
p
pag

kickban script problem

Post by pag »

i have a little script problem

putquick "mode $chan +b $nick!$host"
putquick "kick $chan $nick $ec_lan_kicktext"

but he can´t kick the user. error msg:
[02:55] Tcl error in script for 'timer1':
[02:55] invalid command name "xxxxx"

his name would be [xxxxx] then
if hes called xxxxx then he gets kicked. but the eggdrop doesnt kick user with [
whats the problem ?

thats the part:
proc ec.lan:check {nick host chan} {
global ec_lan_chans ec_lan_kicktext
set chancount "0"
foreach channel $ec_lan_chans {
if {([isop $nick $channel]) || ([isvoice $nick $channel])} {return 0}
if {[onchan $nick $channel]} {set chancount [expr $chancount +1]}
}
if {$chancount > 1} {
putquick "mode $chan +b $nick"
putquick "kick $chan $nick $ec_lan_kicktext"
}
}
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

would help if you added some more info, like what kind of bind you are using?

also I can't see any timers in your script.. so that errormsg makes no sence to me... maybe ppslim (local god ;)) knows why it's appearing.. but my guess it's some other part of your script or you have a trigger that is beeing used by another script aswell...

as for your script there is some errors in it..

1. I dunno but I would guess your input should be {nick host hand chan} , won't know for sure until you have told us what bind you are using. You have to include all inputs, even if you don't use them.

2.set chancount [expr $chancount +1] <-- nothing wrong with it but I like avoiding using "expr" if I can :), replace it with " incr chancount "

3.Why are you using putquick? again nothing wrong but I would suggest you use the putkick and and/or pushmode.
Elen sila lúmenn' omentielvo
m
mortician
Voice
Posts: 37
Joined: Sun Sep 22, 2002 6:35 pm
Location: Tsjakamaka
Contact:

Post by mortician »

perhaps you can take a look at this site: http://www.peterre.com/characters.html

It tells you how to write scripts that won't choke on brackets and other special characters.

greetings
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

My guess is tha the proc "ec.lan:check" is called by a timer.

The code that sets up this timer is missing, and is what is causing the problems.

It's the fault of some1 creating a script, and using the wrong commands, at the wrong time. In this case, using a list command, but using a string, or using a string command, with a list.

Note, I recomend fixing this ASAP. Just to make you aware, this bot will die, if you tried to kick the nickname "[die]2day".

This means this scripts leaves a exploit open.

It may be the case, that a single command needs changing, but never the less, there is a hole.
p
pag

Post by pag »

no the bot doesnt die if he wants to kick someone.

Code: Select all

# channels 
set ec_lan_chans { 
"#chan1" 
"#chan2" 
} 
# kick text if check successful 
set ec_lan_kicktext "2channels go away" 
# timer in seconds till the bot checks the user after join 
set ec_lan_checktimer "10" 

bind msg - start ec.lan:start 
bind join - * ec.lan:joincheck 


proc ec.lan:start {nick host hand chan} { 
global ec_lan_chans 
if {![regexp -nocase $chan $ec_lan_chans match]} {return 0} 
if {(![isop $nick $chan]) || (![isvoice $nick $chan])} {return 0} 
putserv "mode $chan +D-c" 
putserv "privmsg $nick :\0034 live mode in $chan started" 
} 

proc ec.lan:joincheck {nick host hand chan args} { 
global ec_lan_checktimer 
utimer $ec_lan_checktimer "ec.lan:check $nick $host $chan" 
} 

proc ec.lan:check {nick host chan} { 
global ec_lan_chans ec_lan_kicktext 
set chancount "0" 
foreach channel $ec_lan_chans { 
  if {([isop $nick $channel]) || ([isvoice $nick $channel])} {return 0} 
  if {[onchan $nick $channel]} {set chancount [expr $chancount +1]} 
} 
if {$chancount > 1} { 
  putquick "mode $chan +b $nick!$host" 
  putquick "kick $chan $nick $ec_lan_kicktext" 
} 
} 
thats the full code. can anybody correct it plz for me ? [/quote]
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

Code: Select all

utimer $ec_lan_checktimer [ec.lan:check $nick $host $chan]
Elen sila lúmenn' omentielvo
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Papillon wrote:

Code: Select all

utimer $ec_lan_checktimer [ec.lan:check $nick $host $chan]
This is errornous, and causes more issues than it fixes.

The [] in Tcl, cause a command to be avaluated, and it's return string, number or condition to be used in it's place.

As such, the above code will make the "ec.lan:check" be avuated right away, and the return string from this command, used in it's place. THis causes another timer issue.

Using this should work however

Code: Select all

utimer $ec_lan_checktimer [list ec.lan:check $nick $host $chan]
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

that's how it goes when giving tips early in the morning :oops:

/me bows in recognition of ppslim's supreme knowledge
Elen sila lúmenn' omentielvo
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

My knowledge isn't supreme.

A good portion of my knowledge, comes from readin the manual, practice and seeing other poeple come up with fixes, or ideas.

I simply adopt these for use in the current topic.

90% of the problm is spotting a mistake. Even I make mistakes, and proof-reading script, isn't exactly the same as proof-reading a letter. When creating somthing, you will usualy be thinking exactly along the right lines of what it is supposed to do, and how it is gonna do it. It the phase of moving you hands accross the keyboard that makes the mistakes.
p
pollar
Voice
Posts: 18
Joined: Thu Jan 09, 2003 12:20 pm
Location: Lithuania

It's simple...

Post by pollar »

Add this proc to your script...:

Code: Select all

proc filt {data} {
    regsub -all -- \\\\ $data \\\\\\\\ data
    regsub -all -- \\\[ $data \\\\\[ data
    regsub -all -- \\\] $data \\\\\] data
    regsub -all -- \\\} $data \\\\\} data
    regsub -all -- \\\{ $data \\\\\{ data
    regsub -all -- \\\" $data \\\\\" data
    return $data
}

... and perform filtering $nick before kicking or baning (write it the begin of your binded proc):

Code: Select all

set nick [filt $nick]
This should work :)

(sorry my english isn't good :))
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Re: It's simple...

Post by strikelight »

pollar wrote:Add this proc to your script...:

Code: Select all

proc filt {data} {
    regsub -all -- \\\\ $data \\\\\\\\ data
    regsub -all -- \\\[ $data \\\\\[ data
    regsub -all -- \\\] $data \\\\\] data
    regsub -all -- \\\} $data \\\\\} data
    regsub -all -- \\\{ $data \\\\\{ data
    regsub -all -- \\" $data \\\\" data
    return $data
}

... and perform filtering $nick before kicking or baning (write it the begin of your binded proc):

Code: Select all

set nick [filt $nick]
This should work :)

(sorry my english isn't good :))
This is NOT a good solution, as detailed by http://www.peterre.com/characters.html
p
pollar
Voice
Posts: 18
Joined: Thu Jan 09, 2003 12:20 pm
Location: Lithuania

well..

Post by pollar »

Maybe, but this method works. I use it sometimes and it ALWAYS helps to deal with a problem.
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Re: well..

Post by strikelight »

pollar wrote:Maybe, but this method works. I use it sometimes and it ALWAYS helps to deal with a problem.
It won't ALWAYS fix the problem. There will be times when you will have
extra \'s when you actually want the proper data. You have been lucky if you haven't come across such problems yet, but I suggest you take a look at the mentioned URL so you never do come across such problems.
p
pollar
Voice
Posts: 18
Joined: Thu Jan 09, 2003 12:20 pm
Location: Lithuania

hm..

Post by pollar »

You are right, there will be extra \'s, but these simbols is not important in nicks or channel names also they are not printed in messages, when they r sent to an IRC server.

I think the author of this topic should try my suggested method and then say to us who was right. Do you agree with this strikelight?

Also I want to know about other methods to fix this problem. SO, strikelight, if you have any ideas write them, please. I'm realy interested in this :wink: .
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Re: hm..

Post by strikelight »

pollar wrote:You are right, there will be extra \'s, but these simbols is not important in nicks or channel names also they are not printed in messages, when they r sent to an IRC server.
Simply, you are wrong in assuming this.
pollar wrote: I think the author of this topic should try my suggested method and then say to us who was right. Do you agree with this strikelight?
No, I hole-heartedly do not agree.
pollar wrote: Also I want to know about other methods to fix this problem. SO, strikelight, if you have any ideas write them, please. I'm realy interested in this :wink: .
Papillion and ppslim have already answered his question with PROPER solutions. Your "solution" just adds confusion to the issue for the poor chap.
Locked