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 

Help with timer script - chan var [RESOLVED]

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
cache
Master


Joined: 10 Jan 2006
Posts: 306
Location: Mass

PostPosted: Fri Jan 15, 2010 10:54 pm    Post subject: Help with timer script - chan var [RESOLVED] Reply with quote

I am trying to make this run by a timer
Code:

# Public/User Channel
set streamch "#public"

# Private/DJ Channel
set djch "#private"

set radiotime 5

package require http

set a "$botnick"
set a [string tolower "$nick"]

if {![info exists ald]} {
set ald 1
timer $radiotime get_shoutcast_song
}

proc get_shoutcast_song {} {
   global url streamch a radiotime
   set streamch [string tolower $streamch]
   ::http::config -useragent "Mozilla/5.0; Shoutinfo"
   if {[string tolower $chan] == "$streamch"} {
      set http_req [::http::geturl $url -timeout 2000]
   if {[::http::status $http_req] != "ok"} {
      puthelp "PRIVMSG $chan :Stream is unavailable";
   }
   set data [::http::data $http_req]
   ::http::cleanup $http_req
   if {[regexp {<font class=default>Current Song: </font></td><td><font class=default><b>([^<]+)</b>} $data x title]} {
      puthelp "PRIVMSG $chan :\002Current Song\002: $title"
      timer $radiotime get_shoutcast_song
   } else {
      puthelp "PRIVMSG $chan :Couldn't receive any information, checking server status..."
      get_shoutcast_server $nick $uhost $hand $chan $arg
   }
   }
}


Error I get is:
[21:44] Tcl error in script for 'timer7716':
[21:44] can't read "chan": no such variable

Can someone please help me get the $chan variable added? I tried global chan with no luck.


Last edited by cache on Sat Jan 16, 2010 12:08 pm; edited 1 time in total
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Jan 16, 2010 8:28 am    Post subject: Reply with quote

From where should we get the value for $chan?

If you're thinking of the "streamch" variable you set in the beginning of the script, why not just use that one?
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
cache
Master


Joined: 10 Jan 2006
Posts: 306
Location: Mass

PostPosted: Sat Jan 16, 2010 12:08 pm    Post subject: Reply with quote

thank you for pointing that out to me Smile
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 Requests 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