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.

InsideGamer.tcl HELP!

Support & discussion of released scripts, and announcements of new releases.
Post Reply
T
ThaFridge
Voice
Posts: 4
Joined: Mon Mar 06, 2006 3:19 pm

InsideGamer.tcl HELP!

Post by ThaFridge »

Heey guys im new on this forums but i think this is the place two be for help! IM working on a spin off from the fok.tcl this scripts displace the latest news on the channel this scripts uses RSS technologie!

But like always im having problems whit the script! and i hope that you guys cane help me with it!


This is the error that i see in the partyline!
(20:32:14) (ParaNoid) [20:32] [InsideGamer.nl] Trigger: !ig in #insidegamer by ThaFridgie
(20:32:14) (ParaNoid) [20:32] [InsideGamer.nl] Problem in data array: can't read "insidedata(descr,2)": no such element in array

Code: Select all

# $Id: insidegamer.tcl,v 1.24 2005/10/23 13:50:31 peter Exp $

# InsideGamer.tcl is gebasseerd op de nieuws script van Fok!
# Die weer geschreven is door Peter Postma

### Configuratie instellingen ###

# maak gebruik van een http proxy om de gegevens op te halen?
# stel op deze manier in: "host.isp.com:port" of laat 't leeg voor geen proxy
set inside(proxy) ""

# de triggers: [scheiden met een spatie]
set inside(triggers) "!ig !insidegamer"

# benodigde flags om de triggers te kunnen gebruiken. [default=iedereen]
set inside(flags) "-|-"

# kanalen waar de bot niet op de triggers zal reageren [scheiden met spatie]
set inside(nopub) "" 

# stuur berichten public of private wanneer er een trigger wordt gebruikt? 
# 0 = Private message
# 1 = Public message 
# 2 = Private notice 
# 3 = Public notice
set inside(method) 1

# aantal headlines weergeven wanneer een trigger wordt gebruikt. [>1] 
set inside(headlines) 1

# flood protectie: aantal seconden tussen gebruik van de triggers
# zet 't op 0 om de flood protectie uit te zetten.
set inside(antiflood) 10

# hieronder kun je de layout aanpassen voor de output:
# %title = titel van artikel
# %link  = url/link naar artikel
# %descr = description, beschrijving
# %b     = bold (dikgedrukte) tekst
# %u     = underlined (onderstreepte) tekst
set inside(layout) "\[%bInsideGamer%b\] %title - %link"

# om de hoeveel minuten checken of er nieuws is? [minimaal 30]
# deze waarde wordt gebruikt door zowel de triggers als het autonews.
set inside(updates) 30

# het nieuws automatisch weergeven in de kanalen? [0=nee / 1=ja] 
set inside(autonews) 1

# autonews: stuur naar welke kanalen? [kanalen scheiden met een spatie]
# gebruik "*" om het nieuws naar alle kanalen te sturen (/amsg).
set inside(autonewschan) "#insidegamer #thafridge"

# maximaal aantal berichten die worden getoond tijdens de automatische updates.
# hiermee kan je voorkomen dat de channel wordt ondergeflood als je de 
# updates hoog hebt staan (bv. langer dan een uur).
set inside(automax) 3

# trigger om het autonews aan te zetten. [string]
set inside(autontrigger) "!igon"

# trigger om het autonews uit te zetten. [string]
set inside(autofftrigger) "!igoff"

# benodigde flags om de autonews[on/off] triggers te gebruiken [default=master]
set inside(autotriggerflag) "m|m"

# log extra informatie (debug) naar de partyline? [0=nee / 1=ja]
set inside(log) 1

### Eind configuratie instellingen ###



### Begin Tcl code ###

set inside(version) "1.2"

if {[catch { package require http } err]} {
  putlog "\[InsideGamer.nl\] Kan [file tail [info script]] niet laden: Probleem met het laden van de http package: $err"
  return 1
}

if {[info tclversion] < 8.0} {
  putlog "\[InsideGamer.nl\] Kan [file tail [info script]] niet laden: U heeft minimaal Tcl versie 8.0 nodig en u heeft Tcl versie [info tclversion]."
  return 1
}

if {![info exists alltools_loaded]} {
  putlog "\[InsideGamer.nl\] Kan [file tail [info script]] niet laden: Zorg ervoor dat alltools.tcl in uw eggdrop configuratie wordt geladen!"
  return 1
}

set whichtimer [timerexists "inside:update"]
if {$whichtimer != ""} { killtimer $whichtimer }
catch { unset whichtimer }

foreach trigger [split $inside(triggers)] {
  bind pub $inside(flags) $trigger inside:pub
  if {$inside(log)} { putlog "\[InsideGamer.nl\] Trigger $trigger added." }
}
catch { unset trigger }

if {$inside(autofftrigger) != ""} { bind pub $inside(autotriggerflag) $inside(autofftrigger) inside:autoff }
if {$inside(autontrigger)  != ""} { bind pub $inside(autotriggerflag) $inside(autontrigger) inside:auton }

