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 

error linux news tcl

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


Joined: 07 Oct 2005
Posts: 6

PostPosted: Sat Dec 31, 2005 11:31 am    Post subject: error linux news tcl Reply with quote

Code:
# www.linux-on-line.net backend eggdrop script
# linuxnews.tcl - requesting and displaying info
# Copyright (C) 2003 Sheyh [irc.sheyh.com], www.linux-on-line.net
# Greets goes to CoolCold [irc.rea.ru]

# $Id: linuxnews.tcl v 1.0 23/07/2003 12:32:15 Sheyh Exp $

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# HOWTo use:
# type !news in channel (or you can change it at next line), bot will
# diplay news in channel no more than once every 2 hours (noone likes flood),
# all other time it will send private notices. lynx is required for script to work.

# For any questions please contact me on IRC [irc.sheyh.com] #linux

bind pub - "!news" proc_listnews

proc proc_listnews {nnick uhost hand chan arg} {
    putlog "requesting http://linux-on-line.net news"
    readnewslist $nnick $chan
}

set saidtime unixtime
set temp 0
set gotpublic 0

proc readnewslist {nnick chan} {
global saidtime
global temp
global gotpublic

catch {  set res [exec lynx -source http://linux-on-line.net/backend/eggnews.php ] }

 if { $res == "" } {
    putserv "PRIVMSG $chan :can't connect to linux-on-line.net :(."
    return
  }

  set res [split $res \n]

  set line ""
  for {set i 0} {"[lindex $res $i]" != ""} {
  incr i
  } {
    if {$i > 20} { break }

set line ""
set line "$line[lindex $res $i]"
        set timenow unixtime
        set temp_timenow [$timenow]

  if { $i != 0 } {
  set timediff [expr $temp_timenow - $temp]
      if {$timediff > 7200}      {
        set gotpublic 1
        putserv "PRIVMSG $chan : $line "
      } else {
       putserv "NOTICE $nnick : $line "
      set gotpublic 0
         }
   } else {
   if { $line != "access1granted " } {
      putserv "PRIVMSG $chan : hm...looks like i've stolen this script from http://linux-on-line.net/backend/ :( "
      break
      }
   }

 }

if {$gotpublic > 0} {
       set saidtime unixtime
        set temp [$saidtime]
 }
}
<SnowStalker> [15:24] requesting http://linux-on-line.net news
<SnowStalker> [15:24] Tcl error [proc_listnews]: can't read "res": no such variable


Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sat Dec 31, 2005 1:03 pm    Post subject: Reply with quote

lynx doesn't get executed, or can't retrieve that webpage, therefore res doesn't get set, and since it's used in a condition on the very next line, hence your error
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
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