egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Looking for someone to re-script my age kicker

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
b0rk
Voice


Joined: 19 Apr 2008
Posts: 4

PostPosted: Sat Apr 19, 2008 8:38 am    Post subject: Looking for someone to re-script my age kicker Reply with quote

Can anyone else me, i get these errors
Code:
[13:17] Tcl error [realname]: can't read "::sgchost": no such variable
[13:17] Not a ghost.


This one..
Code:
[13:12] Tcl error [realname]: can't read "::jchan": no such variable


from this..

Code:
bind pubm -|- "#database *SIGNED ON*" ghstcheck
bind join - *  whoisjoin
bind raw * 311 realname
bind raw * 302 userhst
set gclone 0
set gnick ""
proc whoisjoin {nick uhost hand chan} {
   global botnick
   if {$nick==$botnick} { return }
   set ::jchan $chan
   #putlog "joined room is $::jchan"
   putquick "MODE $chan +v $nick"
     putquick "whois $nick"
}
proc userhst { from key arg } {
set ::sgchost [string trim [string range $arg [expr [string first @ $arg] +1] end]]
set ::sgidnt [string range $arg [expr [string first + $arg] +1] [expr [string first @ $arg] -1] ]

#putlog "sgchost is $::sgchost"
if {$::sgchost=="Guardian :"} {
   putlog "Not a ghost."
}
return [string trim $::sgchost ]
}
proc ghstcheck { nick host hand chan text} {
  set chr(32) " "
  set signtxt [clone_stripcodes  [string trim $text]]
  set sighst [lindex $signtxt 2]
  set sgnick [lindex $signtxt 1]
  set ::gidnt [string range $sighst [expr [string first ( $sighst] +1] [expr [string first @ $sighst] -1] ]

  set sghost [string range $sighst [expr [string first @ $sighst] +1] end]
  set sgrnme  [string range $signtxt [expr [string first [lindex $signtxt 3] $signtxt] ] [expr [string first ) $signtxt] -1]]
  if {$sgrnme=="SearchIRC Crawler"} { set versi \00311IrcSearchRobot\00304 }
  if {$sgrnme!="SearchIRC Crawler"} { set versi \00309MircUser }

  #set sgrnme [string range $sgrnm [expr [string first $chr(32) $sgrnm] +1] end]
  #putlog "srgnm is sgrnm , sgrnme is $sgrnme" 
  set sgage [lindex $sgrnme 0]
  set sggender [strlwr [lindex $sgrnme 1]]
   #putlog "gender is $sggender"
  if {($sggender=="female") || ($sggender=="f")} { set gender \00313Female\00304 }

  if {($sggender=="male") || ($sggender=="m")} { set gender \00312Male\00304 }

  set sgloca [string range $sgrnme [string first [lindex $sgrnme 2] $sgrnme] end]
  set nicklen [expr [string length $sgnick ] -4]
  set nicktrim [string range $sgnick 0 $nicklen]
  set ::gnick $sgnick
  set ::grname [string trim $sgrnme ]
  set ::ghost [string trim $sghost ]
  set ::ghostnick $nicktrim
putquick "userhost $nicktrim"
if ([isnum $sgage]) {
putquick "PRIVMSG #Controlroom : \00304 $::gnick joined the network, they are $sgage years old $gender from $sgloca  "
  } else {
      #putlog "\00313realname is $sgrnme"
      if {($sgrnme!="SearchIRC Crawler") && ($sgrnme!="netsplit de")} { putquick "PRIVMSG #Controlroom : \00304 $::gnick joined the network, $versi "
          }
   }
#putlog "text is $signtxt"
 # putlog "nick is $sgnick , realname is $sgrnme , host is $sghost , age is $sgage gender is $sggender loca is $sgloca ident is $::gidnt"
 # putlog "\002\0039doing whois on $nicktrim"
  putquick "whois $nicktrim"

}
proc isnum {string} {if {([string compare $string ""]) && (![regexp {[^0-9]} $string])} then {return 1};return 0}