proc inside:getdata {} {
  global inside insidedata

  if {$inside(log)} { putlog "\[InsideGamer.nl\] Updating data..." }

  set url "http://www.insidegamer.nl/rss.xml"
  set page [::http::config -useragent "Mozilla"]

  if {$inside(proxy) != ""} {
    if {![regexp {(.+):([0-9]+)} $inside(proxy) trash proxyhost proxyport]} {
      putlog "\[InsideGamer.nl\] Wrong proxy configuration ($inside(proxy))"
      return -1
    }
    set page [::http::config -proxyhost $proxyhost -proxyport $proxyport]
    catch { unset proxyhost proxyport }
  }

  if {[catch { set page [::http::geturl $url -timeout 15000] } msg]} {
    putlog "\[InsideGamer.nl\] Problem: $msg"
    return -1
  }
  
  if {[::http::status $page] != "ok"} {
    putlog "\[InsideGamer.nl\] Problem: [::http::status $page]"
    catch { ::http::cleanup $page }
    return -1
  }

  if {![regexp -nocase {ok} [::http::code $page]]} {
    putlog "\[InsideGamer.nl\] Problem: [::http::code $page]"
    catch { ::http::cleanup $page }
    return -1
  }

  if {[catch { set data [::http::data $page] } msg]} {
    putlog "\[InsideGamer.nl\] Problem: $msg"
    catch { ::http::cleanup $page }
    return -1
  }

  if {[info exists insidedata]} { unset insidedata }

  set count 0
  set item 0
  foreach line [split $data \n] {
    regsub -all "\\&" $line "\\\\&" line
    if {[regexp "<item>" $line]} { set item 1 }
    if {[regexp "</item>" $line]} { set item 0; incr count }
    if {$item == 1} {
      regexp "<title>(.*)</title>" $line trash insidedata(title,$count)
      regexp "<link>(.*)</link>" $line trash insidedata(link,$count)
      regexp "<description>(.*)</description>" $line trash insidedata(descr,$count)
    }
  }

  set inside(lastupdate) [clock seconds]

  catch { ::http::cleanup $page }
  catch { unset url page msg data count item line trash }

  return 0
}

proc inside:pub {nick uhost hand chan text} {
  global lastbind inside insidedata
  if {[lsearch -exact $inside(nopub) [string tolower $chan]] >= 0} { return 0 }  

  if {$inside(antiflood) > 0} {
    if {[info exists inside(floodprot,$chan)]} {
      set verschil [expr [clock seconds] - $inside(floodprot,$chan)]
      if {$verschil < $inside(antiflood)} {
        putquick "NOTICE $nick :Trigger is net al gebruikt! Wacht aub. [expr $inside(antiflood) - $verschil] seconden..."
        return 0
      }
    }
    set inside(floodprot,$chan) [clock seconds]
  }

  if {$inside(log)} { putlog "\[InsideGamer.nl\] Trigger: $lastbind in $chan by $nick" }

  set ret 0
  if {[info exists inside(lastupdate)]} {
    if {[expr [clock seconds] - $inside(lastupdate)] >= [expr $inside(updates) * 60]} {
      set ret [inside:getdata]
    }
  } elseif {![info exists insidedata(link,0)]} {
    set ret [inside:getdata]
  }

  if {$ret != -1} {
    for {set i 0} {$i < $inside(headlines)} {incr i} { 
      if {![info exists insidedata(link,$i)]} { break }
      if {[catch { inside:put $chan $nick $i $inside(method) } err]} {
        putlog "\[InsideGamer.nl\] Problem in data array: $err"
      }
    }
  } else {
    putserv "NOTICE $nick :\[InsideGamer.nl\] Er ging iets fout tijdens het ophalen van de gegevens."
  }
  catch { unset ret verschil i err }
}

