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

	<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-08-15T07:03:12-04:00</updated>

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

		<entry>
		<author><name><![CDATA[neoclust]]></name></author>
		<updated>2009-08-15T07:03:12-04:00</updated>

		<published>2009-08-15T07:03:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89885#p89885</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89885#p89885"/>
		<title type="html"><![CDATA[A comparison]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89885#p89885"><![CDATA[
Thanks a lot arfer and Speechless the code works<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10812">neoclust</a> — Sat Aug 15, 2009 7:03 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2009-08-15T06:18:40-04:00</updated>

		<published>2009-08-15T06:18:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89884#p89884</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89884#p89884"/>
		<title type="html"><![CDATA[A comparison]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89884#p89884"><![CDATA[
Just to answer the original poster, I think the following will now work in all circumstances (all that I can test anyway).<br><div class="codebox"><p>Code: </p><pre><code>bind JOIN - * pLimitJoinbind MODE - "% +l" pLimitChangeproc pLimitJoin {nick uhost hand chan} {    if {[isbotnick $nick]} {        utimer 10 [list pLimitCheck $chan]    }    return 0}proc pLimitCheck {chan} {    global vLimitOld    regexp -- {^[^-\s]+k?l([\s][^-\s]+)?[\s]([0-9]+)} [getchanmode $chan] -&gt; dummy vLimitOld($chan)    return 0}proc pLimitChange {nick uhost hand chan mode target} {    global vLimitOld    if {([info exists vLimitOld($chan)]) &amp;&amp; ([string length $vLimitOld($chan)] != 0)} {        if {$vLimitOld($chan) != $target} {            putlog "limit change in $chan from $vLimitOld($chan) to $target"        }    }    set vLimitOld($chan) $target    return 0}# eof</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Sat Aug 15, 2009 6:18 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2009-08-14T21:18:36-04:00</updated>

		<published>2009-08-14T21:18:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89881#p89881</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89881#p89881"/>
		<title type="html"><![CDATA[A comparison]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89881#p89881"><![CDATA[
Ok thanks. It was my IRC knowledge that let me down, though I don't doubt there must be a regexp that would do the trick no matter how complex the compounded modes get.<br><div class="codebox"><p>Code: </p><pre><code>regexp -- {\+[^\-]+k?l([\s].+)? ([0-9]+)} [getchanmode $chan] -&gt; key limit</code></pre></div>The above seems to work as long as there is no other mode appearing between k and l<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Fri Aug 14, 2009 9:18 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2009-08-14T20:22:21-04:00</updated>

		<published>2009-08-14T20:22:21-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89880#p89880</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89880#p89880"/>
		<title type="html"><![CDATA[A comparison]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89880#p89880"><![CDATA[
<blockquote class="uncited"><div>I think the regexp I have used would be correct in all circumstances.</div></blockquote><div class="codebox"><p>Code: </p><pre><code>set limit [lindex [split [string trim [lindex [split [getchanmode $chan] l] 1]]] 0]</code></pre></div><span style="font-size:84%;line-height:116%">Note: that is a lowercase L during the [split] on [getchanmode]. It is not the numeral 1.</span><br><br>This works almost as well as your regexp with the same common problem. If the channel is keyed and contains any digits, your regexp will pick this up instead as k comes before l. In my version it will pick up the entire key regardless of digits or not. Yours will fail on a key with digits, mine will fail with a key period.. HAW<br><br>There is probably a simple way to extract just the limit but may require more than a single line of code. Need to get an if in there to perform some manipulation depending upon circumstances (presence of +k)...<br><div class="codebox"><p>Code: </p><pre><code>-- in channel #test* speechles sets mode: +l 1337* speechles sets mode: +k 31337-- in partyline&lt;speechles&gt; .tcl regexp -- {\+[^\-]+l ([0-9]+)} [getchanmode #test] -&gt; limit&lt;bot&gt; Tcl: 1&lt;speechles&gt; .tcl set test $limit&lt;bot&gt; Tcl: 31337&lt;speechles&gt; .tcl set test  [lindex [split [string trim [lindex [split [getchanmode #test] l] 1]]] 0]&lt;bot&gt; Tcl: 31337</code></pre></div>Basically, it needs this code:<div class="codebox"><p>Code: </p><pre><code>set place 0if {[string match "*k*" [lindex [split [getchanmode #test] l] 0]]} { incr place }set limit [lindex [split [string trim [lindex [split [getchanmode #test] l] 1]]] $place]</code></pre></div>This should work with a key now and in all situations. *crosses fingers* <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><div class="codebox"><p>Code: </p><pre><code>-- in partyline&lt;speechles&gt; .tcl set place 0&lt;bot&gt; Tcl: 0&lt;speechles&gt; .tcl if {[string match "*k*" [lindex [split [getchanmode #test] l] 0]]} { incr place }&lt;bot&gt; Tcl: 1&lt;speechles&gt; .tcl set limit [lindex [split [string trim [lindex [split [getchanmode #test] l] 1]]] $place]&lt;bot&gt; Tcl: 1337&lt;speechles&gt; YAY!!</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Fri Aug 14, 2009 8:22 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2009-08-14T19:24:51-04:00</updated>

		<published>2009-08-14T19:24:51-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89879#p89879</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89879#p89879"/>
		<title type="html"><![CDATA[A comparison]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89879#p89879"><![CDATA[
This script will get the bot's channel limits shortly after it joins each channel to initialise the old limit array (if it tried to do this immediately then the result would be erroneous).<br><br>It then compares the old limit with the new after each +l mode change and if different outputs to the partyline and resets the variable containing the old limit.<br><div class="codebox"><p>Code: </p><pre><code>bind JOIN - * pLimitJoinbind MODE - "% +l" pLimitChangeproc pLimitJoin {nick uhost hand chan} {    if {[isbotnick $nick]} {        utimer 10 [list pLimitCheck $chan]    }    return 0}proc pLimitCheck {chan} {    global vLimitOld    regexp -- {\+[^\-]+l ([0-9]+)} [getchanmode $chan] -&gt; vLimitOld($chan)    return 0}proc pLimitChange {nick uhost hand chan mode target} {    global vLimitOld    if {[info exists vLimitOld($chan)]} {        if {$vLimitOld($chan) != $target} {            putlog "limit change in $chan from $vLimitOld($chan) to $target"        }    }    set vLimitOld($chan) $target    return 0}# eof</code></pre></div>Your attempt to get the limit from [getchanmode $chan] would probably not work in all circumstances, for example if the modes were "+ntl 45 -c". I think the regexp I have used would be correct in all circumstances. I have tested the script and it seems to function as expected.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Fri Aug 14, 2009 7:24 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[neoclust]]></name></author>
		<updated>2009-08-14T11:14:02-04:00</updated>

		<published>2009-08-14T11:14:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89872#p89872</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89872#p89872"/>
		<title type="html"><![CDATA[A comparison]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89872#p89872"><![CDATA[
Good morning, i need to make a comparison between the previous value of the limit with the new, it's possible to store the previous value to compare with the new ? show me how plz thanks.<br><br>bind mode - * Xlimite:scan<br>proc currentlimit {chan} {<br>    set currentmodes [getchanmode $chan]<br>    if {[string match "*l*" [lindex $currentmodes 0]]} {<br>   return [lindex $currentmodes end]<br>    }<br>    return 0<br>} <br><br>proc Xlimite:scan {nick host hand chan modechg victim} {<br>     set newlimit [currentlimit $chan] <br>     # i want set previous value of limit<br>     if {$limit &lt; $newlimit} { return 0 }<br><br>     the rest of the proc<br><br>     return 0<br>}<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10812">neoclust</a> — Fri Aug 14, 2009 11:14 am</p><hr />
]]></content>
	</entry>
	</feed>