proc realname {from key arg} {
global botnick nick gclone
   set argst [clone_stripcodes [string trim $arg]]
   #putlog "arg is $arg"
#putlog "joined idnt is $::gidnt ghost idnt is $::sgidnt"
   set cchan $::jchan
   set rname [string range $argst [expr [string first : $argst] +1] end]
   set age [lindex $rname 0]
   set cnick [lindex $arg 1]
   set uahost [getchanhost $cnick $cchan]

   #putlog "nicklength is $nicklen nicktrim is $nicktrim ghost is $::ghost gclone is $::gclone"
   if {($::gnick!="")&&($::sgchost!="Guardian :")} {
   if {($::grname==$rname)&&($::gidnt==$::sgidnt)} {
   putlog "names and ident match"
      putquick "PRIVMSG #Controlroom : \00304 Killing the Ghost of $::ghostnick "
      putquick "PRIVMSG  operserv :set superadmin on"
      putquick "kill $::ghostnick  Nick Collision"
      putquick "PRIVMSG operserv :svsnick $::gnick $::ghostnick "
      putlog "\002\0049changing $::gnick to $::ghostnick "
      putquick "PRIVMSG  operserv :set superadmin off"
      putlog "\002\0039superadmin on-off, svsick $::gnick, killed $cnick"
      #utimer 3 unsetclone
      set ::grname ""
      set ::ghost ""
      set ::ghostnick ""
      set ::gnick ""
      set ::sgchost ""
      #putserv "ghost is $::ghost : ghostnick is $::ghostnick  "
      return
   }
      putlog "\002\0039not killing, grname is $::grname rname is $rname ghost is $::ghost uahost is $::sgchost  "
   #utimer 3 unsetclone
   set ::gnick ""
   set ::grname ""
   set ::ghost ""
   set ::ghostnick ""

   return
    }
 
   set banmask "*!*[string range $uahost [string first "@" $uahost] end]"
   set ua_reason "You are under age for $cchan"
   set uan_reason "You are under age for this network."
   #putlog "banmask is $banmask"
   #putlog "real name is $rname age is $age channel is $cchan : nick is $cnick mask is $banmask"
   if ([isnum $age]) {
   if {$age<15} {
     if {[onchan $cnick $cchan]} {   
      putlog "\002\0039«\003\002banning $cnick from $cchan for being underage for the network ($age)\002\0039»\003\002\ "
      newchanban $cchan $cnick $nick $uan_reason 10
      newchanban $cchan $banmask $nick $uan_reason 10
      putquick "MODE $cchan +bb $banmask $cnick"
      #putquick "MODE $cchan +b $cnick"
      putquick "KICK $cchan $cnick :You are underage for this network."
      return
      }
   }
   if {$age<16&&($cchan!="#Aberdeen"&&$cchan!="#Belfast"&&$cchan!="#TheRegulars"&&
       $cchan!="#Birmingham"&&$cchan!="#Bolton"&&$cchan!="#Brighton"&&
       $cchan!="#Bristol"&&$cchan!="#Cambridge"&&$cchan!="#Canterbury"&&$cchan!="#Cardiff"&&
       $cchan!="#Carlisle"&&$cchan!="#Chan-Islands"&&$cchan!="#Chester"&&
       $cchan!="#Colchester"&&$cchan!="#Coventry"&&$cchan!="#Croydon"&&$cchan!="#Darlington"&&
       $cchan!="#Derby"&&$cchan!="#Doncaster"&&$cchan!="#Dorset"&&$cchan!="#Dublin"&&
       $cchan!="#Dundee"&&$cchan!="#Dumfries"&&$cchan!="#Durham"&&$cchan!="#Dundee"&&
       $cchan!="#Edinburgh"&&$cchan!="#Enfield"&&$cchan!="#Exeter"&&$cchan!="#Falkirk"&&
       $cchan!="#Flyde"&&$cchan!="#Forum"&&$cchan!="#Glasgow"&&$cchan!="#Gloucester"&&
       $cchan!="#Guildford"&&$cchan!="#Huddersfield"&&$cchan!="#Hull"&&$cchan!="#Inverness"&&
       $cchan!="#Ipswich"&&$cchan!="#Ireland"&&$cchan!="#Kilmarnock"&&$cchan!="#Kingston-u-t"&&
       $cchan!="#Leeds"&&$cchan!="#Lincoln"&&$cchan!="#Liverpool"&&$cchan!="#London"&&
       $cchan!="#Luton"&&$cchan!="#Maidstone"&&$cchan!="#Manchester"&&$cchan!="#Medway"&&
       $cchan!="#Middlesbrough"&&$cchan!="#MiltonKeynes"&&$cchan!="#Motherwell"&&$cchan!="#Music"&&
       $cchan!="#Newcastle"&&$cchan!="#Newport"&&$cchan!="#Northampton"&&$cchan!="#Norwich"&&
       $cchan!="#Nottingham"&&$cchan!="#Oxford"&&$cchan!="#Peterborough"&&$cchan!="#Plymouth"&&
       $cchan!="#Preston"&&$cchan!="#Reading"&&$cchan!="#Romford"&&$cchan!="#Scotland"&&
       $cchan!="#Sheffield"&&$cchan!="#Slough"&&$cchan!="#Southampton"&&$cchan!="#Stevenage"&&
       $cchan!="#Stokeontrent"&&$cchan!="#Sunderland"&&$cchan!="#Swansea"&&$cchan!="#Swindon"&&
       $cchan!="#Taunton"&&$cchan!="#Technology"&&$cchan!="#Torquay"&&$cchan!="#Truro"&&
       $cchan!="#Wales"&&$cchan!="#Wolverhampton"&&$cchan!="#Worcester"&&$cchan!="#Wrexham"&&
       $cchan!="#York"&&$cchan!="#Leicester")} {
         if {[onchan $cnick $cchan]} {   
      putlog "\002\0039«\003\002banning $cnick from $cchan for being underage ($age) room $cchan\002\0039»\003\002\ "
      #putserv "privmsg $cchan :$cnick  you are underage for this room [$cchan]"
      newchanban $cchan $cnick $nick $ua_reason 10 
      newchanban $cchan $banmask $nick $ua_reason 10
      putquick "MODE $cchan +bb $banmask $cnick"
      #putquick "MODE $cchan +b $cnick"
      putquick "KICK $cchan $cnick :You are underage for this room, Please join another room."
      return
      }
   }
   if {$age<35&&$cchan == "#40something"} {
     if {[onchan $cnick $cchan]} {   
      putlog "\002\0039«\003\002banning $cnick from $cchan for being underage ($age) room $cchan\002\0039»\003\002\ "
      #putserv "privmsg $cchan :$cnick  you are underage for this room [$cchan]"
      newchanban $cchan $cnick $nick $ua_reason 10 
      newchanban $cchan $banmask $nick $ua_reason 10
      putquick "MODE $cchan +bb $banmask $cnick"
      #putquick "MODE $cchan +b $cnick"
      putquick "KICK $cchan $cnick :You are underage for this room, Please join another room."
      return
      }
   }
   if {$age<18&&$cchan == "#Nightclub"} {
     if {[onchan $cnick $cchan]} {   
      putlog "\002\0039«\003\002banning $cnick from $cchan for being underage ($age) room $cchan\002\0039»\003\002\ "
      #putserv "privmsg $cchan :$cnick  you are underage for this room [$cchan]"
      newchanban $cchan $cnick $nick $ua_reason 10 
      newchanban $cchan $banmask $nick $ua_reason 10
      putquick "MODE $cchan +bb $banmask $cnick"
      #putquick "MODE $cchan +b $cnick"
      putquick "KICK $cchan $cnick :You are underage for this room, Please join another room."
      return
      }
   }
   if {$age<18&&$cchan == "#Paranormal"} {
     if {[onchan $cnick $cchan]} {   
      putlog "\002\0039«\003\002banning $cnick from $cchan for being underage ($age) room $cchan\002\0039»\003\002\ "
      #putserv "privmsg $cchan :$cnick  you are underage for this room [$cchan]"
      newchanban $cchan $cnick $nick $ua_reason 10 
      newchanban $cchan $banmask $nick $ua_reason 10
      putquick "MODE $cchan +bb $banmask $cnick"
      #putquick "MODE $cchan +b $cnick"
      putquick "KICK $cchan $cnick :You are underage for this room, Please join another room."
      return
      }
   }
   if {$age<18&&$cchan == "#20something"} {
     if {[onchan $cnick $cchan]} {   
      putlog "\002\0039«\003\002banning $cnick from $cchan for being underage ($age) room $cchan\002\0039»\003\002\ "
      #putserv "privmsg $cchan :$cnick  you are underage for this room [$cchan]"
      newchanban $cchan $cnick $nick $ua_reason 10 
      newchanban $cchan $banmask $nick $ua_reason 10
      putquick "MODE $cchan +bb $banmask $cnick"
      #putquick "MODE $cchan +b $cnick"
      putquick "KICK $cchan $cnick :You are underage for this room, Please join another room."
      return
      }
   }
   if {$age<45&&$cchan == "#50something"} {
     if {[onchan $cnick $cchan]} {   
      putlog "\002\0039«\003\002banning $cnick from $cchan for being underage ($age) room $cchan\002\0039»\003\002\ "
      #putserv "privmsg $cchan :$cnick  you are underage for this room [$cchan]"
      newchanban $cchan $cnick $nick $ua_reason 10 
      newchanban $cchan $banmask $nick $ua_reason 10
      putquick "MODE $cchan +bb $banmask $cnick"
      #putquick "MODE $cchan +b $cnick"
      putquick "KICK $cchan $cnick :You are underage for this room, Please join another room."
      return
      }
   }
   if {$age<25&&$cchan == "#30something"} {
     if {[onchan $cnick $cchan]} {   
      putlog "\002\0039«\003\002banning $cnick from $cchan for being underage ($age) room $cchan\002\0039»\003\002\ "
      #putserv "privmsg $cchan :$cnick  you are underage for this room [$cchan]"
      newchanban $cchan $cnick $nick $ua_reason 10 
      newchanban $cchan $banmask $nick $ua_reason 10
      putquick "MODE $cchan +bb $banmask $cnick"
      #putquick "MODE $cchan +b $cnick"
      putquick "KICK $cchan $cnick :You are underage for this room, please join another room."
      return
      }
     }
  }
}

