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

	<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>2013-03-19T16:26:08-04:00</updated>

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

		<entry>
		<author><name><![CDATA[LoKii]]></name></author>
		<updated>2013-03-19T16:26:08-04:00</updated>

		<published>2013-03-19T16:26:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101266#p101266</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101266#p101266"/>
		<title type="html"><![CDATA[syntax checking of user input on a public trigger]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101266#p101266"><![CDATA[
Thanks for your insight on this. In this case, i will leave this thread as unsolved for the time being (although in current, it works as expected), and I will try to implement you recommendations. I will leave this part of the entire script to the last, since it seems that this regex will be very time consuming. ( I need to add various regex solutions to another 10 - 20 commands), so i will work on the regex in between as much as time allows and finish off all the non-regex things on my to-do list for now.<br><br>My main goal in this is to get rid of all the escapes, that would indeed make the regex syntax much shorter, and more readable.<br><br>Cheers <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=10917">LoKii</a> — Tue Mar 19, 2013 4:26 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2013-03-19T15:22:28-04:00</updated>

		<published>2013-03-19T15:22:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101265#p101265</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101265#p101265"/>
		<title type="html"><![CDATA[syntax checking of user input on a public trigger]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101265#p101265"><![CDATA[
Looking abit closer at the a|b|cd example, you also accept an empty string with your pattern.<br>That said, I just tested the relevant parts of your code, with my expression, and it works just fine for me.<br><br>Unfortunately, you can't get any error messages as for why your pattern didn't match your string. Regular expressions is a tedious game of trial, frustration, and error.<br><br>A few more remarks anyway;<br>There's no point in creating a bracket expression containing a single character, it just clutters your expression. Bracket expressions is best used to match a range of characters, such as a-z or 0-9.<br>Back references are powerful, but they can make the expression harder to follow. Especially when you place them within a bracket expression.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Mar 19, 2013 3:22 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[LoKii]]></name></author>
		<updated>2013-03-19T14:03:36-04:00</updated>

		<published>2013-03-19T14:03:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101263#p101263</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101263#p101263"/>
		<title type="html"><![CDATA[syntax checking of user input on a public trigger]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101263#p101263"><![CDATA[
<blockquote class="uncited"><div>One hint when working with regular expressions, if you use curly brackets instead of quotes, you don't have to bother with escaping the string from the tcl parser..<br><br>As for your pattern, I find it somewhat overworked. If you merely would like to match either a, b, or cd, this would suffice:<div class="codebox"><p>Code: </p><pre><code>set m {^(a|b|cd)$}</code></pre></div></div></blockquote>I was wandering, why I am the only one on the forums here who actually had to escape almost everything in the string to get it to work, whilst looking at other people's syntax.<br><br>I tried your code, but it doesn't work. As for the error, I'm not sure why not (since the error returned is my custom error). I simply replaced your <strong class="text-strong">set m</strong> with my <strong class="text-strong">set m</strong>.<br><br>How would i go about getting an error message as to <strong class="text-strong">why</strong> your code wont work?<br><br>I sure as hell would not mind to get a shorter version of it working.<br><br>I have applied this test code (the one that I have made) to also work for AllProtection script, as to make some aspects of it public.<br><br>The version I used for the AllProtection was:<br><div class="codebox"><p>Code: </p><pre><code>set pmeth "^\[wk\]?$\|^(k)\[\1b\]$\|^\[w\]:?\[k\]?$\|^\[w\]:?(k)\[\1b\]$\|^\[k\]:?(k)\[\1b\]$\|^\[w\]:?\[k\]:?(k)\[\1b\]$"</code></pre></div>And yes, I would LOVE to find a more elegant/shorter way of getting the same results.<br><br>The goal of this whole regex issue is to make sure that <strong class="text-strong">any</strong> input which would <strong class="text-strong">not</strong> be recognized by the AllProtection script, should be invalid. This is just to make sure that if someone does not understand the syntax that Allprotection wants, that he could not enter something invalid, or even maybe something potentially dangerous, since at the end of the day, it does end up doing a .chanset.<br><br>I just dont get, why whenever i try to avoid escaping characters, nothing works for me  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad"> <br><br>But hey, this is day 3 for me on learning regex. I definately want to get much more involved with regex in general, since it is highly addictive.<br><br>In addition to this, i have also read many opinions here on the forums to maybe try to use <strong class="text-strong">string map</strong> instead of <strong class="text-strong">regexp</strong> for performance. And initially i wanted to avoid using regexp in the first place, thinking i could just add the regex to the <strong class="text-strong">scan</strong>. Didnt work out for me like i had hoped, so i used the regexp solution.<br><br>I definitely will be checking for the <strong class="text-strong">string map</strong> too for other solutions that i am still in the process of working on.<br><br>Cheers.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10917">LoKii</a> — Tue Mar 19, 2013 2:03 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2013-03-19T13:39:49-04:00</updated>

		<published>2013-03-19T13:39:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101262#p101262</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101262#p101262"/>
		<title type="html"><![CDATA[syntax checking of user input on a public trigger]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101262#p101262"><![CDATA[
One hint when working with regular expressions, if you use curly brackets instead of quotes, you don't have to bother with escaping the string from the tcl parser..<br><br>As for your pattern, I find it somewhat overworked. If you merely would like to match either a, b, or cd, this would suffice:<div class="codebox"><p>Code: </p><pre><code>set m {^(a|b|cd)$}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Mar 19, 2013 1:39 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[LoKii]]></name></author>
		<updated>2013-03-19T08:39:52-04:00</updated>

		<published>2013-03-19T08:39:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101261#p101261</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101261#p101261"/>
		<title type="html"><![CDATA[syntax checking of user input on a public trigger]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101261#p101261"><![CDATA[
Small update. Managed to get rid of the problem when repeating some of the chars, such as ccdd ccd cdd and so on.<div class="codebox"><p>Code: </p><pre><code>"^\[ab\]?$\|^\[cd\]{2}$"</code></pre></div>However now, i still have 1 last headache left. I am still able to use <strong class="text-strong">cc</strong> or <strong class="text-strong">dd</strong>. Any suggestions?<br><br><br>//edit<br><br>Ok, i found a full working solution.<br><div class="codebox"><p>Code: </p><pre><code>"^\[ab\]?$\|^(c)\[\1d\]$"</code></pre></div>This version works the way i need it to.<br><br>Now then, is there maybe any recommended cosmetic change to this? Maybe something that makes a difference in performance, or security?<br><br>Below is the entire code that i have so far (with a few changes based on caesar's rewrite).<br><div class="codebox"><p>Code: </p><pre><code>proc test {nick host hand channel text} {    set syntax [lrange [split $text] 0 end]    foreach {1 2 3 4} [split $syntax] {break}    set h "-help"    set o off    set m "^\[ab\]?$\|^(c)\[\1d\]$"    if {$syntax == ""} {        putserv "NOTICE $nick :Missing arguments. Please type \002.test -help\002 for information on how to use this command."        return 1    }    if {[string match -nocase $1 $h]} {        putserv "NOTICE $nick :Set &amp; Activate TEST"        putserv "NOTICE $nick :This is the help description of the command \002test\002."        putserv "NOTICE $nick :usage: .test &lt;num1&gt; &lt;num2&gt; &lt;num3&gt; &lt;modes&gt;"        putserv "NOTICE $nick :example: .test 5 20 5 &lt;a | b | cd&gt;"        putserv "NOTICE $nick : "        putserv "NOTICE $nick :To de-activate TEST type: .test off"        return 1    }    if {[string match -nocase $1 $o]} {        putserv "NOTICE $nick :TEST have been de-activated for channel $channel"        return 1    }    if {([scan $syntax {%d%d%d%s} a b c prefs] != 4) || (![regexp $m $prefs])} {putserv "NOTICE $nick :Invalid or missing arguments. Please type \002.test -help\002 for information on how to use this command."return 1} putserv "NOTICE $nick :Channel TEST features for channel $channel have been set to \002$a $b $c $prefs\002"putserv "NOTICE $nick :In English this means, &lt;num1&gt; = \002$a\002, &lt;num2&gt; = \002$b\002, &lt;num3&gt; = \002$c\002, and finally the &lt;modes&gt; = \002$prefs\002"return 1}</code></pre></div>Please do criticize and make recommendations to what could be better.<br><br>Cheers everyone and thank you all for your help.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10917">LoKii</a> — Tue Mar 19, 2013 8:39 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[LoKii]]></name></author>
		<updated>2013-03-19T04:55:12-04:00</updated>

		<published>2013-03-19T04:55:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101259#p101259</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101259#p101259"/>
		<title type="html"><![CDATA[syntax checking of user input on a public trigger]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101259#p101259"><![CDATA[
<blockquote class="uncited"><div>First off,<br>$1 $2 $3 $modes<br>should be...<br>1 2 3 modes<br>without all the $'s</div></blockquote>Thank you for pointing that out. Thanks to that, the error messages changed in to something that made more sense to me, and i finally figured out how to go about the regex issues i had.<br><br>So, now i managed to get the regex to actually 'do' something.<br><br>To sort out the issue i have now, let us let the regex filter out the following characters: <strong class="text-strong">a b cd</strong><br>My regex so far looks like:<br><div class="codebox"><p>Code: </p><pre><code>"^\[ab(cd)\]?$"</code></pre></div>My issue is, that the <strong class="text-strong">a</strong> or the <strong class="text-strong">b</strong> are identified correctly. However, the <strong class="text-strong">cd </strong>is still messy due to the <strong class="text-strong">?</strong> (limiting it to a single char). if i were to use a <strong class="text-strong">+</strong> instead of a <strong class="text-strong">?</strong>, then the problem is that i can use <strong class="text-strong">cd</strong> / <strong class="text-strong">ccdd</strong> / <strong class="text-strong">cddd</strong> / <strong class="text-strong">cccd</strong> etc....<br><br>In my attempt to seperate the <strong class="text-strong">a</strong> and the <strong class="text-strong">b</strong> from the <strong class="text-strong">cd</strong>, i tried the following (just to give me some play-space for now):<br><div class="codebox"><p>Code: </p><pre><code>"^\[ab\]?$\|^\[cd\]+$"</code></pre></div>In this version, i can limit the <strong class="text-strong">a </strong>and <strong class="text-strong">b</strong> to a single character, however the <strong class="text-strong">cd</strong> can still be fooled by <strong class="text-strong">ccdd</strong> and such variants.<br><br>In the traditional regex (not tcl), a way to fix this would be:<br><div class="codebox"><p>Code: </p><pre><code>"^\[ab(cd)\]?$"</code></pre></div>meaning that I would <strong class="text-strong">group</strong> the <strong class="text-strong">cd</strong> using <strong class="text-strong">()</strong>, but this does not seem to work in TCL for me because the <strong class="text-strong">?</strong> still limits my input to 1 character only, and the <strong class="text-strong">+</strong> allows a surplus of characters.<br><br>Any tips on what I am looking for to fix this?<br><br>Cheers.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10917">LoKii</a> — Tue Mar 19, 2013 4:55 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2013-03-18T11:21:03-04:00</updated>

		<published>2013-03-18T11:21:03-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101256#p101256</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101256#p101256"/>
		<title type="html"><![CDATA[syntax checking of user input on a public trigger]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101256#p101256"><![CDATA[
First off,<br>$1 $2 $3 $modes<br>should be...<br>1 2 3 modes<br>without all the $'s<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Mon Mar 18, 2013 11:21 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[LoKii]]></name></author>
		<updated>2013-03-18T02:15:17-04:00</updated>

		<published>2013-03-18T02:15:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101254#p101254</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101254#p101254"/>
		<title type="html"><![CDATA[syntax checking of user input on a public trigger]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101254#p101254"><![CDATA[
Hello everyone again,<br><br>Hey, no need for arguing about why this method, and not that. All point of views are of interest, since non of your suggestions here have been known to me in the first place. Its nice to see all the possibilities even if some are obsolete or over complicated.<br><br>Ok, back on track. I have read up on various regex solutions. In some extra test code i have tried various approaches using regexp, and others. However, i would like to stick with the scan solution.<br><br>When it comes to the scan solution, non of the regex seems to be applied or work for me (based on what i have read about regex).<br><br>To simplify the process of getting regex to work inside a scan, lets dumb down the 4th argument to just a single character <strong class="text-strong">k</strong>. Later on I can continue to expand the regex rules, once i get this basic one running.<br><br>What i have tried so far, but with no luck whatsoever is:<br><div class="codebox"><p>Code: </p><pre><code>if {[scan $syntax {%d%d%d%[k]} $1 $2 $3 $modes] != 4} {if {[scan $syntax {%d%d%d%[[k]+ $]} $1 $2 $3 $modes] != 4} {if {[scan $syntax {%d%d%d%[(k)+ $]} $1 $2 $3 $modes] != 4} {if {[scan $syntax {%d%d%d%[^[k]+ $]} $1 $2 $3 $modes] != 4} {if {[scan $syntax {%d%d%d%\[k\]+ $} $1 $2 $3 $modes] != 4} {if {[scan $syntax {%d%d%d%[^[k+] ]} $1 $2 $3 $modes] != 4} {</code></pre></div>and many other combinations that I have now forgotten whilst writing this post here.<br><br>Some of the methods I have tried would either return various errors, others would just simply ignore the 4th argument of code totally.<br><br>From my understanding, at least the 1st line should work? <strong class="text-strong">%[k]</strong>. <br><br>From my examples here, what i wish to achieve is to ONLY accept the <strong class="text-strong">k</strong> as a valid entry for the 4<strong class="text-strong">th argument</strong> of the code, and nothing else. I solved more complicated regex quizzes whilst reading about them, but i can not get any regex working with this tcl <strong class="text-strong">scan</strong>.<br><br>What am i missing? I would like to keep the idea of using scan rather than using regexp (which seems to have a performance difference in speed, and most people recommend scan for this type of situation).<br><br><br>caesar, thank you for your code above, I have not got about to trying it yet, as i want to solve the regex issue first, but once that is sorted, i will look into the modifications you have made for the performance issues.<br><br>Cheers everyone <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=10917">LoKii</a> — Mon Mar 18, 2013 2:15 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Get_A_Fix]]></name></author>
		<updated>2013-03-17T20:17:44-04:00</updated>

		<published>2013-03-17T20:17:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101253#p101253</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101253#p101253"/>
		<title type="html"><![CDATA[syntax checking of user input on a public trigger]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101253#p101253"><![CDATA[
<blockquote class="uncited"><div>why the hell should he use [isnum] and make a proc for that since [isnumber] is already in the eggdrop</div></blockquote>Did you notice where I said "Before there was [isnumber] ..." ???<br><br>It was merely an example of how it 'was' achieved in my instance.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6204">Get_A_Fix</a> — Sun Mar 17, 2013 8:17 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2013-03-17T07:50:35-04:00</updated>

		<published>2013-03-17T07:50:35-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101249#p101249</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101249#p101249"/>
		<title type="html"><![CDATA[syntax checking of user input on a public trigger]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101249#p101249"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>proc test {nick host hand channel text} {set syntax [lrange [split $text] 0 end]scan $syntax {%s%s%s%s} 1 2 3 modesset h "-help"set o "off"if {[string match -nocase $1 $h]} {puthelp "NOTICE $nick :Set &amp; Activate TEST"puthelp "NOTICE $nick :This is the help description of the command \002test\002."        puthelp "NOTICE $nick :usage: .test &lt;num1&gt; &lt;num2&gt; &lt;num3&gt; &lt;modes&gt;"        puthelp "NOTICE $nick :example: .test 5 20 5 n:sp"        puthelp "NOTICE $nick Valid modes are sp for sapart, kb for kickban, n for notify"        puthelp "NOTICE $nick :To dectivate TEST type: .test off"        return}if {[string match -nocase $1 $o]} {puthelp "NOTICE $nick :TEST have been de-activated for channel $channel"return}if {![info exists $modes]} {puthelp "NOTICE $nick :Missing arguements. Please type \002.test -help\002 for information on how to use this command."} else {puthelp "NOTICE $nick :Channel TEST features for channel $channel have been set to \002$1 $2 $3 $modes\002"puthelp "NOTICE $nick :In english this means, &lt;num1&gt; = \002$1\002, &lt;num2&gt; = \002$2\002, &lt;num3&gt; = \002$3\002, and finally the &lt;modes&gt; = \002$modes\002"}}</code></pre></div>Haven't tested.  <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> — Sun Mar 17, 2013 7:50 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[LoKii]]></name></author>
		<updated>2013-03-17T04:06:26-04:00</updated>

		<published>2013-03-17T04:06:26-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101247#p101247</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101247#p101247"/>
		<title type="html"><![CDATA[syntax checking of user input on a public trigger]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101247#p101247"><![CDATA[
Well caesar, simply put I didn't even know of it's existence (the scan). Your solution has so far partially helped me a great deal.  Whilst i also did like the solution prestented by <strong class="text-strong">Get_A_Fix</strong>, by using directly <strong class="text-strong">isnumber</strong> instead of <strong class="text-strong">isnum</strong> only for the fact that i could customize the response based on every argument separately, i still chose the scan method, just to keep the code a bit shorter, and also there seems to be a regex support using scan, which does bring me to my next point.<br><br>My next point was to limit the input possibilites to only certain characters &amp; symbols, and using regex seems the right way to go. Now at first i thought of various approaches, as in letting the final argument be either settled by a separate  <strong class="text-strong">if statement</strong> of its own using only regex in there, or if the <strong class="text-strong">scan's regex</strong> would also suffice. ( I guess this shows that I have no idea whatsoever about regex, and all ths stuff i read online just made me stay away from it, for as long as possible). But seeing now that I just simply NEED it whether i like it or not, i had to sit down and find a source that would explain it to me.<br><br>A friend of mine dropped of a book by <strong class="text-strong">O'reilly - Mastering Regular Expressions.</strong> I spent all day yesterday focusing just on that book, reading and I'm literally kicking myself in the a$$ that i did not go into regex earlier in my life. Its the MOST useful thing, and addictive as hell. So i will be solving my last issue once i understand how to perform the regex i need for my particular solution.<br><br>Below is just a small modification of the code. Changed the variable's names a bit for clarity sake, and added <strong class="text-strong">caesar's</strong> scan method. As you can see below, i need to implement the regext at the %s ($modes), so i hope that by tomorrow (after spending all day too to read on regex) that i will have a solution that suits my needs.<br><div class="codebox"><p>Code: </p><pre><code>proc test {nick host hand channel text} {    set syntax [lrange [split $text] 0 end]    set 1 [lindex [split $text] 0]    set 2 [lindex [split $text] 1]    set 3 [lindex [split $text] 2]    set modes [lindex [split $text] 3]    set h "-help"    set o off    if {$syntax == ""} {        putserv "NOTICE $nick :Missing arguements. Please type \002.test -help\002 for information on how to use this command."        return 1    }    if {$1 == $h} {        putserv "NOTICE $nick :Set &amp; Activate TEST"        putserv "NOTICE $nick :This is the help description of the command \002test\002."        putserv "NOTICE $nick :usage: .test &lt;num1&gt; &lt;num2&gt; &lt;num3&gt; &lt;modes&gt;"        putserv "NOTICE $nick :example: .test 5 20 5 n:sp"        putserv "NOTICE $nick : "        putserv "NOTICE $nick Valid modes are sp for sapart, kb for kickban, n for notify"        putserv "NOTICE $nick :To dectivate TEST type: .test off"        return 1    }    if {$1 == $o} {        putserv "NOTICE $nick :TEST have been de-activated for channel $channel"        return 1    }    if {[scan $syntax {%d%d%d%s} $1 $2 $3 $modes] != 4} {putserv "NOTICE $nick :Invalid arguements. Please type \002.test -help\002 for information on how to use this command."return 1}    putserv "NOTICE $nick :Channel TEST features for channel $channel have been set to \002$1 $2 $3 $modes\002"    putserv "NOTICE $nick :In english this means, &lt;num1&gt; = \002$1\002, &lt;num2&gt; = \002$2\002, &lt;num3&gt; = \002$3\002, and finally the &lt;modes&gt; = \002$modes\002"    return 1}</code></pre></div>Many thanks to everyone here for their great help and support.<br><br>I will post the final code once it works.<br><br>In the mean time, maybe someone could give me an opinion on performance issues based on how I wrote that code in general? I don't like that i use so many lines for <strong class="text-strong">set</strong>. Maybe there is a more elegant way to go about this? (Would be nice to adapt more elegant approaches from now to avoid bad habits, rather than having to cut bad habits later on.<br><br>Cheers everyone <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=10917">LoKii</a> — Sun Mar 17, 2013 4:06 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[LoKii]]></name></author>
		<updated>2013-03-16T02:50:59-04:00</updated>

		<published>2013-03-16T02:50:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101238#p101238</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101238#p101238"/>
		<title type="html"><![CDATA[syntax checking of user input on a public trigger]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101238#p101238"><![CDATA[
Thank you all for your imput, sorry for my delay in responding. I will sit down today and tackle this with what all of you have proposed here, and I will let you know how it turns out <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=10917">LoKii</a> — Sat Mar 16, 2013 2:50 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2013-03-15T02:30:26-04:00</updated>

		<published>2013-03-15T02:30:26-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101237#p101237</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101237#p101237"/>
		<title type="html"><![CDATA[syntax checking of user input on a public trigger]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101237#p101237"><![CDATA[
Where's $modes variable declared?<br><br>why not use <a href="http://www.tcl.tk/man/tcl8.6/TclCmd/scan.htm" class="postlink">scan</a> instead?<br><br>something like:<div class="codebox"><p>Code: </p><pre><code>if {[scan $text {%d%d%d%s} fist second third last] != 4} {# do whatever as the syntax is not validreturn}# do whatever as syntax is valid</code></pre></div>or if you insist instead of:<div class="codebox"><p>Code: </p><pre><code>    set firstarg [lindex [split $text] 0]    set secondarg [lindex [split $text] 1]    set thirdarg [lindex [split $text] 2] </code></pre></div>a simple scan would do this:<div class="codebox"><p>Code: </p><pre><code>if {[scan {%s%s%s} firstarg secondarg thirdarg] != 3} {# do whatever as the syntax is not validreturn}# do whatever as syntax is valid</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Fri Mar 15, 2013 2:30 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[dirty]]></name></author>
		<updated>2013-03-14T15:35:30-04:00</updated>

		<published>2013-03-14T15:35:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101235#p101235</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101235#p101235"/>
		<title type="html"><![CDATA[syntax checking of user input on a public trigger]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101235#p101235"><![CDATA[
why the hell should he use [isnum] and make a proc for that since [isnumber] is already in the eggdrop<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12189">dirty</a> — Thu Mar 14, 2013 3:35 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Get_A_Fix]]></name></author>
		<updated>2013-03-14T10:57:46-04:00</updated>

		<published>2013-03-14T10:57:46-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101233#p101233</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101233#p101233"/>
		<title type="html"><![CDATA[syntax checking of user input on a public trigger]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101233#p101233"><![CDATA[
Before there was [isnumber] we had [isnum] <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><br><br>Use this method, in the procs<br><div class="codebox"><p>Code: </p><pre><code>proc test {nick host hand channel text} {    set firstarg [lindex [split $text] 0]    set secondarg [lindex [split $text] 1]    set thirdarg [lindex [split $text] 2]    if {![isnum $firstarg]} {putquick "NOTICE $nick :That is not a number. Please type \002.test -help\002 for information on how to use this command."; return}    if {![isnum $secondarg]} {putquick "NOTICE $nick :That is not a number. Please type \002.test -help\002 for information on how to use this command."; return}    if {![isnum $thirdarg]} {putquick "NOTICE $nick :That is not a number. Please type \002.test -help\002 for information on how to use this command."; return}    set help [lindex [split $text] 0]    set h "-help"    set o off    if {$modes == ""} {        putserv "NOTICE $nick :Missing arguements. Please type \002.test -help\002 for information on how to use this command."        return 1    }</code></pre></div>then add this to the last script loaded...<br><div class="codebox"><p>Code: </p><pre><code>proc isnum {string} {  if {[regexp {^-?\d+(\.\d+)?$} $string]} {    return 1;  }  return 0;}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6204">Get_A_Fix</a> — Thu Mar 14, 2013 10:57 am</p><hr />
]]></content>
	</entry>
	</feed>
