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

	<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>2005-01-07T16:15:50-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Damnation85]]></name></author>
		<updated>2005-01-07T16:15:50-04:00</updated>

		<published>2005-01-07T16:15:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=45168#p45168</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=45168#p45168"/>
		<title type="html"><![CDATA[String matching]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=45168#p45168"><![CDATA[
its k, the 3 options is in the public comand which then passes its varibles to the msg command so that i don't duplicate code.the 4 check is in the msg code (chan being one of the checks) <br><br>thanx for your help i am slowly tackling your snippets and making them work for me, and learning to understand them, it is greatly reducing the number of lines of code that the proc is using<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5811">Damnation85</a> — Fri Jan 07, 2005 4:15 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2005-01-07T16:13:04-04:00</updated>

		<published>2005-01-07T16:13:04-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=45165#p45165</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=45165#p45165"/>
		<title type="html"><![CDATA[String matching]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=45165#p45165"><![CDATA[
I didn't notice that you accept 3 OR 4 args untill now...here's an idea for you:<div class="codebox"><p>Code: </p><pre><code>switch [scan $arg %s%s%s%s 0 1 2 3] {4 {# have four non-empty arguments ($0, $1, $2 and $3)}3 {# three...which is also okay ($0, $1 and $2)}default {# too few...bitch and whine}}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Fri Jan 07, 2005 4:13 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Damnation85]]></name></author>
		<updated>2005-01-07T15:54:05-04:00</updated>

		<published>2005-01-07T15:54:05-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=45162#p45162</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=45162#p45162"/>
		<title type="html"><![CDATA[String matching]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=45162#p45162"><![CDATA[
*looks at answer with boggled eyes* ok i think i'll have a play with that so i learn to understand it and yes i can see what your point is there on the ||'s only really need the one because if there isn't 3 options typed or even 4 options <br>it will always fail, but still need to check the others for stuff in them hehe nice one for pointing that out.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5811">Damnation85</a> — Fri Jan 07, 2005 3:54 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2005-01-07T16:10:27-04:00</updated>

		<published>2005-01-07T15:50:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=45161#p45161</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=45161#p45161"/>
		<title type="html"><![CDATA[String matching]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=45161#p45161"><![CDATA[
'arg' contains the unmodified user input at this point...<div class="codebox"><p>Code: </p><pre><code>if {[scan $arg %s%s%s%s a b c d]!=4} {error}</code></pre></div>or<div class="codebox"><p>Code: </p><pre><code>set arg [split $arg]if {[llength $arg]&lt;4} {error}foreach {a b c d} $arg break;# creates the four variables (to match the result of the previous example)</code></pre></div>Your expression with the ||'s could be improved by reversing it (as the first word is always empty when the last one is etc.. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br>What's the purpose of your matches array? Why don't you use svbot directly?<br><br>EDIT: i need some rest <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"> screwed up the order of arguments in the scan <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=2878">user</a> — Fri Jan 07, 2005 3:50 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Damnation85]]></name></author>
		<updated>2005-01-07T15:49:15-04:00</updated>

		<published>2005-01-07T15:49:15-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=45160#p45160</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=45160#p45160"/>
		<title type="html"><![CDATA[String matching]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=45160#p45160"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code> if { ![string is int $level] } {  array set matches {chanvoice chanvoice chanop chanop chanmaster chanmaster chanowner chanowner}  if {[info exists matches($level)]} {   puthelp "NOTICE $nick :Its: $svbot($matches($level))"   set level $svbot($matches($level))   puthelp "NOTICE $nick :Its: $level"   return 0  } else {   puthelp "NOTICE $nick :ERROR: Invalid command level"   return 0  } }</code></pre></div>that seems to work, is there a better way tho?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5811">Damnation85</a> — Fri Jan 07, 2005 3:49 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Damnation85]]></name></author>
		<updated>2005-01-07T15:43:23-04:00</updated>

		<published>2005-01-07T15:43:23-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=45158#p45158</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=45158#p45158"/>
		<title type="html"><![CDATA[String matching]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=45158#p45158"><![CDATA[
will try what u just stated in 1 sec the arg is created via 2 ways <br><br>public command <br><br>adduser user host level<br><br>or msg <br><br>adduser chan user host level<br><br>although i asked a stupid damn question just not i don't need to check the if integer or not i just need to let it through on the integer and if its a string to make sure it matches one of the elements in the array if it doesn't send a error output to the user then return. <br><br>or at least thats what i think....<br><br>would like your input tho<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5811">Damnation85</a> — Fri Jan 07, 2005 3:43 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2005-01-07T15:40:26-04:00</updated>

		<published>2005-01-07T15:40:26-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=45157#p45157</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=45157#p45157"/>
		<title type="html"><![CDATA[String matching]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=45157#p45157"><![CDATA[
Where/how is the list $arg created?<br>To check for integers, use 'string is int $level' (since you check if it's empty first you don't need the -strict option)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Fri Jan 07, 2005 3:40 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Damnation85]]></name></author>
		<updated>2005-01-07T15:25:37-04:00</updated>

		<published>2005-01-07T15:25:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=45154#p45154</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=45154#p45154"/>
		<title type="html"><![CDATA[String matching]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=45154#p45154"><![CDATA[
i don't know if this was the correct way but it works at least. <div class="codebox"><p>Code: </p><pre><code> set level [lindex $arg 3]  if {[lindex $arg 0] == "" || [lindex $arg 1] == "" || [lindex $arg 2] == "" || [lindex $arg 3] == ""} {  puthelp "NOTICE $nick :Format: /msg &lt;BOTNICK&gt; ADDUSER \00315&lt;#CHANNEL&gt; \00312&lt;USER&gt; \00303&lt;HOST&gt; \00307&lt;LEVEL&gt;\003"  puthelp "NOTICE $nick :Example: /msg $botnick ADDUSER\00315 $chan \00312Damnation \00303Damnation@The-Damned.net \003071000\003"  return 0 }  array set matches {chanvoice chanvoice chanop chanop chanmaster chanmaster chanowner chanowner}  if {[info exists matches($level)]} {  puthelp "NOTICE $nick :Its: $svbot($matches($level))" } else {  puthelp "NOTICE $nick :ERROR: Invaild command level"  return 0 }</code></pre></div>the ||'s in the ifs is there a more efficient way to do that ? <br><br>and the snippet you left works wonders (theres a set svbot(chanvoice) etc etc at the top of the code as a global) <br><br>i was just wonder ok so the user puts in the word but whatif the user places in a integer. is there a check for strings/integers? (looks at docs to see and patiently awaits a answer)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5811">Damnation85</a> — Fri Jan 07, 2005 3:25 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Damnation85]]></name></author>
		<updated>2005-01-07T14:46:56-04:00</updated>

		<published>2005-01-07T14:46:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=45148#p45148</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=45148#p45148"/>
		<title type="html"><![CDATA[String matching]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=45148#p45148"><![CDATA[
nothing really i sorta worked out the answer to the string/integ problem as i wrote the post. <br><br>although your method looks cleaner than mine i think i might toy with that a little thank you for that example<br><br>and <br>thank you for the trivia part they both make perfect sense. i am quite enjoying coding in tcl. very straight forward. quite nice to code. <br><br>i'd be expecting more posts from a lil old newbie like me <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_surprised.gif" width="15" height="15" alt=":o" title="Surprised">) <br><br>thanx for all your help so far. to all of you.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5811">Damnation85</a> — Fri Jan 07, 2005 2:46 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2005-01-07T14:51:25-04:00</updated>

		<published>2005-01-07T14:20:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=45143#p45143</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=45143#p45143"/>
		<title type="html"><![CDATA[Re: String matching]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=45143#p45143"><![CDATA[
I don't see the connection...what's the translation of the level name to level number got in common with matching answers in a trivia script?<br>For the level thing:<div class="codebox"><p>Code: </p><pre><code>array set s2i {chanvoice 100 chanop 200}# let's pretend you've got the level name from the request stored in 'lev'...if {[info exists s2i($lev)]} {  # valid level name... $s2i($lev) is the number} else {  # invalid (unknown) level name}</code></pre></div>Answer matching:<div class="codebox"><p>Code: </p><pre><code>if {[string equal -nocase $theAnswer $userInput]} {  # correct} else {  # wrong}</code></pre></div>EDIT: code typo<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Fri Jan 07, 2005 2:20 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Damnation85]]></name></author>
		<updated>2005-01-07T12:08:12-04:00</updated>

		<published>2005-01-07T12:08:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=45135#p45135</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=45135#p45135"/>
		<title type="html"><![CDATA[String matching]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=45135#p45135"><![CDATA[
Hello once again....<br><br>i am coding a adduser code for my bot and the commands being set of levels <br><br>ie 100 <br>250 <br>etc etc<br><br>but i also want to assign these levels to wordss like chanvoice etc<br><br>i want to know whats the most efficient way of doing this so when a staff member types<br><br>/msg &lt;botnick&gt; adduser &lt;chan&gt; &lt;user&gt; &lt;host&gt; chanvoice<br><br>it adds the user to the bot with the predefined level that chanvoice matches. <br><br>also i want to know this as i plan to do a trivia extension to my bot and i want it to match the answers. <br><br>i heard of regexp should i use that?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5811">Damnation85</a> — Fri Jan 07, 2005 12:08 pm</p><hr />
]]></content>
	</entry>
	</feed>
