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 with this script

Old posts that have not been replied to for several years.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Help with this script

Post by Sir_Fz »

Code: Select all

bind kick - * channel:kick

proc channel:kick {nick uhost hand chan targ rsn} {
  if {[string match -nocase "$targ" $::botnick]} {
  putquick "PRIVMSG chanserv@services.dal.net :deop $chan $nick" -next
  putquick "PRIVMSG chanserv@services.dal.net :unban $chan"
  utimer 3 "lamer:remove $chan $nick $banlmr"
  set banlmr "*!*@[lindex [split $uhost @] 1]"
 }
}

proc lamer:remove {chan nick banlmr} {
 if {[botisop $chan]} {
  putkick $chan $nick "Lamer Removed."
  putquick "MODE $chan +b $banlmr"
 }
}
the reeason I called the lamer:remove proc in the channel:kick proc, is for it to function when the bot rejoins the channel after he gets kicked. (i made a utimer to make it wait 3 secs before calling the other proc, which is enough time for the bot to rejoin and gain ops)
but I guess there's another much easier way to do it.
so does anybody know a way to let the bot kickban the lamer when it rejoins the channel and regains its op ?
User avatar
Dedan
Master
Posts: 260
Joined: Wed Jul 09, 2003 10:50 pm
Location: Memphis

Post by Dedan »

this is from eggdrop 1.6.13 conf

# revenge
# Remember people who deop/kick/ban the bot, valid ops, or friends
# and punish them? Users with the +f flag are exempt from revenge.
#
# revengebot
# This is similar to to the 'revenge' option, but it only triggers
# if a bot gets deopped, kicked or banned.


# revenge-mode 1
# This settings defines how the bot should punish bad users when
# revenging. There are four possible settings:
# 0 Deop the user.
# 1 Deop the user and give them the +d flag for the channel.
# 2 Deop the user, give them the +d flag for the channel, and kick them.
# 3 Deop the user, give them the +d flag for the channel, kick, and ban them.
#

# Here is a example:

Code: Select all

channel add #botcentral {
  chanmode "+nt"
  flood-join 5:60
  flood-ctcp 3:60
  revenge-mode 3
}
channel set #botcentral +revengebot

I once was an intelligent young man, now i am old and i can not remember who i was.
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Re: Help with this script

Post by strikelight »

Sir_Fz wrote:

Code: Select all

proc channel:kick {nick uhost hand chan targ rsn} {
  if {[string match -nocase "$targ" $::botnick]} {
  putquick "PRIVMSG chanserv@services.dal.net :deop $chan $nick" -next
  putquick "PRIVMSG chanserv@services.dal.net :unban $chan"
  utimer 3 "lamer:remove $chan $nick $banlmr"
  set banlmr "*!*@[lindex [split $uhost @] 1]"
 }
}
For starters, your utimer statement should be:

Code: Select all

  utimer 3 [list lamer:remove $chan $nick $banlmr]
To avoid exploitation of your script.

Secondly, you would need to set banlmr before the utimer call.
Sir_Fz wrote: so does anybody know a way to let the bot kickban the lamer when it rejoins the channel and regains its op ?
'addchanban' should do the trick.. I believe when the bot gets opped it places the matching bans in its banlist. Correct me if I'm wrong.

EDIT: I meant 'newchanban'
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

strikelight, ur completely right, but I don't want the bot to store the ban in its internal ban list, I just want it to set a channel ban which can be removed by anybody without the bot remembering it...

so do u know any other way to catch the bot's join and gaining ops ?
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

Sir_Fz wrote:strikelight, ur completely right, but I don't want the bot to store the ban in its internal ban list, I just want it to set a channel ban which can be removed by anybody without the bot remembering it...

so do u know any other way to catch the bot's join and gaining ops ?
Then I'd recommend:
1) adding the host/chan to a global variable (preferably a listed array,
ie. lamerstoban(#chan) {host1 host2})
2) using a mode bind to check for the bot getting opped, and then
applying the bans in the listed array.
3) unsetting the global listed array variable

Hope this helps.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

that would be kind of hard..

isn't there a way to add this user, then add a channel record to him.
then create a join bind, if the nick has a channel record then the bot will ban him, then remove the channel record and the user.
User avatar
Dedan
Master
Posts: 260
Joined: Wed Jul 09, 2003 10:50 pm
Location: Memphis

Post by Dedan »

Code: Select all


set revenge "0"
set revenge_nick "none"
set revenge_ban_mask "none"


bind kick -|- revenge:bot

proc revenge:bot
  global revenge revenge_nick revenge_ban_mask
  if nick is botnick
    set revenge "1"
    set revenge_nick $nick
    set revenge_ban_mask $uhost
    return 0
}

bind mode +o bot:revenge

proc bot:revenge
  global revenge revenge_nick revenge_ban_mask
  if $botnick == oped nick
    if $revenge == 1
      if {[ison $revenge_nick $chan]}
        putserv mode +b $revenge_ban_mask $chan
        putkick $revenge_nick 
        set all the revenge vars to ""
        set revenge "0"
         return 0
   }
  }
}

ofcourse this is just a rough draft, but
maybe this is something you can use
Last edited by Dedan on Sat Aug 16, 2003 11:19 pm, edited 1 time in total.
I once was an intelligent young man, now i am old and i can not remember who i was.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

excellent dedan :D

I think this should do it:

Code: Select all

set revenge "0" 
set revenge_nick "" 
set revenge_banmask "" 

bind kick - * revenge:bot 
bind mode "* +o" bot:revenge

