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 

Can anyone tell me where I went wrong ? :(
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
NTHosts
Op


Joined: 10 Oct 2005
Posts: 100
Location: UK

PostPosted: Tue Jun 27, 2006 3:09 pm    Post subject: Can anyone tell me where I went wrong ? :( Reply with quote

Ok i wrote this..

Code:

bind pub * !test2 test2

proc test2 {nick uhost handle chan arg} {

   putquick "privmsg #Help :15"
   putquick "privmsg #Help :14"
   putquick "privmsg #Help :13"
   putquick "privmsg #Help :12"
   putquick "privmsg #Help :11"
   putquick "privmsg #Help :10"
   putquick "privmsg #Help :9"
   putquick "privmsg #Help :8"
   putquick "privmsg #Help :7"
   putquick "privmsg #Help :6"
   putquick "privmsg #Help :5"
   putquick "privmsg #Help :4"
   putquick "privmsg #Help :3"
   putquick "privmsg #Help :2"
   putquick "privmsg #Help :1"
   putquick "privmsg #Help :!kicksrc"
   putquick "privmsg #Help :Please Connect Now !"
   }

utimer 30 {

proc topic_update {sock} {

    set headers [egghttp:headers $sock]
    set topic [egghttp:data $sock]

    regexp { <td height="39" valign="top" id="description"><font color="white" face="verdana" size="2">(.*)</font></tr>} $topic - dj

    putquick "topic #LynxFM :\0030,12 ~ This Is LynxFM -|- The current DJ is: $dj ~ "
    #putquick "privmsg operserv :svsnick $djnick $djnick|On-Air"

  }
}


it does the count down bit fine, but the last bit dont work, i get this from .set errorInfo

ntIRC [14:08] #Nick# set errorInfo
ntIRC Currently: wrong # args: should be "topic_update sock"
ntIRC Currently: while executing
ntIRC Currently: "topic_update "

any ideas please ?

I am trying hehe Razz
_________________
www.NT-Hosts.Net - More than just a host
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
krimson
Halfop


Joined: 19 Apr 2006
Posts: 86

PostPosted: Tue Jun 27, 2006 4:19 pm    Post subject: Reply with quote

you shouldn't declare the proc inside the utimer, you should just call it then
Code:
proc topic_update {sock} {

    set headers [egghttp:headers $sock]
    set topic [egghttp:data $sock]

    regexp { <td height="39" valign="top" id="description"><font color="white" face="verdana" size="2">(.*)</font></tr>} $topic - dj

    putquick "topic #LynxFM :\0030,12 ~ This Is LynxFM -|- The current DJ is: $dj ~ "
    #putquick "privmsg operserv :svsnick $djnick $djnick|On-Air"

  }

utimer 30 topic_update <your arg here>
Back to top
View user's profile Send private message Send e-mail
NTHosts
Op


Joined: 10 Oct 2005
Posts: 100
Location: UK

PostPosted: Tue Jun 27, 2006 5:29 pm    Post subject: .. Reply with quote

will that make it call the second proc 30 seconds after it completes the first tho ? Shocked
_________________
www.NT-Hosts.Net - More than just a host
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
krimson
Halfop


Joined: 19 Apr 2006
Posts: 86

PostPosted: Tue Jun 27, 2006 5:40 pm    Post subject: Reply with quote

no.. if you want it to get called 30 seconds after it finishes, paste the utimer 30 line after the last line in proc test2
Back to top
View user's profile Send private message Send e-mail
NTHosts
Op


Joined: 10 Oct 2005
Posts: 100
Location: UK

PostPosted: Wed Jun 28, 2006 5:42 am    Post subject: ... Reply with quote

Dude that dont work.. i get this from .set errorInfo..

ntIRC Currently: wrong # args: should be "utimer seconds command"
ntIRC Currently: while executing
ntIRC Currently: "utimer 30"
ntIRC Currently: (procedure "test2" line 20)
ntIRC Currently: invoked from within
ntIRC Currently: "test2 $_pub1 $_pub2 $_pub3 $_pub4 $_pub5"

Im lost lol
_________________
www.NT-Hosts.Net - More than just a host
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Wed Jun 28, 2006 6:15 am    Post subject: Reply with quote

he said the utimer 30 line, not just utimer 30.
Back to top
View user's profile Send private message
NTHosts
Op


Joined: 10 Oct 2005
Posts: 100
Location: UK

PostPosted: Wed Jun 28, 2006 6:59 am    Post subject: right... Reply with quote

When I add it like

Code:

utimer 10 topic_update {sock}


I get..

Tcl error [test2]: wrong # args: should be "utimer seconds command"

So i remove the arg {sock} then i get this..

Tcl error in script for 'timer8':
wrong # args: should be "topic_update sock"

Im very confused as to what i need to do now Rolling Eyes Embarassed
_________________
www.NT-Hosts.Net - More than just a host
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Wed Jun 28, 2006 7:01 am    Post subject: Reply with quote

Code:
utimer 10 [list topic_update $sock]
Back to top
View user's profile Send private message
NTHosts
Op


Joined: 10 Oct 2005
Posts: 100
Location: UK

PostPosted: Wed Jun 28, 2006 7:15 am    Post subject: ... Reply with quote

Ok that 'seems' to have fixed that, but now I get the error..

Tcl error in script for 'timer9':
can't read "dj": no such variable

But dj is clearly there lol, here's the whole script now..

Code:
bind pub * !test2 test2

proc test2 {nick uhost handle chan arg} {

   putquick "privmsg #Help :5"
   putquick "privmsg #Help :4"
   putquick "privmsg #Help :3"
   putquick "privmsg #Help :2"
   putquick "privmsg #Help :1"
   putquick "privmsg #Help :!kicksrc"
   putquick "privmsg #Help :Please Connect Now !"
utimer 10 [list topic_update sock]
}

proc topic_update {sock} {

    set headers [egghttp:headers $sock]
    set topic [egghttp:data $sock]
    #set topic1 [egghttp:data $sock]

    regexp { <td height="39" valign="top" id="description"><font color="white" face="verdana" size="2">(.*)</font></tr>} $topic dj
    #regexp { <td height="39" valign="top" id="description"><font color="white" face="verdana" size="2">(.*)-} $topic1 - djnick


    putquick "topic #LynxFM :\0030,12 ~ This Is LynxFM -|- The current DJ is: $dj ~ "
    #putquick "privmsg operserv :svsnick $djnick $djnick|On-Air"

  }


Any ideas ?
Sorry if i'm being thick Razz
_________________
www.NT-Hosts.Net - More than just a host
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
NTHosts
Op


Joined: 10 Oct 2005
Posts: 100
Location: UK

PostPosted: Wed Jun 28, 2006 1:24 pm    Post subject: ... Reply with quote

anyone ? :-/
_________________
www.NT-Hosts.Net - More than just a host
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Wed Jun 28, 2006 1:42 pm    Post subject: Reply with quote

you are missing the extra argument in the first regexp, add something like - or "" or {} before 'dj'.
_________________
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Back to top
View user's profile Send private message MSN Messenger
NTHosts
Op


Joined: 10 Oct 2005
Posts: 100
Location: UK

PostPosted: Wed Jun 28, 2006 2:20 pm    Post subject: ... Reply with quote

That was there, just missed it when putting it in the forum sorry Embarassed
I tried using the others you said but didnt' work
_________________
www.NT-Hosts.Net - More than just a host
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Wed Jun 28, 2006 2:23 pm    Post subject: Reply with quote

the regexp simply does not match, check the syntax against the source. There are even tools out there to test regular expression, if you are not familar enough with them to match them with your brain Very Happy.
_________________
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Back to top
View user's profile Send private message MSN Messenger
NTHosts
Op


Joined: 10 Oct 2005
Posts: 100
Location: UK

PostPosted: Wed Jun 28, 2006 3:19 pm    Post subject: ... Reply with quote

Someone slap me lol, i hadnt set url or anything
derrrrrr

Anyway, the script now looks like this..

Code:
bind pub * !test2 test2

proc test2 {nick uhost handle chan arg} {

   putquick "privmsg #Help :5"
   putquick "privmsg #Help :4"
   putquick "privmsg #Help :3"
   putquick "privmsg #Help :2"
   putquick "privmsg #Help :1"
   putquick "privmsg #Help :!kicksrc"
   putquick "privmsg #Help :Please Connect Now !"
utimer 10 [list topic_update sock]
}
set url "http://www.lynxfm.info/stream.html"

proc topic_update {sock} {
  global url
    set headers [egghttp:headers $sock]
    set topic [egghttp:data $sock]
    set topic1 [egghttp:data $sock]
    set sock [egghttp:geturl $url topic_update]
    return 1

    regexp { <td height="39" valign="top" id="description"><font color="white" face="verdana" size="2">(.*)</font></tr>} $topic "" dj
    regexp { <td height="39" valign="top" id="description"><font color="white" face="verdana" size="2">(.*) - .*</font></tr>} $topic1 - djnick


    putquick "topic #LynxFM :\0030,12 ~ This Is LynxFM -|- The current DJ is: $dj ~ "
    putquick "privmsg operserv :svsnick $djnick $djnick|On-Air"

  }


and now gives the error..

ntIRC Currently: can't read "egghttp(9,body)": no such element in array
ntIRC Currently: while executing
ntIRC Currently: "if {![string match "*<*" $input] && ($egghttp($sock,body) == "")} {
ntIRC Currently: append egghttp($sock,headers) "$input\n"
ntIRC Currently: if {[string match "*HTTP/*" $inpu..."
ntIRC Currently: (procedure "egghttp:control" line 1Cool
ntIRC Currently: invoked from within
ntIRC Currently: "egghttp:control $_n $_a"

Anyone have any idea what that means ??

Shocked
_________________
www.NT-Hosts.Net - More than just a host
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Thu Jun 29, 2006 2:23 am    Post subject: Reply with quote

This script makes absolutely no sense at all.
It looks like you have no idea what you're doing if i read this.

I would advise you to use the http module anyway, i've found it to be much easier and better then egghttp.

Hint: You might want to try to call the topic_update with an actual socket, right now your script just loops by getting the website over and over (if i read it right)
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 -> Scripting Help All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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