<?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/16674" />

	<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>2009-03-08T17:28:52-04:00</updated>

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

		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2009-03-08T17:28:52-04:00</updated>

		<published>2009-03-08T17:28:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87773#p87773</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87773#p87773"/>
		<title type="html"><![CDATA[HELP on eggping.tcl ping-reply modification]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87773#p87773"><![CDATA[
I see your point but rather than cater for just about every possible command input that ppl might ask for, it's easier to teach the users the new syntax. Just !ping will /ctcp ping the command user.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Sun Mar 08, 2009 5:28 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[VinceDalnet]]></name></author>
		<updated>2009-03-08T15:07:56-04:00</updated>

		<published>2009-03-08T15:07:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87766#p87766</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87766#p87766"/>
		<title type="html"><![CDATA[HELP on eggping.tcl ping-reply modification]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87766#p87766"><![CDATA[
pls do something about this so the script doesnt look silly... <br><br><br>[02:20:22] &lt;+ ASucAL&gt; !ping me<br>[02:20:24] &lt;@ Voltron&gt; Error(ASucAL) me is not online<br><br><br>thanks in advance  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_cool.gif" width="15" height="15" alt="8)" title="Cool"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10526">VinceDalnet</a> — Sun Mar 08, 2009 3:07 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2009-03-08T09:33:53-04:00</updated>

		<published>2009-03-08T09:33:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87764#p87764</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87764#p87764"/>
		<title type="html"><![CDATA[HELP on eggping.tcl ping-reply modification]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87764#p87764"><![CDATA[
Your welcome,<br>always fun with overworked mathematical exercises, especially when one have to explain and motivate the arithmetic <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br>(Yes, I'm a geek, and I'm proud of it <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br><br>Code/math looks flawless now.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sun Mar 08, 2009 9:33 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2009-03-08T07:13:03-04:00</updated>

		<published>2009-03-08T07:13:03-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87762#p87762</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87762#p87762"/>
		<title type="html"><![CDATA[HELP on eggping.tcl ping-reply modification]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87762#p87762"><![CDATA[
Thanks again!<br><br>Final version<br><div class="codebox"><p>Code: </p><pre><code># ping.tcl by arfer/nml375# requires Tcl 8.4 or later# requires channel to permit embelished text (colour) output# each #channelname the script is to function in requires (in the partyline) .chanset #channelname +ping# assuming default trigger "." (period) syntax would be .ping ?target?##### CHANGELOG ############## 1.0 07/03/09 beta# 1.1 08/03/09 changed abs() math to modulus math to interpret integer wraparound##### CONFIGURATION #########set vPingTrigger "."##### CODE ##################proc pPingTrigger {} {  global vPingTrigger  return $vPingTrigger}set vPingVersion 1.1setudef flag pingbind CTCR - PING pPingCtcrReceivebind PUB - [pPingTrigger]ping pPingPubCommandbind RAW - 401 pPingRawOfflineproc pPingTimeout {} {  global vPingOperation  set schan [lindex $vPingOperation 0]  set snick [lindex $vPingOperation 1]  set tnick [lindex $vPingOperation 2]  putserv "PRIVMSG $schan :\00304Error\003 (\00314$snick\003) operation timed out attempting to ping \00307$tnick\003"  unset vPingOperation  return 0}proc pPingCtcrReceive {nick uhost hand dest keyword txt} {  global vPingOperation  if {[info exists vPingOperation]} {    set schan [lindex $vPingOperation 0]    set snick [lindex $vPingOperation 1]    set tnick [lindex $vPingOperation 2]    set time1 [lindex $vPingOperation 3]    if {([string equal -nocase $nick $tnick]) &amp;&amp; ([regexp -- {^[0-9]+$} $txt])} {      set time2 [expr {[clock clicks -milliseconds] % 16777216}]      set elapsed [expr {(($time2 - $time1) % 16777216) / 1000.0}]      set char [encoding convertto utf-8 \u258C]      if {[expr {round($elapsed / 0.5)}] &gt; 10} {set red 10} else {set red [expr {round($elapsed / 0.5)}]}      set green [expr {10 - $red}]      set output \00303[string repeat $char $green]\003\00304[string repeat $char $red]\003      putserv "PRIVMSG $schan :\00310Compliance\003 (\00314$snick\003) $output $elapsed seconds from \00307$tnick\003"      unset vPingOperation      pPingKillutimer    }  }  return 0}proc pPingKillutimer {} {  foreach item [utimers] {    if {[string equal pPingTimeout [lindex $item 1]]} {      killutimer [lindex $item 2]    }  }  return 0}proc pPingPubCommand {nick uhost hand channel txt} {  global vPingOperation  if {[channel get $channel ping]} {    switch -- [llength [split [string trim $txt]]] {      0 {set tnick $nick}      1 {set tnick [string trim $txt]}      default {        putserv "PRIVMSG $channel :\00304Error\003 (\00314$nick\003) correct syntax is \00307!ping ?target?\003"        return 0      }    }    if {![info exists vPingOperation]} {      if {[regexp -- {^[\x41-\x7D][-\d\x41-\x7D]*$} $tnick]} {        set time1 [expr {[clock clicks -milliseconds] % 16777216}]        putquick "PRIVMSG $tnick :\001PING [unixtime]\001"        utimer 20 pPingTimeout        set vPingOperation [list $channel $nick $tnick $time1]      } else {putserv "PRIVMSG $channel :\00304Error\003 (\00314$nick\003) \00307$tnick\003 is not a valid nick"}    } else {putserv "PRIVMSG $channel :\00304Error\003 (\00314$nick\003) a ping operation is still pending, please wait"}  }  return 0}proc pPingRawOffline {from keyword txt} {  global vPingOperation  if {[info exists vPingOperation]} {    set schan [lindex $vPingOperation 0]    set snick [lindex $vPingOperation 1]    set tnick [lindex $vPingOperation 2]    if {[string equal -nocase $tnick [lindex [split $txt] 1]]} {      putserv "PRIVMSG $schan :\00304Error\003 (\00314$snick\003) \00307$tnick\003 is not online"      unset vPingOperation      pPingKillutimer    }  }  return 0}putlog "ping.tcl by arfer/nml375 version $vPingVersion loaded"</code></pre></div><img src="http://i672.photobucket.com/albums/vv90/arfer/mircping3.png" class="postimage" alt="Image"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Sun Mar 08, 2009 7:13 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2009-03-07T23:16:57-04:00</updated>

		<published>2009-03-07T23:16:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87759#p87759</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87759#p87759"/>
		<title type="html"><![CDATA[HELP on eggping.tcl ping-reply modification]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87759#p87759"><![CDATA[
Speech,<br>Sorry, but I fail to see how that relates to this math issue?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sat Mar 07, 2009 11:16 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2009-03-07T23:11:02-04:00</updated>

		<published>2009-03-07T23:11:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87758#p87758</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87758#p87758"/>
		<title type="html"><![CDATA[HELP on eggping.tcl ping-reply modification]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87758#p87758"><![CDATA[
Hmm.. think I'm forgetting something.<br><br>Ah yes, the modulus value has to be of the same power as the base of the timestamp wraparound, in this case, base2. Using a slightly larger value, 2 to the power of 24 (16'777'216), will make this work.<div class="codebox"><p>Code: </p><pre><code>% set t1 [expr 2147483481 % 16777216]16777049% set t2 [expr -2147478615 % 16777216]5033%  expr ($t2 - $t1) % 167772165200</code></pre></div>Basically, the point of this arithmetic is to remove negative numbers by shrinking the numbers to a smaller, unsigned, space. This is best viewed as binary numbers in 2-complement, where the most significant byte (MSB) determines sign (1 = negative, 0 = positive). If we simply cut off the MSB and then 0-pad to the proper length again, we end up with a positive value.<br>As long as we are dealing with relative values where the difference is lower than the size of our smaller numbers, we will end up with a valid result.<br><div class="codebox"><p>Code: </p><pre><code> 011101 #1+4+8+16: 29+000110 #2+4: 6=100011 #-32 +1 + 2: -29#Lets use mod16011101 =&gt; 001101: 13100011 =&gt; 000011: 3#Lets get the difference, I could do this in binary aswell, but I'm lazy..3 - 13 =&gt; -10: 110110#Now again, use mod16110110 =&gt; 000110: 2 + 4: 6</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sat Mar 07, 2009 11:11 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2009-03-07T23:10:05-04:00</updated>

		<published>2009-03-07T23:10:05-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87757#p87757</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87757#p87757"/>
		<title type="html"><![CDATA[HELP on eggping.tcl ping-reply modification]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87757#p87757"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>&lt;speechles&gt; .tcl set now [clock seconds]&lt;sp33chy&gt; Tcl: 1236481292&lt;speechles&gt; .tcl set then [expr {$now - 500000000}]&lt;sp33chy&gt; Tcl: 736481292&lt;speechles&gt; .tcl set little_endian [expr {($now - $then) % 3600000}]&lt;sp33chy&gt; Tcl: 3200000&lt;speechles&gt; .tcl set big_endian [expr {($now - $then)/3600000}]&lt;sp33chy&gt; Tcl: 138&lt;speechles&gt; .tcl set total_ping "${big_endian}.${little_endian} seconds"&lt;sp33chy&gt; Tcl: 138.3200000 seconds</code></pre></div>You can use the endian method to store larger values without losing original signs, both modulus and division can do that. The big endian in this case is your seconds, the little endian is your remainder.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Sat Mar 07, 2009 11:10 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2009-03-07T22:30:57-04:00</updated>

		<published>2009-03-07T22:30:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87756#p87756</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87756#p87756"/>
		<title type="html"><![CDATA[HELP on eggping.tcl ping-reply modification]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87756#p87756"><![CDATA[
OK, I see that is exactly what you are infering and will occur at some point in time.<br><br>I still don't get the math though. Please bare with me because I'd like to incorporate this if it is the correct thing to do.<br><br>Maybe I'm reading it wrong.<br><br>Let me suggest an arbitrary scenario and you explain where I'm misunderstanding. I will use your $mod value of 3600000 (milliseconds per hour I assume you meant).<br><br>Say, my two [clock clicks -milliseconds] (once for the CTCP and again for the CTCR) cross over this 32 bit boundary and are 5.2 seconds (5200 milliseconds) apart.<br><br>Say, the first CTCP [clock clicks -milliseconds] returns 2147483481.<br><br>After 167 milliseconds it would cross the boundary and wrap to -2147483648 and after a further 5033 milliseconds (5200 total) the CTCR [clock clicks -milliseconds] would return -2147478615.<br><br>2147483481 % 3600000 = 1883481<br>-2147478615 % 3600000 = 1721385<br><br>(1883481 - 1721385) % 3600000 = 162096<br><br>I just don't get how this equates to the 5.2 seconds.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Sat Mar 07, 2009 10:30 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[VinceDalnet]]></name></author>
		<updated>2009-03-07T20:42:19-04:00</updated>

		<published>2009-03-07T20:42:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87755#p87755</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87755#p87755"/>
		<title type="html"><![CDATA[HELP on eggping.tcl ping-reply modification]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87755#p87755"><![CDATA[
works perfectly now! thanks alot to both of you...  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile">  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile">  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br><br>pls add it in egghelp tcl archive so everybody will use it.   <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_cool.gif" width="15" height="15" alt="8)" title="Cool"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10526">VinceDalnet</a> — Sat Mar 07, 2009 8:42 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2009-03-07T21:03:45-04:00</updated>

		<published>2009-03-07T20:23:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87754#p87754</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87754#p87754"/>
		<title type="html"><![CDATA[HELP on eggping.tcl ping-reply modification]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87754#p87754"><![CDATA[
My last effort does test if the channel is +ping but it isnt responsible for the errors that VinceDalnet is experiencing.<br><div class="codebox"><p>Code: </p><pre><code>if {[channel get $channel ping]} {# code}</code></pre></div>VinceDalnet repasted a prior version. Check my last post under this thread.<br><br>VinceDalnet, unload everything previously loaded, source my last version and restart your bot (not rehash). As nml375 suggested, there is no pingreply proc/command in my script.<br><br>Not sure I understand the modulus code. Aren't there way more than 3600000 microseconds in a day?<br><br>I get an immediate and correct resonse from a public command tclsh script using the values you suggested might take a long time to evaluate, as follows :-<br><br><img src="http://i672.photobucket.com/albums/vv90/arfer/tclsh.png" class="postimage" alt="Image"><br><br>Unless you are infering that at some point in time the return value from [clock clicks -milliseconds] changes from one of these extremes to the other.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Sat Mar 07, 2009 8:23 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2009-03-07T20:13:18-04:00</updated>

		<published>2009-03-07T20:13:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87753#p87753</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87753#p87753"/>
		<title type="html"><![CDATA[HELP on eggping.tcl ping-reply modification]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87753#p87753"><![CDATA[
Now I'm even more confused...<br>There still is no proc in there named "pingreply". Further, arfer's script does not test whether the channel is set +ping or not..<br><br>Do you get any error messages logged, or any other information from your bot?<br><br>Be advised that the version you posted still suffers from the issue of negative integers (causing mIRC and other clients to ignore the ping request), and is one of the older ones posted here...<br><br>Edit: Reading your post again, and I believe I misunderstood you alittle.<br>The script you posted is the one you do not use anymore, and you are currently using the last one posted by arfer?<br>(and yes, I admit that one does care for the +ping channel setting)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sat Mar 07, 2009 8:13 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[VinceDalnet]]></name></author>
		<updated>2009-03-07T19:56:07-04:00</updated>

		<published>2009-03-07T19:56:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87752#p87752</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87752#p87752"/>
		<title type="html"><![CDATA[HELP on eggping.tcl ping-reply modification]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87752#p87752"><![CDATA[
sorry it was this code that i gotten the errors...<br><div class="codebox"><p>Code: </p><pre><code>bind CTCR - PING pPingCtcrReceivebind PUB - .ping pPingPubCommandbind RAW - 401 pPingRawOfflineproc pPingTimeout {} {  global vPingOperation  set schan [lindex $vPingOperation 0]  set snick [lindex $vPingOperation 1]  set tnick [lindex $vPingOperation 2]  putserv "PRIVMSG $schan :\00304Error\003 (\00314$snick\003) operation timed out attempting to ping \00307$tnick\003"  unset vPingOperation  return 0}proc pPingCtcrReceive {nick uhost hand dest keyword txt} {  global vPingOperation  if {[info exists vPingOperation]} {    set schan [lindex $vPingOperation 0]    set snick [lindex $vPingOperation 1]    set tnick [lindex $vPingOperation 2]    if {([string equal -nocase $nick $tnick]) &amp;&amp; ([regexp -- {^[0-9]+$} $txt])} {      set seconds [expr {abs((abs([clock clicks -milliseconds]) - $txt) / 1000.0)}]      set char [encoding convertto utf-8 \u258C]      if {[expr {round($seconds / 0.5)}] &gt; 10} {set red 10} else {set red [expr {round($seconds / 0.5)}]}      set green [expr {10 - $red}]      set output \00303[string repeat $char $green]\003\00304[string repeat $char $red]\003      putserv "PRIVMSG $schan :\00310Compliance\003 (\00314$snick\003) $output $seconds seconds from \00307$tnick\003"      unset vPingOperation      pPingKillutimer    }  }  return 0}proc pPingKillutimer {} {  foreach item [utimers] {    if {[string equal pPingTimeout [lindex $item 1]]} {      killutimer [lindex $item 2]    }  }  return 0}proc pPingPubCommand {nick uhost hand channel txt} {  global vPingOperation  switch -- [llength [split [string trim $txt]]] {    0 {set tnick $nick}    1 {set tnick [string trim $txt]}    default {      putserv "PRIVMSG $channel :\00304Error\003 (\00314$nick\003) correct syntax is \00307!ping ?target?\003"      return 0    }  }  if {![info exists vPingOperation]} {    if {[regexp -- {^[\x41-\x7D][-\d\x41-\x7D]*$} $tnick]} {      set vPingOperation [list $channel $nick $tnick]      putserv "PRIVMSG $tnick :\001PING [expr {abs([clock clicks -milliseconds])}]\001"      utimer 20 pPingTimeout    } else {putserv "PRIVMSG $channel :\00304Error\003 (\00314$nick\003) \00307$tnick\003 is not a valid nick"}  } else {putserv "PRIVMSG $channel :\00304Error\003 (\00314$nick\003) a ping operation is still pending, please wait"}  return 0}proc pPingRawOffline {from keyword txt} {  global vPingOperation  if {[info exists vPingOperation]} {    set schan [lindex $vPingOperation 0]    set snick [lindex $vPingOperation 1]    set tnick [lindex $vPingOperation 2]    if {[string equal -nocase $tnick [lindex [split $txt] 1]]} {      putserv "PRIVMSG $schan :\00304Error\003 (\00314$snick\003) \00307$tnick\003 is not online"      unset vPingOperation      pPingKillutimer    }  }  return 0} </code></pre></div><br><br><strong class="text-strong">although the latest code still didnt produce any good result,... in fact it doesnt ping anyone... even if i already .chanset #chan +ping    <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_cry.gif" width="15" height="15" alt=":cry:" title="Crying or Very sad"></strong><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10526">VinceDalnet</a> — Sat Mar 07, 2009 7:56 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2009-03-07T19:46:46-04:00</updated>

		<published>2009-03-07T19:46:46-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87751#p87751</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87751#p87751"/>
		<title type="html"><![CDATA[HELP on eggping.tcl ping-reply modification]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87751#p87751"><![CDATA[
I can't find a singe proc named "pingreply" in arfer's script. Could it be possible your old script is still loaded?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sat Mar 07, 2009 7:46 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[VinceDalnet]]></name></author>
		<updated>2009-03-07T19:42:52-04:00</updated>

		<published>2009-03-07T19:42:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87750#p87750</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87750#p87750"/>
		<title type="html"><![CDATA[HELP on eggping.tcl ping-reply modification]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87750#p87750"><![CDATA[
arfer: im getting the following error on your new codes<br><br>Tcl error [pingreply]: can't read "chan": no such variable<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10526">VinceDalnet</a> — Sat Mar 07, 2009 7:42 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2009-03-07T19:30:46-04:00</updated>

		<published>2009-03-07T19:30:46-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87749#p87749</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87749#p87749"/>
		<title type="html"><![CDATA[HELP on eggping.tcl ping-reply modification]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87749#p87749"><![CDATA[
Eeek! <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br>Looks nice now, the remaining abs() is overkill, or could cause a huge delay in the event of a "wraparound", that is, when we reach the end of our 32bit signed integer and we go from 2147483647 to -2147483648 (or in the case of 64bit signed integers, even larger ranges).<br><br>The best approach would be to trim the timestamp using the modulus operator (%), and then do the same to the difference. This will give us a limited range, but we'll always have a positive value, and it's bound to be correct within the range.<br><br>I'll post a sample below, the value for the modulus operation was chosen to be the number of microseconds in a day:<div class="codebox"><p>Code: </p><pre><code>set $mod 3600000#First we start with two arbitrary values that won't cause an overflow:% set then 1242353145% set now [expr $then +1342]1242354487% set _then [expr $then % $mod]353145% set _now [expr $now % $mod]354487% expr ($_now - $_then) % $mod1342#Yay, we got 1342, which is the differential we started with, works sofar... now lets try a "borderline value"..% set then [expr $mod - 200]3599800% set now [expr $then +1342]3601142% set _then [expr $then % $mod]3599800% set _now [expr $now % $mod]1142% expr $_now - $_then-3598658% expr ($_now - $_then) % 36000001342#Once again, we got 1342 in the end. Here you can also see the issue of these "borderline values", as we get a huge negative value. Simply using abs() on this would tell us it took one day for the ping reply to come back...</code></pre></div>Oh, and btw, thnx for the credits.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sat Mar 07, 2009 7:30 pm</p><hr />
]]></content>
	</entry>
	</feed>
