<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/13779" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2007-08-25T16:47:47-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/13779</id>

		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2007-08-25T16:47:47-04:00</updated>

		<published>2007-08-25T16:47:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75497#p75497</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75497#p75497"/>
		<title type="html"><![CDATA[How to let an utimer know it`s own utimer id?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75497#p75497"><![CDATA[
There is no way to know the id at the time you create the code argument (because it doesn't exist yet).<br><br>If all the timers run for the same amount of time, your timer will always be the first on the list, which would let you use lrange to remove its id, but if the delay differs, that won't work...<br><br>I have the same problem with my socket api - code executed by the server socket needs to know its id, so I made my own "id" that is used to look up the real id. For timers it would be something like this:<br><div class="codebox"><p>Code: </p><pre><code>array set myTimer {}if {![info exists myTimerID]} {set myTimerID -1}proc myTimer {delay code} {global myTimerID myTimer# The custom id is appended to your code and must be used to unset myTimer(theID) if you kill the timerset myTimer([incr myTimerID]) [utimer $delay [lappend code $myTimerID]]set myTimerID}proc killMyTimer id {upvar 0 ::myTimer($id) timerif {[info exists timer]} {killutimer $timerunset timer}}</code></pre></div>Use the concept in your script instead of using these procs to avoid adding overhead... or use "utimers" in your "kill remaining" code.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Sat Aug 25, 2007 4:47 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Alchera]]></name></author>
		<updated>2007-08-24T19:45:57-04:00</updated>

		<published>2007-08-24T19:45:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75487#p75487</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75487#p75487"/>
		<title type="html"><![CDATA[How to let an utimer know it`s own utimer id?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75487#p75487"><![CDATA[
<a href="http://forum.egghelp.org/viewtopic.php?t=9941" class="postlink">Timers (Searching, killing, using time binds)</a><br><br>The above helpful?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3646">Alchera</a> — Fri Aug 24, 2007 7:45 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[sKy]]></name></author>
		<updated>2007-08-24T18:32:18-04:00</updated>

		<published>2007-08-24T18:32:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75486#p75486</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75486#p75486"/>
		<title type="html"><![CDATA[How to let an utimer know it`s own utimer id?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75486#p75486"><![CDATA[
No one knows? No way? Or is my English to bad to understand what I want to do?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6101">sKy</a> — Fri Aug 24, 2007 6:32 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[sKy]]></name></author>
		<updated>2007-07-18T13:26:53-04:00</updated>

		<published>2007-07-18T13:26:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=74519#p74519</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=74519#p74519"/>
		<title type="html"><![CDATA[How to let an utimer know it`s own utimer id?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=74519#p74519"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>proc lremove { list string } { return [lsearch -all -inline -not -exact $listname $string]}</code></pre></div>This sets the timers.<div class="codebox"><p>Code: </p><pre><code>set timer 0foreach element $list_of_ tasks { set timer [expr $timer + 5] set id [utimer $timer [list $element]] lappend ::list_with_timerids $id}</code></pre></div>This code is used in case of I want to kill the remaining utimers.<div class="codebox"><p>Code: </p><pre><code>foreach id $::list_with_timerids { killutimer $id}</code></pre></div>The problem is that if the utimer has already been executed then it would throw an error invalid timerid. Sure I could use catch, but I don`t want to use catch.<br><br>I don`t want to use catch because some other utimer (set by another script) could have that id now and I could eventually kill the wrong timer because he has the same name.<br><br>The problem is set id [utimer $timer [list $element]]. I would like to expand the [list ...] section with a command to remove the utimer from $::list_with_timerids. With set :list_with_timerids [lremove $:list_with_timerids $id].<br><br>But this isn`t possible because I get the $id just after I did set the utimer. Is there some tricky work around?<br><br>As far I know I can not modify a timer/utimer/after after it has been set. Otherwise it would be easy.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6101">sKy</a> — Wed Jul 18, 2007 1:26 pm</p><hr />
]]></content>
	</entry>
	</feed>
