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 

InsideGamer.tcl HELP!

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
ThaFridge
Voice


Joined: 06 Mar 2006
Posts: 4

PostPosted: Mon Mar 06, 2006 3:32 pm    Post subject: InsideGamer.tcl HELP! Reply with quote

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:
# $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 "&amp;"  $outchan "\\&" outchan
  regsub -all "&quot;" $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!!
Back to top
View user's profile Send private message
ThaFridge
Voice


Joined: 06 Mar 2006
Posts: 4

PostPosted: Mon Mar 06, 2006 6:06 pm    Post subject: Reply with quote

somebody?
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Mon Mar 06, 2006 6:54 pm    Post subject: Reply with quote

Quote:
.set errorInfo

and paste the answer.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Mon Mar 06, 2006 9:32 pm    Post subject: Reply with quote

ThaFridge wrote:
somebody?

Have you bothered to contact the author?
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
ThaFridge
Voice


Joined: 06 Mar 2006
Posts: 4

PostPosted: Tue Mar 07, 2006 11:36 am    Post subject: Reply with quote

Alchera wrote:
ThaFridge wrote:
somebody?

Have you bothered to contact the author?


script is 5 years old!!! he doesn support it anymore!
Back to top
View user's profile Send private message
ThaFridge
Voice


Joined: 06 Mar 2006
Posts: 4

PostPosted: Tue Mar 07, 2006 11:41 am    Post subject: Reply with quote

Sir_Fz wrote:
Quote:
.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!
Back to top
View user's profile Send private message
minted
Halfop


Joined: 20 Jul 2005
Posts: 64

PostPosted: Tue Mar 07, 2006 2:10 pm    Post subject: Reply with quote

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
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 -> Script Support & Releases 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