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.

Script help timer etc.

Old posts that have not been replied to for several years.
t
trinitykln

Script help timer etc.

Post by trinitykln »

Hello

I have the following script:

Code: Select all

set ccdrift_url "http://www.cstv.dk/ccdrift/index.php" 
set ccdrift_channel "#cybercity"

bind topc -|- "#cybercity *" ccdrift_topic
bind time - "00 * * * *" ccdrift_topic
bind time - "05 * * * *" ccdrift_topic 
bind time - "10 * * * *" ccdrift_topic
bind time - "15 * * * *" ccdrift_topic 
bind time - "20 * * * *" ccdrift_topic 
bind time - "25 * * * *" ccdrift_topic
bind time - "30 * * * *" ccdrift_topic 
bind time - "35 * * * *" ccdrift_topic
bind time - "40 * * * *" ccdrift_topic 
bind time - "45 * * * *" ccdrift_topic
bind time - "50 * * * *" ccdrift_topic 
bind time - "55 * * * *" ccdrift_topic

proc ccdrift_topic {min hour day month year} { 
     global ccdrift_url ccdrift_channel
     set file [open "|lynx -connect_timeout=15 -source $ccdrift_url" r] 
     while {![eof $file]} { 
          gets $file html 
          if {$html == {}} {continue} 
          set html [string trimleft $html "<h1>"] 
          set html [string trimright $html "</h1>"] 
     } 
     if {$topic != $html} {
	set static "Cybercity Driftsstatus:"
	foreach chan $channel {
	puthelp "TOPIC $chan :$static $html" 
    }
  }
}

putlog "-= ccdrift.tcl - Cybercity Drift Info Script loaded =-"
Which generates the following error:
Tcl error [ccdrift_topic]: can't read "topic": no such variable

But if I change the line to:

Code: Select all

proc ccdrift_topic {min hour day month year topic}
I also get an error...

[17:05] Tcl error [ccdrift_topic]: no value given for parameter "topic" to "ccdrift_topic"

All I wanna do is set topic/check changes every 5/10 minuts....[/code]
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

scroll down to the bind section of tcl-commands.doc
photon?
K
Kaarel
Halfop
Posts: 91
Joined: Sat Apr 26, 2003 5:24 am

Post by Kaarel »

One question: What that script will do when it works
t
trinitykln

Post by trinitykln »

spock are you thinking of
(11) TOPC (stackable)
bind topc <flags> <mask> <proc>
procname <nick> <user@host> <handle> <channel> <topic>

(37) TIME (stackable)
bind time <flags> <mask> <proc>
proc-name <minute> <hour> <day> <month> <year>
so my proc must take: <nick> <user@host> <handle> <channel> <topic> and <minute> <hour> <day> <month> <year> correct ?

Kaarel:

The script check an php page I've made which graps info from my ISP's page about faults on their network, at post changes in topic
t
trinitykln

Post by trinitykln »

hm bummer :( :( :( :cry:
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

errm... isn't the error quite obvious? read the tcl-error you recieve carefully
Elen sila lúmenn' omentielvo
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Also, instead of all this:
bind time - "00 * * * *" ccdrift_topic
bind time - "05 * * * *" ccdrift_topic
bind time - "10 * * * *" ccdrift_topic
bind time - "15 * * * *" ccdrift_topic
bind time - "20 * * * *" ccdrift_topic
bind time - "25 * * * *" ccdrift_topic
bind time - "30 * * * *" ccdrift_topic
bind time - "35 * * * *" ccdrift_topic
bind time - "40 * * * *" ccdrift_topic
bind time - "45 * * * *" ccdrift_topic
bind time - "50 * * * *" ccdrift_topic
bind time - "55 * * * *" ccdrift_topic
wont' be easier like this:

Code: Select all

bind time - "00 * * * *" ccdrift_topic 
bind time - "?5 * * * *" ccdrift_topic 
Ps: The aswer you are looking for stands before your eyes.. remove the "topic" from "proc ccdrift_topic {min hour day month year topic}"
Once the game is over, the king and the pawn go back in the same box.
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

make it

Code: Select all

bind time - "?0 * * * *" ccdrift_topic 
bind time - "?5 * * * *" ccdrift_topic
:)
Elen sila lúmenn' omentielvo
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Uhmm.. yes, that will do the trick.
Once the game is over, the king and the pawn go back in the same box.
t
trinitykln

Post by trinitykln »

But if I remove topic from proc ccdrift the I get the following error:

Which generates the following error:
Tcl error [ccdrift_topic]: can't read "topic": no such variable

As mentioned above
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

yes, that's why you has to add a check to see if $year is a number or a string(topic)
Elen sila lúmenn' omentielvo
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Are you blind or something? Scroll up a bit because I've told you what to remove.. seesh.
Once the game is over, the king and the pawn go back in the same box.
t
trinitykln

Post by trinitykln »

Are you blind, did you read what i started to post... I had one without topic that also gave me an error....

But now I'll try finding out what year contains.... thx
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

now, now.... calm down boys :p
you are both correct ;)
caesar is correct in telling you that you shall remove topic from the proc's arguments. And you are ofc correct that it'll give you a new error, but as you can see it's a different one. So you either have to set a global topic, or do as I said and check the $year =)
Elen sila lúmenn' omentielvo
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

(37) TIME (stackable)
bind time <flags> <mask> <proc>
proc-name <minute> <hour> <day> <month> <year>
so who the heck is the blind one here?
Once the game is over, the king and the pawn go back in the same box.
Locked