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

	<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>2004-03-11T17:05:07-04:00</updated>

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

		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2004-03-11T17:05:07-04:00</updated>

		<published>2004-03-11T17:05:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=34490#p34490</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=34490#p34490"/>
		<title type="html"><![CDATA[Four ways to do it]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=34490#p34490"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>% proc test find {        foreach way {                {set ok [expr {[lsearch -exact {word1 word2 word3 word4} $find]&gt;-1}]}                {switch -- $find {word1 - word2 - word3 - word4 {set ok 1} default {set ok 0}}}                {set ok [expr {$find=="word1"||$find=="word2"||$find=="word3"||$find=="word4"}]}                {set ok [regexp {^(word1|word2|word3|word4)$} $find]}        } {                puts "[time $way 10000] (result: [eval $way])"        }}% test word14 microseconds per iteration (result: 1)6 microseconds per iteration (result: 1)7 microseconds per iteration (result: 1)30 microseconds per iteration (result: 1)% test word44 microseconds per iteration (result: 1)6 microseconds per iteration (result: 1)17 microseconds per iteration (result: 1)30 microseconds per iteration (result: 1)% test word124 microseconds per iteration (result: 0)6 microseconds per iteration (result: 0)17 microseconds per iteration (result: 0)28 microseconds per iteration (result: 0)</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Thu Mar 11, 2004 5:05 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[strikelight]]></name></author>
		<updated>2004-03-11T14:24:11-04:00</updated>

		<published>2004-03-11T14:24:11-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=34480#p34480</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=34480#p34480"/>
		<title type="html"><![CDATA[multiples conditions, have better way?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=34480#p34480"><![CDATA[
Alternatively....<br><div class="codebox"><p>Code: </p><pre><code>if {[regexp -nocase -- {^commands$|^rosters$|^rules$|^servers$} [lindex $text 0]]} {... do stuff ...}</code></pre></div>However, while the code is more concise, regexp is a bit of a cpu eater, so it may be a few microseconds slower than using direct comparitive expressions.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2005">strikelight</a> — Thu Mar 11, 2004 2:24 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2004-03-11T14:11:47-04:00</updated>

		<published>2004-03-11T14:11:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=34477#p34477</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=34477#p34477"/>
		<title type="html"><![CDATA[multiples conditions, have better way?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=34477#p34477"><![CDATA[
When you are using "strlwr" you are actualy calling an proc from alltools.tcl that will do that "string tolower" thing and this will slow your proc down a bit <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Thu Mar 11, 2004 2:11 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Xpert]]></name></author>
		<updated>2004-03-11T14:08:17-04:00</updated>

		<published>2004-03-11T14:08:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=34475#p34475</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=34475#p34475"/>
		<title type="html"><![CDATA[multiples conditions, have better way?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=34475#p34475"><![CDATA[
Sorry, i forgot about the strlwr <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4667">Xpert</a> — Thu Mar 11, 2004 2:08 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2004-03-11T14:04:59-04:00</updated>

		<published>2004-03-11T14:04:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=34474#p34474</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=34474#p34474"/>
		<title type="html"><![CDATA[multiples conditions, have better way?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=34474#p34474"><![CDATA[
Xpert : foo is not equal with FOO, FoO, fOO, etc. So, either use "string tolower" to lower the stuff you compare or use "string equal -nocase" Consult the <a href="http://tmml.sourceforge.net/doc/tcl/string.html" class="postlink">manual</a> about them.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Thu Mar 11, 2004 2:04 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Xpert]]></name></author>
		<updated>2004-03-11T13:52:29-04:00</updated>

		<published>2004-03-11T13:52:29-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=34472#p34472</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=34472#p34472"/>
		<title type="html"><![CDATA[multiples conditions, have better way?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=34472#p34472"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>if {([lindex $text 0] == "commands") || ([lindex $text 0] == "rosters") || ([lindex $text 0] == "rules") || ([lindex $text 0] == "servers")} {   pub:learn:add $nick $chan[lrange $text 0 end]   return 0 }</code></pre></div>Don't forget the "(,)" if you have more than one condition <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4667">Xpert</a> — Thu Mar 11, 2004 1:52 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[LorT]]></name></author>
		<updated>2004-03-11T13:39:21-04:00</updated>

		<published>2004-03-11T13:39:21-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=34469#p34469</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=34469#p34469"/>
		<title type="html"><![CDATA[multiples conditions, have better way?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=34469#p34469"><![CDATA[
sorry my bad<br>the string arent a-k is only ej.<br>the string are commands, roster, rules, records, servers....<br>how can i check if?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2832">LorT</a> — Thu Mar 11, 2004 1:39 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2004-03-11T12:55:25-04:00</updated>

		<published>2004-03-11T12:55:25-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=34462#p34462</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=34462#p34462"/>
		<title type="html"><![CDATA[use [code][/code] around your code in the future]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=34462#p34462"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>if {[string match {[a-k]} [lindex $text 0]]} {whatever}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Thu Mar 11, 2004 12:55 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[LorT]]></name></author>
		<updated>2004-03-11T13:45:37-04:00</updated>

		<published>2004-03-11T12:41:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=34461#p34461</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=34461#p34461"/>
		<title type="html"><![CDATA[multiples conditions, have better way?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=34461#p34461"><![CDATA[
i have 11 conditions in a proc.<br>if {[lindex $text 0] == "commands"} {<br>  pub:learn:add $nick $chan[lrange $text 0 end]<br>  return 0<br>} <br>if {[lindex $text 0] == "rosters"} {<br>  pub:learn:add $nick $chan[lrange $text 0 end]<br>  return 0<br>} <br>to......<br>if {[lindex $text 0] == "servers"} {<br>  pub:learn:add $nick $chan[lrange $text 0 end]<br>  return 0<br>} <br>puthelp "notice $nick :invalid option. optin: ............"<br> <br>new i change it to<br>if {[lindex $text 0] == "commands" || [lindex $text 0] == "rosters" ......|| [lindex $text 0] == "servers"} {<br>  pub:learn:add $nick $chan[lrange $text 0 end]<br>  return 0<br>} <br>puthelp "notice $nick :invalid option. optin: ............"<br> <br>have a better way to do if?<br><br>edit: change the string name<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2832">LorT</a> — Thu Mar 11, 2004 12:41 pm</p><hr />
]]></content>
	</entry>
	</feed>
