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.

Help me With editing this script !!

Old posts that have not been replied to for several years.
I
Insectora
Voice
Posts: 16
Joined: Thu Feb 20, 2003 2:51 am
Location: Germany

Help me With editing this script !!

Post by Insectora »

With this script i kick chaters with public comand in the channel. When i add in the bot an user, and when he wants to kick me with the command
!kick Insectora ,the bot doesnt do this.Good. But the problem is when he wants to kick the bot with the command !kick Vees . And the bot kicks its self:((( And i don't want this off course ! Help me! What i should to edit to the script so the bot dont kick itself with the command !kick Vees ??


proc pub:kick {nick host hand chan text} {
set whom [lindex $text 0]
set reason [lrange $text 1 end]
if {[matchattr $whom f|f]} {return 0}
putserv "KICK $chan $whom :$reason"
putlog "#$hand# has kicked $whom from $chan"
}
Stealth
m
mortician
Voice
Posts: 37
Joined: Sun Sep 22, 2002 6:35 pm
Location: Tsjakamaka
Contact:

Post by mortician »

well check if whom == botnick ...

Code: Select all

proc pub:kick {nick host hand chan text} {
global botnick
set whom [lindex $text 0] 
set reason [lrange $text 1 end] 
if {[matchattr $whom f|f] || $whom == $botnick} {return 0} 
putserv "KICK $chan $whom :$reason" 
putlog "#$hand# has kicked $whom from $chan" 
}
It is a mistake to think you can solve any major problems just with potatoes.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

replace

Code: Select all

if {[matchattr $whom f|f]} {return 0}
with

Code: Select all

if {[matchattr $whom f|f] || $whom == $botnick} {return 0}
Also, you may want to do a chk if he is op first then continue with the kick and also a chk if is on channel. Replace:

Code: Select all

set whom [lindex $text 0]
with this:

Code: Select all

set whom [lindex $text 0]
if {![botisop $channel] || ![onchan $whom $chan]} { return }
Once the game is over, the king and the pawn go back in the same box.
I
Insectora
Voice
Posts: 16
Joined: Thu Feb 20, 2003 2:51 am
Location: Germany

Sorry boys

Post by Insectora »

Sorry boys but doesn't work the edition you gave me:( The bot is still kicking itself with the command:(( !kick Vees .But why the script is not working well?
Any other commens??? pls help
Stealth
d
dvV
Voice
Posts: 30
Joined: Wed Jan 29, 2003 4:08 pm

Post by dvV »

do make sure it looks exactly like this to ensure you havent c/p something wrong...

Code: Select all

proc pub:kick {nick host hand chan text} { 
    global botnick 
    set whom [lindex $text 0] 
    if {![botisop $channel] || ![onchan $whom $chan]} { return } 
    set reason [lrange $text 1 end] 
    if {[matchattr $whom f|f] || $whom == $botnick} {return 0} 
    putserv "KICK $chan $whom :$reason" 
    putlog "#$hand# has kicked $whom from $chan" 
}
dvV
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Well, is almost exactly I've sugested. Why don't you pay attention to the things I say?
Once the game is over, the king and the pawn go back in the same box.
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

try

Post by De Kus »

perhaps you need to check [string tolower $whom] == [string tolower $botnick]
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Also a "[string tolower $chan]" will be nice..
Once the game is over, the king and the pawn go back in the same box.
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

i dont think its necessary, cause the bot usally always has the chans in the same capitalation on it :).
you only need the tolower check in nick this time, because if the bot sends KICK #chan VeEs, server kicks vees or Vees or any else, but if the bots nick is Vees VeEs == Vees will be untrue :).
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

Additionally, about the script posted by dvV,

1. it uses a variable $channel without it being defined,
2. the [matchattr] lacks the $chan,
3. it uses [lindex] and [lrange] on a string (see Tcl FAQ 1).
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Well, not exactly. Is the same thing as the nick. #cHaNnEl is not the same as #channel or #Channel or even #ChanneL. Do some tests and you will see what I'm talking about.
Once the game is over, the king and the pawn go back in the same box.
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

caesar wrote:Well, not exactly. Is the same thing as the nick. #cHaNnEl is not the same as #channel or #Channel or even #ChanneL. Do some tests and you will see what I'm talking about.
What tests should be done to see what you are talking about?
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

hehe

Post by De Kus »

yeah, but this will probably NEVER become a problem, because the msg was send on exact that channel the bot should kick. so if the bot is on #Channel, $chan will never be #channel for the bot. it would be a diffrent if it is a bind on msg and not on pub :).
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

So, finaly it should look like:

Code: Select all

proc pub:kick {nick host hand chan text} { 
  global botnick
  if {![llength $text] > 0 || ![botisop $chan]} { return }
  set whom [string tolower [lindex $text 0]]
  set chan [string tolower $chan]
  if {$whom == $botnick || [matchattr $whom f|f] || ![onchan $whom $chan]} { return }
  set reason [lrange $text 1 end] 
  putserv "KICK $chan $whom :$reason" 
  putlog "#$hand# has kicked $whom from $chan" 
}
Once the game is over, the king and the pawn go back in the same box.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

A lil compare betwen #cHaNnEl and #channel even #Channel or #ChanneL. Or nevermind.. Some moron pissed me off a bit earlier and.. yah.. nevermind.
Once the game is over, the king and the pawn go back in the same box.
Locked