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

	<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-07-12T13:47:36-04:00</updated>

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

		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2012-07-12T13:47:36-04:00</updated>

		<published>2012-07-12T13:47:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99721#p99721</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99721#p99721"/>
		<title type="html"><![CDATA[combining if text]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99721#p99721"><![CDATA[
In tcl, that would be something along these lines:<div class="codebox"><p>Code: </p><pre><code>if {test} {  code if test is TRUE} {  code if test is FALSE}</code></pre></div>In order to do string comparisons, the simplest approach would be to use the <strong class="text-strong">string</strong> command with the <strong class="text-strong">match</strong> option:<div class="codebox"><p>Code: </p><pre><code>string match "*.id" $text</code></pre></div>In order to evaluate and test the string match command, we need to use command substitutions, which is done using brackets [ ]<br><div class="codebox"><p>Code: </p><pre><code>if {[string match "*.id" $text]} {  ...} {  ...}</code></pre></div>Printing text to stdout is done using the <strong class="text-strong">puts</strong> command, though that won't make much sense with eggdrops. In order to send text to the irc server, you can use the <strong class="text-strong">puthelp</strong> and <strong class="text-strong">putserv</strong> commands; if you'd rather like to log the message, use <strong class="text-strong">putlog</strong> for that:<br><div class="codebox"><p>Code: </p><pre><code>if {[string match "*.id" $text]} {  puthelp "PRIVMSG #Somechannel :The string \"${text}\" matches!"} {  putlog "The string \"${text}\" does not match the test!"}</code></pre></div>Next, in order to use this with a public trigger, we need a binding, and place the above code in a proc:<br><div class="codebox"><p>Code: </p><pre><code>bind pub !whois - pubWhoisproc pubWhois {nick host handle channel text} {  if {[string match "*.id" $text]} {    puthelp "PRIVMSG #Somechannel :The string \"${text}\" matches!"  } {    putlog "The string \"${text}\" does not match the test!"  }}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Thu Jul 12, 2012 1:47 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[gembels]]></name></author>
		<updated>2012-07-12T05:38:58-04:00</updated>

		<published>2012-07-12T05:38:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99720#p99720</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99720#p99720"/>
		<title type="html"><![CDATA[combining if text]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99720#p99720"><![CDATA[
hi,<br><br>How to make <br><br>if ($text = *.id) { echo x } else { echo z }; in tcl ?<br><br>everyting they do !whois domain.id go to first x and else goto z<br><br>thanks<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12028">gembels</a> — Thu Jul 12, 2012 5:38 am</p><hr />
]]></content>
	</entry>
	</feed>
