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.

replace bind time with utimer?

Help for those learning Tcl or writing their own scripts.
Post Reply
r
ricktee76
Voice
Posts: 12
Joined: Tue Jul 12, 2016 2:26 am

replace bind time with utimer?

Post by ricktee76 »

I've been running a highly modified domsen Shoutcast script but one thing i cant figure out is the bind time, currently it checks the stream is online every minute and updates the title etc into the chat.

the current bind time:

Code: Select all

bind time - "* * * * *" isonline
which checks every minute.

Code: Select all

proc isonline { nick uhost hand chan arg } {
global etc etc etc
global more more more

// isonline code here

}
i have tried
  • set newtimer [utimer 20 {isonline nick uhost hand chan arg}]
    utimer 20
    • utimer 20 {isonline nick uhost hand chan arg}
    the isonline process needs to be run every 20 seconds.

    Do i need to add the globals to the utimer?

    All help appreciated
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

The "arguments" in a bind time are <minute> <hour> <day> <month> <year> not 'nick uhost hand chan arg'.

Anyway, give this a try:

Code: Select all

proc checkOnline args {
	# execute the proc you want
	isonline 1 2 3 4 5

	# self maintain
	utimer 20 [list checkOnline]
}

# start the 20 seconds "infinite" loop
utimer 20 [list checkOnline]
And to adapt this to your code:

Code: Select all

proc isonline { nick uhost hand chan arg } {
	global etc etc etc
	global more more more

	// isonline code here

	# self maintain
	utimer 20 [list isonline 1 2 3 4 5]
}

# initiate the loop
utimer 20 [list isonline 1 2 3 4 5]
Once the game is over, the king and the pawn go back in the same box.
r
ricktee76
Voice
Posts: 12
Joined: Tue Jul 12, 2016 2:26 am

Post by ricktee76 »

thanks again caesar your reply was helpful once again, i have now got it working as i wanted by adding.

Much appreciated.

Code: Select all

 if {[info exists isonline]} {
  utimer xx [list isonline $nick $uhost $hand $chan $arg]
  } 
}
Post Reply