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

	<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>2012-05-23T13:27:24-04:00</updated>

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

		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2012-05-23T13:27:24-04:00</updated>

		<published>2012-05-23T13:27:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99452#p99452</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99452#p99452"/>
		<title type="html"><![CDATA[see if a number was entered]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99452#p99452"><![CDATA[
Or like this:<div class="codebox"><p>Code: </p><pre><code>proc isnumber {nick uhost hand chan text} {if {![scan $text {%d} number]} {        puthelp "PRIVMSG #kesh :I got a number"    } else {        puthelp "PRIVMSG #kesh :That was not a number"    }}</code></pre></div>that will work for a decimal integer. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>Anyway, that regexp dose a better job as it returns 1 only if the $text is a valid number without any spaces before or after a valid decimal integer number.<div class="codebox"><p>Code: </p><pre><code>% set text "1 "1% string is integer -strict $text1</code></pre></div>notice the space after 1.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Wed May 23, 2012 1:27 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[doggo]]></name></author>
		<updated>2012-05-23T12:44:11-04:00</updated>

		<published>2012-05-23T12:44:11-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99450#p99450</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99450#p99450"/>
		<title type="html"><![CDATA[see if a number was entered]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99450#p99450"><![CDATA[
another way id use cuz i hate regexps <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><div class="codebox"><p>Code: </p><pre><code>proc isnumber {nick uhost hand chan text} {     set text [split $text]     set fbid [lindex $text 1]     if {[string is integer -strict $fbid] == 0 } {         putquick "PRIVMSG #kesh :That was not a number "    } else {          putquick "PRIVMSG #kesh :I got a number "    } } </code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11046">doggo</a> — Wed May 23, 2012 12:44 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2012-05-04T00:35:52-04:00</updated>

		<published>2012-05-04T00:35:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99332#p99332</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99332#p99332"/>
		<title type="html"><![CDATA[see if a number was entered]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99332#p99332"><![CDATA[
<blockquote class="uncited"><div>% set text "bla"<br>foo<br>% regexp {^[0-9]+$} $text<br>0<br>% set text "bla 1"<br>foo 1<br>% regexp {^[0-9]+$} $text<br>0<br>% set text "1"<br>1<br>% regexp {^[0-9]+$} $text<br>1<br>% set text "1 "<br>1<br>% regexp {^[0-9]+$} $text<br>0</div></blockquote>as you can notice the regexp will return 1 only when the $text variable only contains a number without spaces.<br><br>The <em class="text-italics">fbid</em> is the second argument in your -check command. Do you give it two arguments or just one? If just one then replace 1 with 0 in the <em class="text-italics">set fbid</em> line.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Fri May 04, 2012 12:35 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[err0r]]></name></author>
		<updated>2012-05-03T16:12:30-04:00</updated>

		<published>2012-05-03T16:12:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99330#p99330</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99330#p99330"/>
		<title type="html"><![CDATA[see if a number was entered]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99330#p99330"><![CDATA[
i continue to get ,,,, that was not a number ....<br>what can be wrong ?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11976">err0r</a> — Thu May 03, 2012 4:12 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2012-05-03T00:38:37-04:00</updated>

		<published>2012-05-03T00:38:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99324#p99324</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99324#p99324"/>
		<title type="html"><![CDATA[see if a number was entered]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99324#p99324"><![CDATA[
That regexp is not good as it will return 0 cos of ^ and without it would return 1 if string has a number from 0 to 9 in it, else will return 1 cos of ^ and without it would return 0 if there isn't a number from 0 to 9 in it. To make it work only when only a number from 0 to 9 is found this will do it:<div class="codebox"><p>Code: </p><pre><code>regexp {^[0-9]+$} $string</code></pre></div>so your code will be:<div class="codebox"><p>Code: </p><pre><code>proc isnumber {nick uhost hand chan text} {    set text [split $text]    set fbid [lindex $text 1]    if {[regexp {^[0-9]+$} $fbid]} {        putquick "PRIVMSG #kesh :I got a number "    } else {        putquick "PRIVMSG #kesh :That was not a number "    }}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Thu May 03, 2012 12:38 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[err0r]]></name></author>
		<updated>2012-05-02T18:09:22-04:00</updated>

		<published>2012-05-02T18:09:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99323#p99323</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99323#p99323"/>
		<title type="html"><![CDATA[see if a number was entered]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99323#p99323"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>bind pub - -check isnumberproc isnumber { nick host hand chan text} {set text [split $text]set fbid [lindex $text 1]if ([isnum $fbid]) {putquick "PRIVMSG #kesh :I got a number "  } else {putquick "PRIVMSG #kesh :That was not a number "          }}proc isnum {string} {if {([string compare $string ""]) &amp;&amp; (![regexp {[^0-9]} $string])} then {return 1};return 0}</code></pre></div>I have tried this, but never seems to pick up a number, any help please ?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11976">err0r</a> — Wed May 02, 2012 6:09 pm</p><hr />
]]></content>
	</entry>
	</feed>
