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

	<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>2008-05-15T20:26:50-04:00</updated>

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

		<entry>
		<author><name><![CDATA[eXcel]]></name></author>
		<updated>2008-05-15T20:26:32-04:00</updated>

		<published>2008-05-15T20:26:32-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=82928#p82928</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=82928#p82928"/>
		<title type="html"><![CDATA[[SOLVED]Taking 3 Variables and merging to one]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=82928#p82928"><![CDATA[
Wow, thank you alot. Not only did you fix my problem you explained what my errors were. Thank you very much it was a good learning experience for me <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=9892">eXcel</a> — Thu May 15, 2008 8:26 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2008-05-14T21:37:40-04:00</updated>

		<published>2008-05-14T21:37:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=82922#p82922</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=82922#p82922"/>
		<title type="html"><![CDATA[[SOLVED]Taking 3 Variables and merging to one]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=82922#p82922"><![CDATA[
Where should we start, let's choose the obvious.<div class="codebox"><p>Code: </p><pre><code>proc topic_set { chan nick } { </code></pre></div>Why have u omitted things, and instead generalized the parameter declarations? These are static. You cannot arbitrarily choose what to receive, as doing so destroys symbolic correlation. Change it to look like the code below:<div class="codebox"><p>Code: </p><pre><code>proc topic_set {nick uhost hand chan arg} {</code></pre></div>You must also make the changes noted below. Since you bound this procedure to the public using <em class="text-italics">bind pub o|o .updatetopic topic_set</em>, this is no longer a sub-procedure. I can also see why the parameter declarations above appear incorrect. This public binding to .updatetopic is the 'new addition', thereby corrupting parameter passing whenever it is used. Correcting this involves matching parameter ordering to the binding arguments.<div class="codebox"><p>Code: </p><pre><code>change all occurrences of:topic_set $chan $nickinto:topic_set $nick $uhost $hand $chan $arg</code></pre></div>This corrects the problem with flawed argument/parameter passing, now we move onto the problem you will have next, concerning your variable assignments.<div class="codebox"><p>Code: </p><pre><code>#CSset topic_cs [open /home/crave/irc/cravebot/scripts/cstopics.log r]set info_topiccs [read $topic_cs]close $topic_cs#CSSset topic_css [open /home/crave/irc/cravebot/scripts/csstopics.log r]set info_topiccss [read $topic_cs]close $topic_css#h3set topic_h3 [open /home/crave/irc/cravebot/scripts/h3topics.log r]set info_topich3 [read $topic_h3]close $topic_h3 </code></pre></div>The above methods are problematic because your reading entire files into these variables. This induces newlines, carriage returns, etc which become enmeshed into the variable and when interpreted/messaged by the eggdrop signals the terminatation of that line. Meaning, anything your trying to display that is beyond one of those beauties is therefore made null and unprintable. You will need to use the code below to solve this if it becomes a problem, as <em class="text-italics">foreach line [split $text \n]</em> cannot be used because the topic must fit within one line.<div class="codebox"><p>Code: </p><pre><code>set fulltopic "[join $info_topiccss], [join $info_topiccs], [join $info_topich3]"regsub -all {(?:\n|\r|\t|\v)} $fulltopic "" fulltopicputserv "privmsg chanserv :topic $chan $fulltopic"putserv "notice $nick :Updated Topic" </code></pre></div>The above uses a regsub to remove those things...You can substitute "gets" for "read" as I've shown below for the h3 procedure, this will make the regsub unnecessary.<div class="codebox"><p>Code: </p><pre><code>set info_topich3 [gets $topic_h3]</code></pre></div>Gets behaves differently than read, as get only reads the next line from the file given by fileId and discards the terminating newline character.<br><br>Next up is this issue of curly bracing and other special tcl characters being written to the file which could throw tcl errors. This is the reason for "<em class="text-italics">set fulltopic "[join $info_topiccss], [join $info_topiccs], [join $info_topich3]"</em>. The joins are needed to return from the splits we will be using below.<div class="codebox"><p>Code: </p><pre><code>set topic $argputs $h3topic $topicclose $h3topic </code></pre></div>Change all the above references in all 3 procedures (css,cs,h3) to resemble what I have below, keeping in mind this simply corrects h3. Obviously changes will need to be made for variable names to apply this to css and cs.<div class="codebox"><p>Code: </p><pre><code>puts $h3topic [split $arg]close $h3topic </code></pre></div>Splitting allows you an extra layer of security if malicious users decide to 'test' the strength of the scripting by giving it senseless symbols and random characters as input. Split guarantees issue free performance, instead of crashing you bot these users will just look silly. Combined, all the above steps should rectify your issues.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Wed May 14, 2008 9:37 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[eXcel]]></name></author>
		<updated>2008-05-14T21:31:13-04:00</updated>

		<published>2008-05-14T21:31:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=82921#p82921</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=82921#p82921"/>
		<title type="html"><![CDATA[[SOLVED]Taking 3 Variables and merging to one]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=82921#p82921"><![CDATA[
Hmm, Well I tried that but still.<br><br><br>Heres what i have<br><div class="codebox"><p>Code: </p><pre><code># MULTICLAN BOT V1 SCRIPTS ## TOPIC SETUP SCRIPT #bind pub o|o .csnews topic_cschangebind pub o|o .cssnews topic_csschangebind pub o|o .h3news topic_h3changebind pub o|o .updatetopic topic_setproc topic_cschange { nick uhost hand chan arg } {set cstopic [open /home/crave/irc/cravebot/scripts/cstopics.log w]set topic $argputs $cstopic $topicclose $cstopicputserv "NOTICE $nick :CS Topic Changed to $arg"topic_set $chan $nick}proc topic_csschange { nick uhost hand chan arg } {set csstopic [open /home/crave/irc/cravebot/scripts/csstopics.log w]set topic $argputs $csstopic $topicclose $csstopicputserv "NOTICE $nick :CS:S Topic Changed to $arg"topic_set $chan $nick}proc topic_h3change { nick uhost hand chan arg } {set h3topic [open /home/crave/irc/cravebot/scripts/h3topics.log w]set topic $argputs $h3topic $topicclose $h3topicputserv "NOTICE $nick :h3 Topic Changed to $arg"topic_set $chan $nick}proc topic_set { chan nick } {#CSset topic_cs [open /home/crave/irc/cravebot/scripts/cstopics.log r]set info_topiccs [read $topic_cs]close $topic_cs#CSSset topic_css [open /home/crave/irc/cravebot/scripts/csstopics.log r]set info_topiccss [read $topic_cs]close $topic_css#h3set topic_h3 [open /home/crave/irc/cravebot/scripts/h3topics.log r]set info_topich3 [read $topic_h3]close $topic_h3set fulltopic "$info_topiccss, $info_topiccs, $info_topich3" putserv "privmsg chanserv :topic $chan $fulltopic"putserv "NOTICE $nick :Updated Topic"}putlog "Mult-Bots V1.0 by Saurav Pokhrel - Topics Script Loaded -"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9892">eXcel</a> — Wed May 14, 2008 9:31 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2008-05-14T18:47:43-04:00</updated>

		<published>2008-05-14T18:47:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=82920#p82920</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=82920#p82920"/>
		<title type="html"><![CDATA[[SOLVED]Taking 3 Variables and merging to one]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=82920#p82920"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set fulltopic "$info_topiccss, $info_topiccs, $info_topich3"putserv "privmsg chanserv :topic $chan $fulltopic"</code></pre></div><div class="codebox"><p>Code: </p><pre><code>set fulltopic ""append fulltopic $info_topiccssappend fulltopic ", $info_topiccs"append fulltopic ", $info_topich3"putserv "privmsg chanserv :topic $chan $fulltopic"</code></pre></div>Just two of the several ways to combine strings. Both acheiving the same result, same exact contents of $fulltopic.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Wed May 14, 2008 6:47 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[eXcel]]></name></author>
		<updated>2008-05-15T20:26:50-04:00</updated>

		<published>2008-05-14T18:42:03-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=82919#p82919</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=82919#p82919"/>
		<title type="html"><![CDATA[[SOLVED]Taking 3 Variables and merging to one]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=82919#p82919"><![CDATA[
Hello,<br><br>I am trying to get 3 variables to merge to one for chaning a topic.<br><br>I have this<br><div class="codebox"><p>Code: </p><pre><code>set fulltopic $info_topiccss,$info_topiccs,$info_topich3putserv "PRIVMSG ChanServ :topic $chan [set fulltopic]"</code></pre></div>But when I do this I only get the $info_topiccss part and the rest is ignored. How do I get all 3 to be implemented.<br><br>Thanks for your help!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9892">eXcel</a> — Wed May 14, 2008 6:42 pm</p><hr />
]]></content>
	</entry>
	</feed>
