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

	<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-12-26T19:25:18-04:00</updated>

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

		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2005-12-26T19:25:18-04:00</updated>

		<published>2005-12-26T19:25:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58689#p58689</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58689#p58689"/>
		<title type="html"><![CDATA[Different bot responses on private and public channels]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58689#p58689"><![CDATA[
<blockquote class="uncited"><div>Thanks demond, a little bit of re-organising in my script, adding your suggestion and now it all works as i wanted  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> <br><br>Re: "-nocase"<br><br>do i just add this inline like...<br><div class="codebox"><p>Code: </p><pre><code>if {[string compare -nocase $chan #somechannel] == 0} { </code></pre></div>or somewhere else?</div></blockquote>check out Tcl docs ("manpage") for [string] command at tcl.tk website<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Mon Dec 26, 2005 7:25 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ehlanna]]></name></author>
		<updated>2005-12-26T18:34:25-04:00</updated>

		<published>2005-12-26T18:34:25-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58687#p58687</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58687#p58687"/>
		<title type="html"><![CDATA[Different bot responses on private and public channels]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58687#p58687"><![CDATA[
It may be just me (that or it's my paranoia) but you may want to do something with your $extra field in the way of quoting things like apostrophes, ec., in the input.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6506">Ehlanna</a> — Mon Dec 26, 2005 6:34 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Reserve]]></name></author>
		<updated>2005-12-26T16:25:00-04:00</updated>

		<published>2005-12-26T16:25:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58685#p58685</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58685#p58685"/>
		<title type="html"><![CDATA[Different bot responses on private and public channels]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58685#p58685"><![CDATA[
Thanks demond, a little bit of re-organising in my script, adding your suggestion and now it all works as i wanted  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> <br><br>Re: "-nocase"<br><br>do i just add this inline like...<br><div class="codebox"><p>Code: </p><pre><code>if {[string compare -nocase $chan #somechannel] == 0} { </code></pre></div>or somewhere else?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6109">Reserve</a> — Mon Dec 26, 2005 4:25 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2005-12-26T13:37:02-04:00</updated>

		<published>2005-12-26T13:37:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58678#p58678</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58678#p58678"/>
		<title type="html"><![CDATA[Different bot responses on private and public channels]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58678#p58678"><![CDATA[
[string compare] returns 0 if the strings are identical, otherwise 1 or -1; so you need to change your <em class="text-italics">if</em>'s to:<div class="codebox"><p>Code: </p><pre><code>if {[string compare $chan #somechannel] == 0} {# do stuff for that channel}</code></pre></div>you might also want to include <em class="text-italics">-nocase</em> option for [string] command, for case-insensitive comparison<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Mon Dec 26, 2005 1:37 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Reserve]]></name></author>
		<updated>2005-12-26T13:00:34-04:00</updated>

		<published>2005-12-26T13:00:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58674#p58674</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58674#p58674"/>
		<title type="html"><![CDATA[Different bot responses on private and public channels]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58674#p58674"><![CDATA[
Ive searched and seen several questions about this kind of thing but with my limited tcl skills i just cant seem to get it working on my bot.<br><br>My bot sits in a private channel for gameserver admins and several public channels including a public channel for gameserver players. I want to use the same trigger in different channels but the responses will be different depending on what channel the trigger was called from.<br><br>In its current form, the trigger is <div class="codebox"><p>Code: </p><pre><code>!link &lt;arg&gt;</code></pre></div> the bot then compares the arg to a sql table and if a match for &lt;arg&gt; is found then a url is sent as a notice to the user that called the trigger.<br><br>My current script is as follows<br><div class="codebox"><p>Code: </p><pre><code>bind pub - !link pub_linkproc pub_link {nick host hand chan arg} {    if {[string compare $chan #admin-channel]} {      return    }    global mysql    if {[llength $arg] &lt; 1} then {        putquick "NOTICE $nick : You might want to tell me what link you want to look for....."        return    }set extra [lindex $arg 0]    mysqlsel $mysql "SELECT trigger,link,details from irc_bot_links where trigger='$extra'"    set mycount [mysqlresult $mysql rows?]    mysqlmap $mysql {trigger link details} {putquick "NOTICE $nick :$link - $details"    }    if {$mycount == 0} {    putquick "NOTICE $nick : No URL found for link $extra, for a list of links type !links"    }}</code></pre></div>What im trying to do is something like..<br><div class="codebox"><p>Code: </p><pre><code>bind pub - !link pub_linkproc pub_link {nick host hand chan arg} {    if {[string compare $chan #admin-channel]} {      return    }    global mysql    if {[llength $arg] &lt; 1} then {        putquick "NOTICE $nick : You might want to tell me what link you want to look for....."        return    }set extra [lindex $arg 0]    mysqlsel $mysql "SELECT trigger,link,details from irc_bot_links where trigger='$extra' and status='private'"    set mycount [mysqlresult $mysql rows?]    mysqlmap $mysql {trigger link details} {putquick "NOTICE $nick :$link - $details"    }    if {$mycount == 0} {    putquick "NOTICE $nick : No URL found for link $extra, for a list of links type !links"    }   elseif {[string compare $chan #public-channel]} {      return    }    global mysql    if {[llength $arg] &lt; 1} then {        putquick "NOTICE $nick : You might want to tell me what link you want to look for....."        return    }set extra [lindex $arg 0]    mysqlsel $mysql "SELECT trigger,link,details from irc_bot_links where trigger='$extra' and status='public'"    set mycount [mysqlresult $mysql rows?]    mysqlmap $mysql {trigger link details} {putquick "NOTICE $nick :$link - $details"    }    if {$mycount == 0} {    putquick "NOTICE $nick : No URL found for link $extra, for a list of links type !links"    }  }}</code></pre></div>I cant seem to figure out how to achieve this, the above example doest work. Ive tried putting the if chan and elseif commands in various places but at best only get the script to work in one of the channels.<br><br>Can anyone offer any help or suggestions?<br><br>Regards<br><br>Reserve<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6109">Reserve</a> — Mon Dec 26, 2005 1:00 pm</p><hr />
]]></content>
	</entry>
	</feed>