proc unsetclone {} { set ::gclone 0 }

proc clone_stripcodes {text} {
   regsub -all -- "\003(\[0-9\]\[0-9\]?(,\[0-9\]\[0-9\]?)?)?" $text "" text
   set text "[string map -nocase [list \002 "" \017 "" \026 "" \037 ""] $text]"
   return $text
}


Thanks

Edit: Code wrapping. (Sir_Fz)


Last edited by b0rk on Sat Apr 19, 2008 2:37 pm; edited 1 time in total
Back to top
View user's profile Send private message
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Sat Apr 19, 2008 9:21 am    Post subject: Reply with quote

you need to provide result of using ".set errorInfo" (see this topic)
Back to top
View user's profile Send private message
b0rk
Voice


Joined: 19 Apr 2008
Posts: 4

PostPosted: Sat Apr 19, 2008 9:26 am    Post subject: Reply with quote

Thanks, i'm no good at scripting, can anyone do it for me?

cheers
Back to top
View user's profile Send private message
YooHoo
Owner


Joined: 13 Feb 2003
Posts: 939
Location: Redwood Coast

PostPosted: Sat Apr 19, 2008 9:30 am    Post subject: Reply with quote

b0rk wrote:
Thanks, i'm no good at scripting, can anyone do it for me?
you are not paying attention. Go to your bot's partyline, type .set errorInfo, then copy/paste what the bot says here.
_________________
Mr. Green
Johoho's TCL for beginners
Mr. Green
Back to top
View user's profile Send private message Send e-mail
b0rk
Voice


