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.

Error with this script

Old posts that have not been replied to for several years.
Locked
User avatar
jsilvestre
Voice
Posts: 20
Joined: Sat Mar 05, 2005 6:02 am
Location: Lisbon, Portugal

Error with this script

Post by jsilvestre »

Code: Select all

#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
#         ____ _               _____           _              _   ___            #
#        / ___| |__   __ _ _ _|_   _|__   ___ | |___   __   _/ | / _ \           #
#       | |   | '_ \ / _` | '_ \| |/ _ \ / _ \| / __|  \ \ / / || | | |          #
#       | |___| | | | (_| | | | | | (_) | (_) | \__ \   \ V /| || |_| |          #
#        \____|_| |_|\__,_|_| |_|_|\___/ \___/|_|___/    \_/ |_(_)___/           #
#                                                                                #
#       Moonspell           www.wolfheart.org          moon@pthelp.org           #
#                                                                                #
#  Script desenvolvido por Filipe Silva.                                         #
#  Bugs, sugestões, opiniões, comentários: enviem para moon@pthelp.org           #
#                                                                                #
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
#  -=(. Anti-Idle .)=- # Script Anti-Idle, Funciona para Idle Global, (raw 317)  #
#                      # Verifica primeiro o idle no Canal                       #
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
# Canal ou Canais em que pretende usar o Script! (separar por espaços)
set idle_channels "#teste"

# Intervalo de tempo para verificar o Idle! (minutos)
set idle_interval "10"

# Máximo de tempo idle permitido no Canal! (minutos)
set idle_time "30"

# [ops/voices/both] - Utilizadores aos quais se aplicará o Script.
set idle_users ops

#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
#     -=(. FAQ .)=-    # Respostas às possiveis dúvidas que possam surgir        #
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
# P: O que é uma Flag?                                                           #
# R: Flag é o nome dado ao estatuto(s) que cada Utilizador do Eggdrop tem, para  #
#    mais informações sobre cada uma delas faz (.help whois) na PartyLine do bot.#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
# P: O que quer dizer Idle ?                                                     #
# R: Idle é o tempo de inactividade de um cliente em relação ao seu servidor,    #
#    ou seja, um utilizador que não envia nenhuma Informação durante "X" tempo,  #
#    esse "X" corresponde ao Idle.                                               #
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
# P: Eu tenho uma dúvida diferente, onde posso obter ajuda ?                     #
# R: Nesse caso, poderás sempre pedir ajuda no canal #Eggdrop (irc.ptnet.org), e #
#    #Egg (irc.brasnet.org), canais pertencentes ao GUPE (Grupo de Utilizadores  #
#    Portugueses de Eggdrops), ou directamente comigo.                           #
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#

### Não alterar nada a partir daqui...
#
set chantools "\002(\002ChanTools\002)\002\037\:\037"
set ver "v1.0"
putlog "## $chantools $ver by Moonspell - Activo!"
proc u {} {return };# underline code
proc r {} {return };# reverse code
proc b {} {return };# bold code
proc c {} {return };# color code
proc o {} {return };# reset attributes code

### -=(. Anti-Idle .)=- BINDS\PROCS:

#Binds
bind raw - "317" raw_317 ;# Idle Time

#Procs
proc idlecheck { } {
 global idle_channels botnick idle_users idle_interval idle_time whois
  set whois idlemode
  if {$idle_channels == " "} {
    set idle_temp [channels]
  } else {
    set idle_temp $idle_channels
  }
  foreach chan $idle_temp {
    foreach person [chanlist $chan] {
      switch [lindex $idle_users 0] {
        "ops" {
          if {[isop $person $chan]} {
            if {(![matchattr [nick2hand $person $chan] b]) && ($person != $botnick) && ([getchanidle $person $chan]>$idle_time)} { putserv "WHOIS $person $person" }
          }
        }
        "voices" {
          if {[isvoice $person $chan]} {
            if {(![matchattr [nick2hand $person $chan] b]) && ($person != $botnick) && ([getchanidle $person $chan]>$idle_time)} { putserv "WHOIS $person $person" }
          }
        }
        "both" {
          if {([isop $person $chan]) || ([isvoice $person $chan]) && ([getchanidle $person $chan]>$idle_time)} {
            if {(![matchattr [nick2hand $person $chan] b]) && ($person != $botnick)} { putserv "WHOIS $person $person" }
          }
        }
      }
    }
  }
  if {![string match "*time_idle*" [timers]]} {
    timer $idle_interval idlecheck
  }
}

if {![string match "*time_idle*" [timers]]} {
  timer $idle_interval idlecheck
}

putlog "-- $chantools Anti-Idle - Activo!"


proc raw_317 {from key arg} {
 global idle_time idle_channels whois
  switch [lindex $whois 0] {
    "idlemode" {
      set nick [string tolower [lindex $arg 1]]
      set idle [string tolower [lindex $arg 2]]
      set minutesidle [expr $idle / 60]
      if {$minutesidle > $idle_time} {
        foreach channel $idle_channels {
          putserv "MODE $channel -o-v $nick $nick"
        }
      }
    }
  }
}

#EOF!
[03:52] Tcl error [raw_317]: can't read "whois": no such variable
Best Regards

José Eduardo Silvestre
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

the creator of the script obiously forgot that his raw trigger will not only trigger if this script requests a WHOIS, but also when triggered by others. the var will initilzed on first usage, so it might be requested before its initialized.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Locked