| View previous topic :: View next topic |
| Author |
Message |
cache Master
Joined: 10 Jan 2006 Posts: 306 Location: Mass
|
Posted: Fri Jan 15, 2010 10:54 pm Post subject: Help with timer script - chan var [RESOLVED] |
|
|
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 |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sat Jan 16, 2010 8:28 am Post subject: |
|
|
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 |
|
 |
cache Master
Joined: 10 Jan 2006 Posts: 306 Location: Mass
|
Posted: Sat Jan 16, 2010 12:08 pm Post subject: |
|
|
thank you for pointing that out to me  |
|
| Back to top |
|
 |
|