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 

What song playing

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive
View previous topic :: View next topic  
Author Message
mrdr
Halfop


Joined: 16 Jun 2005
Posts: 42
Location: Lithuania / Vilnius / Underground

PostPosted: Tue Sep 20, 2005 11:06 am    Post subject: What song playing Reply with quote

Hi, Smile

I made this script:
Code:
bind pub - !zip zip_procedura
set irc_kanalai ""


proc zip_procedura {nick host handle chan arg} {
global irc_kanalai
if {[catch {set sock_zipfm [socket www.zipfm.lt 80] } sockerror]} {
putlog "news parsing error: $sockerror"
return 0 } else {
puts $sock_zipfm "GET /grojam.php HTTP/1.1"
puts $sock_zipfm "User-Agent: eggdrop egghelp.nasa-team.net (c)" \
puts $sock_zipfm "Host: www.zipfm.lt"
puts $sock_zipfm "Connection: close"
puts $sock_zipfm ""
flush $sock_zipfm
set empt ""
set he "0"
while {[eof $sock_zipfm ] != 1} {
set bl_rc [gets $sock_zipfm ]
if {$bl_rc == $empt} {
set he "1"
}
if {$he == "1"} {
set laikas [clock format [expr [clock seconds] + 60*60*24] -format " %H:%M:%S "]
while {[string match "<img src=img/icon_dabargrojame.gif width=12 height=11 border=0 align=absmiddle hspace=5>*" $bl_rc]} {
regsub -all "<img src=img/icon_dabargrojame.gif width=12 height=11 border=0 align=absmiddle hspace=5>" $bl_rc "" served_rc_1
regsub -all "<img src=img/icon_dabargrojame.gif width=12 height=11 border=0 align=absmiddle hspace=5>" $bl_rc "" bl_rc
}
}
}
close $sock_zipfm
if {$irc_kanalai == "" } {
puthelp "NOTICE $nick :Zip FM dabar groja:\002 $served_rc_1 \002"
} else {
if {[string match -nocase *$chan* $irc_kanalai] != 0 } {
puthelp "PRIVMSG $chan :($laikas) Zip FM groja: $served_rc_1"
}
}
after 2000
}
putlog "Zip FM informacija gauta: $laikas"
}

But when I write in IRC command !zip bot in partyline says:
Code:
TCL error [zip_procedura]: wrong # args: should be "puts ?-nonewline? ?channelId? string"


Help. Neutral
_________________
IRC: #egghelp @ Aitvaras.NET
IRC: #NASA @ Aitvaras.NET
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
incith
Master


Joined: 23 Apr 2005
Posts: 275
Location: Canada

PostPosted: Tue Sep 20, 2005 11:12 am    Post subject: Re: What song playing Reply with quote

mrdr wrote:
puts $sock_zipfm "User-Agent: eggdrop egghelp.nasa-team.net (c)" \

I think the trailing slash is screwing it up. Smile
_________________
; Answer a few unanswered posts!
Back to top
View user's profile Send private message
mrdr
Halfop


Joined: 16 Jun 2005
Posts: 42
Location: Lithuania / Vilnius / Underground

PostPosted: Tue Sep 20, 2005 11:17 am    Post subject: Reply with quote

OK. Deleted that "\" and new error:
Code:
TCL error [zip_procedura]: can't read "served_rc_1": no such variable

I know what it means. But server_rc_1 is here:
Code:
regsub -all "<img src=img/icon_dabargrojame.gif width=12 height=11 border=0 align=absmiddle hspace=5>" $bl_rc "" served_rc_1

Neutral
_________________
IRC: #egghelp @ Aitvaras.NET
IRC: #NASA @ Aitvaras.NET
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
demond
Revered One


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

PostPosted: Tue Sep 20, 2005 1:06 pm    Post subject: Reply with quote

it's there but it's not being set (because that [regsub] doesn't match), hence the error

DO NOT use raw sockets for quering webservers, use Tcl's built-in http package
_________________
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
mrdr
Halfop


Joined: 16 Jun 2005
Posts: 42
Location: Lithuania / Vilnius / Underground

PostPosted: Tue Sep 20, 2005 1:19 pm    Post subject: Reply with quote

demond wrote:
it's there but it's not being set (because that [regsub] doesn't match), hence the error

DO NOT use raw sockets for quering webservers, use Tcl's built-in http package

So... How can I fix that code? Embarassed
_________________
IRC: #egghelp @ Aitvaras.NET
IRC: #NASA @ Aitvaras.NET
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
demond
Revered One


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

PostPosted: Tue Sep 20, 2005 1:48 pm    Post subject: Reply with quote

obviously, by making sure [regsub] matches
_________________
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
incith
Master


Joined: 23 Apr 2005
Posts: 275
Location: Canada

PostPosted: Tue Sep 20, 2005 2:14 pm    Post subject: Reply with quote

Checking for variable existence is good, too.
Code:
if {[info exists server_rc1]} { puts "$server_rc1" }

_________________
; Answer a few unanswered posts!
Back to top
View user's profile Send private message
mrdr
Halfop


Joined: 16 Jun 2005
Posts: 42
Location: Lithuania / Vilnius / Underground

PostPosted: Wed Sep 21, 2005 12:22 am    Post subject: Reply with quote

Hrrr...
No luck with that script... Mad
_________________
IRC: #egghelp @ Aitvaras.NET
IRC: #NASA @ Aitvaras.NET
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive 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