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 linux news tcl

Support & discussion of released scripts, and announcements of new releases.
Post Reply
f
freebsd
Voice
Posts: 6
Joined: Fri Oct 07, 2005 8:51 pm

error linux news tcl

Post by freebsd »

Code: Select all

# 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


User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

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: Select all

 tag when posting logs, code
Post Reply