proc revenge:bot {nick uhost hand chan targ rsn} {  
global revenge revenge_nick revenge_ban_mask 
 if {[string match -nocase $targ $::botnick]} { 
  putquick "PRIVMSG chanserv@services.dal.net :deop $chan $nick" -next 
  putquick "PRIVMSG chanserv@services.dal.net :unban $chan"   
    set revenge "1" 
    set revenge_nick $nick 
    set revenge_banmask "*!*@[lindex [split $uhost @] 1]" 
  }
} 

proc bot:revenge {nick uhost hand chan mc vict} {
global revenge revenge_nick revenge_banmask 
  if {$vict == $botnick} {
    if {$revenge == "1"} { 
      if {[isonchan $revenge_nick $chan]} { 
        putserv "mode +b $revenge_ban_mask $chan" 
        putkick $chan $revenge_nick "Lamer Removed."
        unset revenge_nick
        unset revenge_banmask 
        set revenge "0" 
        } 
    } 
}
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

used this :

Code: Select all

set revenge "0"
set revenge_nick ""
set revenge_banmask ""

bind kick - * channel:kick 
  
proc channel:kick {nick uhost hand chan targ rsn} {
  if {[string match -nocase "$targ" $::botnick]} {
  putquick "PRIVMSG chanserv@services.dal.net :deop $chan $nick" -next
  putquick "PRIVMSG chanserv@services.dal.net :unban $chan"
  set revenge "1"
  set revenge_nick "$nick"
  set revenge_banmask "*!*@[lindex [split $uhost @] 1]"
 }
}  
 
bind mode - "* +o" lamer:remove

proc lamer:remove {nick uhost hand chan mc vict} {
global revenge revenge_nick revenge_banmask
 if {$vict == $::botnick} {
  if {$revenge == "1"} {
      if {[onchan $revenge_nick $chan]} {
        putserv "mode $chan +b $revenge_banmask"  
        putkick $chan $revenge_nick "Lamer Removed."
        unset revenge_nick
        unset revenge_banmask
        set revenge "0"   
        }
     }
  }
}
didn't give any errors, but it didn't work... anyone can detect the problem ?
User avatar
Dedan
Master
Posts: 260
Joined: Wed Jul 09, 2003 10:50 pm
Location: Memphis

Post by Dedan »

what is "-next " for?
I once was an intelligent young man, now i am old and i can not remember who i was.
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

Sir_Fz wrote:used this :

Code: Select all

set revenge "0"
set revenge_nick ""
set revenge_banmask ""

bind kick - * channel:kick 
  
proc channel:kick {nick uhost hand chan targ rsn} {
  if {[string match -nocase "$targ" $::botnick]} {
  putquick "PRIVMSG chanserv@services.dal.net :deop $chan $nick" -next
  putquick "PRIVMSG chanserv@services.dal.net :unban $chan"
  set revenge "1"
  set revenge_nick "$nick"
  set revenge_banmask "*!*@[lindex [split $uhost @] 1]"
 }
}  
 
bind mode - "* +o" lamer:remove

proc lamer:remove {nick uhost hand chan mc vict} {
global revenge revenge_nick revenge_banmask
 if {$vict == $::botnick} {
  if {$revenge == "1"} {
      if {[onchan $revenge_nick $chan]} {
        putserv "mode $chan +b $revenge_banmask"  
        putkick $chan $revenge_nick "Lamer Removed."
        unset revenge_nick
        unset revenge_banmask
        set revenge "0"   
        }
     }
  }
}
didn't give any errors, but it didn't work... anyone can detect the problem ?
you need to globalize some variables in the channel:kick procedure.
Also, the problem with this approach is if your bot is kicked successivley before applying the initial revenge reaction... You will need a list of some type, or as you suggested, creating a user record, and giving them a script defined flag.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

The -next added at the end of a putserv, putquick, or puthelp will push the message to the front of the queue.

Or making an array like #channel(user) or something..
Once the game is over, the king and the pawn go back in the same box.
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

caesar wrote:The -next added at the end of a putserv, putquick, or puthelp will push the message to the front of the queue.

Or making an array like #channel(user) or something..
Arrays in TCL are implemented as lists.. thus, what I already suggested :wink:
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Actualy no, you've said:
you need to globalize some variables in the channel:kick procedure.
Also, the problem with this approach is if your bot is kicked successivley before applying the initial revenge reaction... You will need a list of some type, or as you suggested, creating a user record, and giving them a script defined flag.
so I don't see the word array mentioned there :P .. kidding :)
Once the game is over, the king and the pawn go back in the same box.
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

caesar wrote:Actualy no, you've said:
you need to globalize some variables in the channel:kick procedure.
Also, the problem with this approach is if your bot is kicked successivley before applying the initial revenge reaction... You will need a list of some type, or as you suggested, creating a user record, and giving them a script defined flag.
so I don't see the word array mentioned there :P .. kidding :)
From a prior reply:
strikelight wrote: Then I'd recommend:
1) adding the host/chan to a global variable (preferably a listed array,
ie. lamerstoban(#chan) {host1 host2})
2) using a mode bind to check for the bot getting opped, and then
applying the bans in the listed array.
3) unsetting the global listed array variable
So, the word array has been mentioned :P

Also, I said that arrays in TCL are implemented as lists..Which isn't totally accurate..I'll expand:
TCL Arrays are implemented as hashtables, which in turn, are essentially indexed lists.

We'll get you taught yet, caesar :wink:
Locked