Joined: 19 Apr 2008
Posts: 4

PostPosted: Sat Apr 19, 2008 9:55 am    Post subject: Reply with quote

Okay i did that and it keeps saying

`What? You need .help' even witht hem commands disabled.
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Apr 19, 2008 10:33 am    Post subject: Reply with quote

The cause of the error in the script would most likely be due to doing a check on someone who was already present in the channel when your bot joined (::sgchost is set whenever a 302 reply is given to a USERHOST command, sent by eggdrop by default when someone joins the channel; ::jchan is set by the proc "whoisjoin" - which is triggered by someone joining the channel.)

Roughly put, whenever any script does a WHOIS on someone your bot did not actually see join any channel, you'll end up with this error. Getting this working properly would take some rewriting of the code.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
b0rk
Voice


Joined: 19 Apr 2008
Posts: 4

PostPosted: Sat Apr 19, 2008 12:17 pm    Post subject: Reply with quote

Okay can someone help re-write it? thanks
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sat Apr 19, 2008 2:30 pm    Post subject: Reply with quote

Please edit your post and replace your current subject with a relevant one.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
Ibcus
Voice


Joined: 14 Aug 2008
Posts: 1

PostPosted: Thu Aug 14, 2008 8:33 pm    Post subject: Reply with quote

I wrote that script, and it's not just an age kicker.
May not be the best code in the world, but it works fine for me, regardless of people being in the room when it rejoins
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber