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

	<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>2002-10-17T07:56:59-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Weirdo]]></name></author>
		<updated>2002-10-17T07:56:59-04:00</updated>

		<published>2002-10-17T07:56:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12067#p12067</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12067#p12067"/>
		<title type="html"><![CDATA[Reading from a Text file for a Rules Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12067#p12067"><![CDATA[
Absolutely no problem at all. You are doing a great job helping me here <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=1195">Weirdo</a> — Thu Oct 17, 2002 7:56 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tainted]]></name></author>
		<updated>2002-10-17T06:25:06-04:00</updated>

		<published>2002-10-17T06:25:06-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12057#p12057</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12057#p12057"/>
		<title type="html"><![CDATA[Reading from a Text file for a Rules Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12057#p12057"><![CDATA[
It might, if not then you would need to check a var right when its triggered, and if that var matches (IE the script is not curently processing a request) set it to the 'in progress' value. If the script is 'in progress' you could either A) queue it (a bit trickier to code) or B) Just reject it. After the close brace for the while statement you can set the var back to its origional (ready to reply to rules requests) value. Although, none of this may be nessesary unless your rule list is extremely long. The whole process is completed rather quickly, and the notices are sent to the bot's queue while they are being sent out I believe. I would provide a code example, but it's 5:30am.  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_surprised.gif" width="15" height="15" alt=":o" title="Surprised"><br><br>-Sorry about that missing close brace. Third edit from massive typos..  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_rolleyes.gif" width="15" height="15" alt=":roll:" title="Rolling Eyes"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1256">tainted</a> — Thu Oct 17, 2002 6:25 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Weirdo]]></name></author>
		<updated>2002-10-17T06:10:28-04:00</updated>

		<published>2002-10-17T06:10:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12056#p12056</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12056#p12056"/>
		<title type="html"><![CDATA[Reading from a Text file for a Rules Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12056#p12056"><![CDATA[
thats why it was giving me the close brace crap  and crashing the bot before, AAAAAH <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>And works perfectly <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>Will this still work if more than two people do it at a time?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1195">Weirdo</a> — Thu Oct 17, 2002 6:10 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Papillon]]></name></author>
		<updated>2002-10-17T06:06:25-04:00</updated>

		<published>2002-10-17T06:06:25-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12055#p12055</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12055#p12055"/>
		<title type="html"><![CDATA[Reading from a Text file for a Rules Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12055#p12055"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>while {![eof $rulefile] {</code></pre></div>should be<div class="codebox"><p>Code: </p><pre><code>while {![eof $rulefile]} {</code></pre></div>u just forgot a }<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=852">Papillon</a> — Thu Oct 17, 2002 6:06 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Weirdo]]></name></author>
		<updated>2002-10-17T06:01:38-04:00</updated>

		<published>2002-10-17T06:01:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12054#p12054</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12054#p12054"/>
		<title type="html"><![CDATA[Reading from a Text file for a Rules Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12054#p12054"><![CDATA[
I get wrong number of args for that<br><br>According to the bot... should be "While test command"<br><br>Have no idea what its going on about <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><br><div class="codebox"><p>Code: </p><pre><code>set runchan "#weirdo"bind pub - !rules2 pub:chanrule2proc pub:chanrule2 { nick host hand chan text} {global runchan rulefile if {$chan != $runchan} {return 0} if {[file exists text/rules.file]} {set rulefile [open text/rules.file r]while {![eof $rulefile] {catch {set ruletext [gets $rulefile]}putserv "Notice $nick :$ruletext"}catch {close $rulefile}}}}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1195">Weirdo</a> — Thu Oct 17, 2002 6:01 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tainted]]></name></author>
		<updated>2002-10-17T05:32:38-04:00</updated>

		<published>2002-10-17T05:32:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12053#p12053</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12053#p12053"/>
		<title type="html"><![CDATA[Reading from a Text file for a Rules Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12053#p12053"><![CDATA[
try adding something similiar to this:<div class="codebox"><p>Code: </p><pre><code>        set blah1 [open "/path/to/rules.txt" r]                while {![eof $blah1]} {                        catch {set blah2 [gets $blah1]}                        putserv etc etc etc</code></pre></div>Make sure you also include the following somewhere after you are done with the file.<div class="codebox"><p>Code: </p><pre><code>catch {close $blah1}</code></pre></div>Hope that sends you in the right direction.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1256">tainted</a> — Thu Oct 17, 2002 5:32 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Weirdo]]></name></author>
		<updated>2002-10-17T05:28:48-04:00</updated>

		<published>2002-10-17T05:28:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12052#p12052</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12052#p12052"/>
		<title type="html"><![CDATA[Reading from a Text file for a Rules Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12052#p12052"><![CDATA[
<blockquote class="uncited"><div>[10:28:13] &lt;Weirdo&gt; !rules2<br>[10:28:15] -Minako- General Member Ruleset for #Cometanime - Amendment 1.3 - 8/10/2002 </div></blockquote>On production of the trigger, i got this response from the bot. 1 line out of the 15 in the file. It does this even with the 1000 byte thingy removed from the read command. So, how do i split it up, so it will read each line, and send them in the notice?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1195">Weirdo</a> — Thu Oct 17, 2002 5:28 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2002-10-17T05:19:29-04:00</updated>

		<published>2002-10-17T05:19:29-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12051#p12051</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12051#p12051"/>
		<title type="html"><![CDATA[Reading from a Text file for a Rules Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12051#p12051"><![CDATA[
If you havn't do any other seek, or gets commands, then it will automaticaly so this.<br><br>When you open a file, the seek pointer is set to the start of the file. If you use read straight away, then you will read from begining to end.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Thu Oct 17, 2002 5:19 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Weirdo]]></name></author>
		<updated>2002-10-17T05:12:06-04:00</updated>

		<published>2002-10-17T05:12:06-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12048#p12048</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12048#p12048"/>
		<title type="html"><![CDATA[Reading from a Text file for a Rules Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12048#p12048"><![CDATA[
How do you get it to read from the Start of the File to the End of the file?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1195">Weirdo</a> — Thu Oct 17, 2002 5:12 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2002-10-17T05:08:49-04:00</updated>

		<published>2002-10-17T05:08:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12047#p12047</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12047#p12047"/>
		<title type="html"><![CDATA[Reading from a Text file for a Rules Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12047#p12047"><![CDATA[
Yes, there are a few issues to point out, regarding the script.<br><div class="codebox"><p>Code: </p><pre><code>set runchan "#weirdo" bind pub - !rules2 pub:chanrule2 proc pub:chanrule2 { nick host hand chan text} {    global runchan rulefile ruletext    if {$chan != $runchan} {return 0}    if {![file exists text/rules.file]} {       set rulefile [open text/rules.file r]       set ruletext [read $rulefile 1000]       close $rulefile    }    putserv "Notice $nick :$ruletext" }</code></pre></div>First, the "putserv" command is triggered, even if the file does not exist.<br><br>Second, you have set the "ruletext" variable global. There is no need to do this, unless you have a need to access the variable outside of the script.<br><br>Third, you use the "read" command to read the file. This will read from the current position int he file (you can be located at any point other than the start) up to the end of output (in the case of a file, the end of it). This includes any newline characters (ie, the start of the next line in the file). When outputing this to a IRC server, it will display only the first line, because IRC server interpret the newline as the end of the current command, then treats the next line, as a whole new command (which causes an error).<br><br>You need to split the output into chunks, in needed.<br><br>And lastly, the main cuase of the problem <div class="codebox"><p>Code: </p><pre><code>if {![file exists text/rules.file]} {</code></pre></div>This states, if the file does not exist, read the file (contradiction of statments).<br><br>Simply remove the !.<br><br>You should then move the putserv within the IF block, so it is only tirggered if the file exists (AKA, only tigger if data is available).<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Thu Oct 17, 2002 5:08 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Weirdo]]></name></author>
		<updated>2002-10-17T04:22:56-04:00</updated>

		<published>2002-10-17T04:22:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12046#p12046</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12046#p12046"/>
		<title type="html"><![CDATA[Reading from a Text file for a Rules Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12046#p12046"><![CDATA[
This is my code<br><div class="codebox"><p>Code: </p><pre><code>et runchan "#weirdo"bind pub - !rules2 pub:chanrule2proc pub:chanrule2 { nick host hand chan text} {global runchan rulefile ruletextif {$chan != $runchan} {return 0} if {![file exists text/rules.file]} {set rulefile [open text/rules.file r]set ruletext [read $rulefile 1000]close $rulefile }putserv "Notice $nick :$ruletext"}</code></pre></div>What its supposed to do is to read the rules text file, and copy it, then deliver it to the person who activated the trigger. Problem is, it doesnt recognise ruletext as a variable, an so it dont work. Can anyone help me?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1195">Weirdo</a> — Thu Oct 17, 2002 4:22 am</p><hr />
]]></content>
	</entry>
	</feed>