proc inside:put {chan nick which method} {
  global inside insidedata

  set outchan $inside(layout)
  regsub -all "%title" $outchan $insidedata(title,$which) outchan
  regsub -all "%link"  $outchan $insidedata(link,$which) outchan
  regsub -all "%descr" $outchan $insidedata(descr,$which) outchan
  regsub -all "&"  $outchan "\\&" outchan
  regsub -all """ $outchan "\"" outchan
  regsub -all "%b" $outchan "\002" outchan
  regsub -all "%u" $outchan "\037" outchan
  switch $method {
    0 { putserv "PRIVMSG $nick :$outchan" }
    1 { putserv "PRIVMSG $chan :$outchan" }
    2 { putserv "NOTICE $nick :$outchan" }
    3 { putserv "NOTICE $chan :$outchan" }
    default { putserv "PRIVMSG $chan :$outchan" }
  }
  catch { unset outchan }
}

proc inside:update {} {
  global inside insidedata

  if {[inside:getdata] != -1} {

    if {![info exists insidedata(link,0)]} {
      putlog "\[InsideGamer.nl\] Something went wrong while updating..."
      return -1
    }

    if {![info exists inside(lastitem)]} {
      set inside(lastitem) $insidedata(link,0)
      if {$inside(log)} { putlog "\[InsideGamer.nl\] Last news item set to '$insidedata(link,0)'." }
    } else {
      if {$inside(log)} { putlog "\[InsideGamer.nl\] Last news item is '$insidedata(link,0)'." }
    }

    if {$insidedata(link,0) != $inside(lastitem)} {
      if {$inside(log)} { putlog "\[InsideGamer.nl\] There's news!" }
      if {[regexp {^\*$} $inside(autonewschan)]} {
        set dest [channels]
      } else {
        set dest $inside(autonewschan)
      }
      for {set i 0} {$i < $inside(automax)} {incr i} {
        if {![info exists insidedata(link,$i)]} { break }
        if {$insidedata(link,$i) == $inside(lastitem)} { break }
        foreach chan [split $dest] {
          if {[catch { inside:put $chan $chan $i 1 } err]} {
            putlog "\[InsideGamer.nl\] Problem in data array: $err"
          }
        }
      }
      catch { unset dest i chan err }
    } else {
      if {$inside(log)} { putlog "\[InsideGamer.nl\] No news." }
    }

    set inside(lastitem) $insidedata(link,0)
  }

  if {$inside(updates) < 30} {
    putlog "\[InsideGamer.nl\] Warning: the \$inside(updates) setting is too low! Defaulting to 30 minutes..."
    timer 30 inside:update
  } else {
    timer $inside(updates) inside:update
  }

  return 0
}

proc inside:autoff {nick uhost hand chan text} {
  global lastbind inside
  if {[lsearch -exact $inside(nopub) [string tolower $chan]] >= 0} { return 0 }

  if {$inside(log)} { putlog "\[InsideGamer.nl\] Trigger: $lastbind in $chan by $nick" }

  if {$inside(autonews) == 1} {
    set inside(autonews) 0;  catch { unset inside(lastitem) }
    set whichtimer [timerexists "inside:update"]
    if {$whichtimer != ""} { killtimer $whichtimer }
    catch { unset whichtimer }
    putlog "\[InsideGamer.nl\] Autonews turned off."
    putserv "PRIVMSG $chan :\001ACTION heeft zijn InsideGamer.nl nieuws aankondiger uitgezet.\001"
  } else {
    putserv "NOTICE $nick :Mijn InsideGamer.nl nieuws aankondiger staat al uit."
  }
}

proc inside:auton {nick uhost hand chan text} {
  global lastbind inside
  if {[lsearch -exact $inside(nopub) [string tolower $chan]] >= 0} { return 0 }

  if {$inside(log)} { putlog "\[InsideGamer.nl\] Trigger: $lastbind in $chan by $nick" }

  if {$inside(autonews) == 0} {
    set inside(autonews) 1;  inside:update
    putlog "\[InsideGamer.nl\] Autonews turned on."
    putserv "PRIVMSG $chan :\001ACTION heeft zijn InsideGamer.nl nieuws aankondiger aangezet.\001"
  } else {
    putserv "NOTICE $nick :Mijn InsideGamer.nl nieuws aankondiger staat al aan."
  }
}

if {$inside(autonews) == 1} { inside:update }

putlog "\[InsideGamer.nl\] Nieuws script versie $inside(version): Loaded!"

i hope you guys cane help me becuas i dont know what the do nexht!!
T
ThaFridge
Voice
Posts: 4
Joined: Mon Mar 06, 2006 3:19 pm

Post by ThaFridge »

somebody?
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

.set errorInfo
and paste the answer.
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

ThaFridge wrote:somebody?
Have you bothered to contact the author?
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
T
ThaFridge
Voice
Posts: 4
Joined: Mon Mar 06, 2006 3:19 pm

Post by ThaFridge »

Alchera wrote:
ThaFridge wrote:somebody?
Have you bothered to contact the author?
script is 5 years old!!! he doesn support it anymore!
T
ThaFridge
Voice
Posts: 4
Joined: Mon Mar 06, 2006 3:19 pm

Post by ThaFridge »

Sir_Fz wrote:
.set errorInfo
and paste the answer.
(20:32:14) (ParaNoid) [20:32] [InsideGamer.nl] Trigger: !ig in #insidegamer by ThaFridgie
(20:32:14) (ParaNoid) [20:32] [InsideGamer.nl] Problem in data array: can't read "insidedata(descr,2)": no such element in array

This is the error!
m
minted
Halfop
Posts: 64
Joined: Wed Jul 20, 2005 9:58 am

Post by minted »

ThaFridge wrote:(20:32:14) (ParaNoid) [20:32] [InsideGamer.nl] Problem in data array: can't read "insidedata(descr,2)": no such element in array
when u get thos error, type .set errorInfo on the partyline (in dcc chat) as soon as u get the error
it gives a more detailed result of the error
Post Reply