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

	<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-11-18T15:29:20-04:00</updated>

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

		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2008-11-18T15:29:20-04:00</updated>

		<published>2008-11-18T15:29:20-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=85870#p85870</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=85870#p85870"/>
		<title type="html"><![CDATA[Strange issues in TCL]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=85870#p85870"><![CDATA[
A few thoughts comes into mind reading your last two posts.<br><blockquote class="uncited"><div>I still noticed that NO expressions or if/else works unless I set those particular varables as a global even if the if statment is still inside the SAME proc as the varable! setting the varable as a global works- even though that varable will NEVER be used outside the proc (isn't that a whaste of resources??) for this reason, I'm cirrently at 46 "global" varables and expect to climb to over 100! (I hope there isn't a LIMIT!)</div></blockquote>Could you post just one example of this. As long as a variable exists within the same instance of a proc <span style="text-decoration:underline">before</span> it is read, there should be no problem. If/else constructs should work independent of variables, as these would be expanded as the whole conditional is simply run through <strong class="text-strong">expr</strong> and the result tested for true/false. Hence if/else really doesn't care what's within the conditional as long as <strong class="text-strong">expr</strong> don't complain.<br><br>Global variables have the only limit of available names and memory. If you are afraid you'll get overrun with that many global variables, consider using a separate namespace.<br><br><blockquote class="uncited"><div>heres the ACTUAL code, from the OLD Bot, reguarding the timers.. </div></blockquote><div class="codebox"><p>Code: </p><pre><code>if      {![info exists loop]} {        utimer 5 [list RunLoop1]        utimer 6 [list RunLoop2]        utimer 97 [list RunLoop3]        utimer 98 [list RunLoop4]        set loop 1}proc    RunLoop1 {} {        [list GetInfo]        utimer 5 [list RunLoop1]        return 1}...</code></pre></div>I am very puzzled why you're using <strong class="text-strong"></strong><ul><li><strong class="text-strong"></strong> rather than just <strong class="text-strong">GetInfo</strong>. Same with the other procs in your script.. Otherwize, there is nothing that sticks out that would stop it from working on a current eggdrop. As long as there exists no variable named "loop" at the current context, the timers would be started, and loops kept running.<br><blockquote class="uncited"><div>heres the NEW code.. </div></blockquote><div class="codebox"><p>Code: </p><pre><code>if      {![info exists loop]} {        utimer 5 [list RunLoop1 (args)]        set loop 1}proc    RunLoop1 {args} {        ServInfo (args)        utimer 5 [list RunLoop1 (args)]        return 1}</code></pre></div>Did you intentionally use "args" as an argument name here, fully knowing it's special properties? If not, I would strongly suggest against using that name, and suggest you go for anything else but that.<br><strong class="text-strong">"utimer 5 [list RunLoop1 (args)]"</strong> most likely will not produce the result you expect. Once the timer triggers, RunLoop will be called with one single parameter, being literally "(args)". To actually do the variable substitution, you'll have to use $<em class="text-italics">varname</em>.<br>Same goes within your RunLoop1 proc when you call ServInfo...<br><blockquote class="uncited"><div>I need to do the following:<br><br>1.. Strip ASCII/web codes(not html) from incoming "winamp" title strings<br><br>2.. Then need to put them back in (after the strings were minpolated) </div></blockquote>Your best tool for data mining would probably be <strong class="text-strong">regexp</strong>/<strong class="text-strong">regsub</strong>, using regular expressions. In some simpler cases, some of the subcommands of <strong class="text-strong">string</strong> may be helpful as well.</li></ul><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Nov 18, 2008 3:29 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[dj-zath]]></name></author>
		<updated>2008-11-18T09:39:38-04:00</updated>

		<published>2008-11-18T09:39:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=85862#p85862</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=85862#p85862"/>
		<title type="html"><![CDATA[Strange issues in TCL]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=85862#p85862"><![CDATA[
okay.. I think I got it working... <br><br>heres the NEW code.. <br><div class="codebox"><p>Code: </p><pre><code>if      {![info exists loop]} {        utimer 5 [list RunLoop1 (args)]        set loop 1}proc    RunLoop1 {args} {        ServInfo (args)        utimer 5 [list RunLoop1 (args)]        return 1}</code></pre></div>I still have to varify if, indeed, the first part is only running once or if it is looping on its own... <br><br><br>and now.... I got a different but [somewhat] simular issue.. <br><br>I need to do the following:<br><br>1..  Strip  ASCII/web codes(not html) from incoming "winamp" title strings<br><br>2.. Then need to put them back in (after the  strings were minpolated)<br><br>this sounds strange,  I need to explain...<br><br>I'm actually pulling in from one server- and passing to another..  I need to strip all the "&amp;nb#23"'s and stuff from the incoming shoutcast titles..  then after I   rearrange, add  new tags, etc.. (including displaying in PLAIN text to irc) I need  to import them BACK to the stream title (spaces becomes _'s for example)<br><br>I tried hunting for command sets and the like- but I never DID get this one figured out.. but since I'm "in the neighborhood" (so to speak) I thought I'd toss it out to you, the experts!<br><br>any input  or suggestions would be appreciated!<br><br>and, again, thanks in advance for your help and support!<br><br>DjZ<br><img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> <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=10318">dj-zath</a> — Tue Nov 18, 2008 9:39 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[dj-zath]]></name></author>
		<updated>2008-11-17T23:52:24-04:00</updated>

		<published>2008-11-17T23:52:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=85856#p85856</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=85856#p85856"/>
		<title type="html"><![CDATA[Strange issues in TCL]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=85856#p85856"><![CDATA[
DING!<br><br>okay okay!  I get cha!<br><br>yeah,  the old code didn't require sending the  args/flags along with a  run/list command...  (though I DID include them in the "controlled" proc..)<br><br>since the writing of the previous post, I have "worked around" as many issues as I could... mainly  sticking all the "timer-controlled" procs (updates)  into a SINGLE proc and then binding that to "time" (the number of globals is SCARY!)<br><br>I still noticed that NO expressions or if/else works unless I set those particular varables as a global even if the <em class="text-italics">if statment</em> is still inside the SAME proc as the varable!  setting the varable as a global works- even though that varable will NEVER be used outside the proc (isn't that a whaste of resources??)  for this reason, I'm cirrently at 46 "global" varables and expect to climb to over 100! (I hope there isn't a LIMIT!)<br><br>because it was requested: and now I can access the web at this terminal)<br><br>heres the ACTUAL code, from the OLD Bot, reguarding the timers..<br><div class="codebox"><p>Code: </p><pre><code>##### Run Timers #####if      {![info exists loop]} {        utimer 5 [list RunLoop1]        utimer 6 [list RunLoop2]        utimer 97 [list RunLoop3]        utimer 98 [list RunLoop4]        set loop 1}proc    RunLoop1 {} {        [list GetInfo]        utimer 5 [list RunLoop1]        return 1}proc    RunLoop2 {} {        [list OtsSwitch]        utimer 5 [list RunLoop2]        return 1}proc    RunLoop3 {} {        [list UpteTitle]        utimer 5 [list RunLoop3]        return 1}proc    RunLoop4 {} {        [list UpteSong]        utimer 5 [list RunLoop4]        return 1}</code></pre></div>this code WORKED in the old Bot FLAWLESSLY..<br><br>but, as it was pointed out.. I was WAY beihind  and I know I misssed a LOT of upgrades..  I'm "re"learning TCL now so I could figure out the NEW limits on what I can and can't do...<br><br>the NEW code for the "timers" section has been changed to:<br><div class="codebox"><p>Code: </p><pre><code>### Get Server Info ###bind time - "* * * * *" ServInfo</code></pre></div>"GetInfo" (sockets), "OtsSwitch" (auto playout control), "UpteTitle" (updates the current cast title) and "UpteSong" (updates the current song name) have all been combined to a single proc called "ServInfo" and, though its now SLOWED to updating once a minute.. (old code did it once every 5 seconds) it was the best I could do!<br><br>Now, with Speechless's suggestions, I will try reworking the timers section once again.. I surely didn't catch the concept of including the  arg/flasg on the end of the  exec/list section  (I tried everything ELSE)<br><br>One thins I see going wrong... is will I have to pass the  args all the way down to the end procs and will that be an issue?  I guess I'll find out!<br><br>in the meantime, thanks everyone for your help! I appreciate it.. I'm working hard to redesign all of this.. and.. perhaps, with all your help, I'll not only get the NEW Bot up and running, but I plan to ELIMINATE the old Bot's reliance on PHP for the web-side of things..  I think the new Bot  could do a BETTER job than running php in a shell!<br><br>more exciting details to come!  if you want to find out more, I invite you to my chat network at this link (the website is still down as the BOT will be generating it DYNAMICALLY!) see? eggdrop in action!<br><br>Using Flash: <a href="http://www.warp-radio.com/warp-chat-flash.html" class="postlink">http://www.warp-radio.com/warp-chat-flash.html</a><br><br>you can join via your favorite IRC client too:<br><br>server  irc.warp-radio.com:6667<br><br>channel #WARP-Radio<br><br>come by and say hi <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":-)" title="Smile">  (sorry if this seemed poachy-  but I am writing the bot in realtime and it does make progress in that chat netowrk!)<br><br>again, thanks for all your help.. I believe it will be resolved soon enough<br><br>-DjZ-<br><img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> <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=10318">dj-zath</a> — Mon Nov 17, 2008 11:52 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2008-11-15T22:55:20-04:00</updated>

		<published>2008-11-15T22:55:20-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=85835#p85835</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=85835#p85835"/>
		<title type="html"><![CDATA[Strange issues in TCL]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=85835#p85835"><![CDATA[
As speechles pointed out, you must always make sure function calls have the right number of arguments. Different bindings will call the associated function with a set of arguments depending on the type of the binding, and hence your proc must match that. Also, keep in mind that there is no automatic variable injection or such when calling a function from another function.. <br><br>Since your problems started when you upgraded your eggdrop, I would guess it is related to one of a few binding types that has been altered in a non-backwards compatible manner. These are notc, part, and mode (pre 1.3.18 ); see the tcl-commands.doc document for further information on compability with these commands, including portable code.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sat Nov 15, 2008 10:55 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2008-11-15T22:38:46-04:00</updated>

		<published>2008-11-15T22:38:46-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=85834#p85834</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=85834#p85834"/>
		<title type="html"><![CDATA[Strange issues in TCL]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=85834#p85834"><![CDATA[
Your problem is painfully obvious and the error given to you clearly spells it out.<div class="codebox"><p>Code: </p><pre><code>    utimer 5 [list Go] </code></pre></div>You are invoking the procedure go, with no parameters. Yet in your procedure declartion below:<div class="codebox"><p>Code: </p><pre><code>proc     Go {nick uhost hand chan arg} { </code></pre></div>You are expecting there to be 5 passed: nick, uhost, hand, chan, arg<br><br>You need to include these arguments when invoking the timer passing them to the go procedure, or eliminate them from the go procedure as I have done below.<div class="codebox"><p>Code: </p><pre><code>bind pub n !test Test proc   Test {nick uhost hand chan arg} {    utimer 5 [list Go]}proc     Go { } {     putserv "PRIVMSG #Test : Operation Complete."} </code></pre></div>When you use a bind, it will expect to pass a set amount of parameters (in your case: nick, uhost, hand, chan and the remaining user text given). Your procedure header parameters must match this amount as well. If you invoke the go procedure without passing arguments you must also leave the parameter field empty within the procedure header.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Sat Nov 15, 2008 10:38 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[dj-zath]]></name></author>
		<updated>2008-11-15T21:23:45-04:00</updated>

		<published>2008-11-15T21:23:45-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=85831#p85831</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=85831#p85831"/>
		<title type="html"><![CDATA[Strange issues in TCL]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=85831#p85831"><![CDATA[
hi and thanks for your prompt reply!<br><br>a couple things to explain reguarding your inquiry.<br><br>1.. the "code" I provided above was just an example-  it assumes a proc named "Action" exists.<br><br>2.. the  actual code I have for the radio interface is rather lengthy.. and I'd rather not post it since it contains sensitive information (of course, I could "bleep out" that info.. but I might miss something... and that will bite me in the ass later on <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":-)" title="Smile">)<br><br>3. I think the code itself would work once the "base" parts are figured out..<br><br>I have began to use "debug mode".. and now I see the error messages ( call it a brain fart or what!)   The error messages still don't make sense, however, but at least I see whats happening...<br><br>the args/flags for called procs are being dropped and/or ignored<br><br>note the following example:<br><br>heres a  example  piece of code I put in:<br><div class="codebox"><p>Code: </p><pre><code>bind pub -n !test Testproc   Test {} {    utimer 5 [list Go]}proc     Go {nick uhost hand chan arg} {     putserv "PRIVMSG #Test : Operation Complete."}</code></pre></div>then I type !test in the chatroom:<br><br>I receive the error in debug:<br><br>Tcl error [Test]: wrong # args: should be "Go nick uhost hand chan arg"<br><br>and, of course, the operation  fails.<br><br><br>This suggests that flags/args from the "called" proc are simply being ignored and, of course, then  "error out" and fail...<br><br>thats basically all I have at this time..  I'm still "debugging" this and trying out  other ideas to see if I can  figure it out.. the MOST LIKELY thing is I probably am forgetting something that which USED to work when omitted- but now REQUIRED and I just don't know what it is!<br><br>again, thanks for your time, help and input!<br><br>DjZ<br><img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> <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=10318">dj-zath</a> — Sat Nov 15, 2008 9:23 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2008-11-15T12:30:34-04:00</updated>

		<published>2008-11-15T12:30:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=85828#p85828</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=85828#p85828"/>
		<title type="html"><![CDATA[Strange issues in TCL]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=85828#p85828"><![CDATA[
Could you provide some additional information, such as version of eggdrop, version of tcl, the full source of your custom script, any generated/logged errors?<br><ol style="list-style-type:decimal"><li>Odd, do you get any errors logged or such?</li><li>The <strong class="text-strong">list</strong> command does not call another proc, it simply generates a tcl-list. It is used with timers to prevent code injection and remote exploits, such as command substitutions ([command]) and variable evaluation.<br>This would rather be a side-effect of your first problem.</li><li>This is very odd. Tcl should not make any difference to what commands are available simply by changing the command execution context. Did you get any errors when trying this?</li><li>Variable context must be considered. A globalspace variable is not implicitly made available to the environment of a proc, but must explicitly be made available using the <strong class="text-strong">upvar</strong> or <strong class="text-strong">global</strong> commands. A local variable within a proc will only persist through the execution of the proc, and is wiped once the proc ends. Any variable already created within the current instance of the proc should be usable with <strong class="text-strong">if</strong>, aswell as any other command, without having to link it to a globalspace variable.</li></ol>Personally, I can not see any reason for the posted code not working (I am assuming there is a proc named Action aswell somewhere in your script). I also assume the pasted code is executed at global context, and <em class="text-italics">StartLoop</em> has not been set prior running this code.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sat Nov 15, 2008 12:30 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[dj-zath]]></name></author>
		<updated>2008-11-15T07:31:30-04:00</updated>

		<published>2008-11-15T07:31:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=85826#p85826</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=85826#p85826"/>
		<title type="html"><![CDATA[Strange issues in TCL]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=85826#p85826"><![CDATA[
Recently, I upgraded from a  hosted box running FreeBSD.. to a CoLocation box running Linux.<br><br>I was running an older version of eggdrop on the bsd box, but opted to run the latest TCL and eggdrop on this new box..<br><br>everything  compiled and installed without any problems.. untill...<br><br>I went to load a custom script I wrote to manage my radio station interface..<br><br>BZZZZT!  the script COMPLETELY FAILS!<br><br>okay, I thought, I figured I'd probably have to change things and  would begin rewriting the script from scratch..<br><br>then I discovered WHY the script failed...  and I'd like to know if this was intentional or whatnot...  and how to FIX it...<br><br><br>I didn't get very far- in fact, right on the first piece of code/procs..<br><br>I have discovered the following:<br><br>1  timers will NOT run,  period.<br>2  a proc will NOT load another proc... (<em class="text-italics">list</em>  does NOTHING)<br>3  can't have a 'if{}' statement outside a proc (such as in the eggdrop.conf file)<br><br>an 'if' statement will run inside a proc, but ONLY if a <em class="text-italics">GLOBAL</em> varable is set; "local" varables don't work in 'if' statements- in or out of procs<br><br>so, the following piece of code:<div class="codebox"><p>Code: </p><pre><code>if {![info exists StartLoop]} {       utimer 5 [list RunLoop]       set StartLoop 1}proc RunLoop {} {       utimer 5 [list Action]       return 1}</code></pre></div>does <em class="text-italics">NOT</em> work at all!  this piece of code has THREE failures in it (mentioned above) and thats as far as I got!<br><br>I'm SURE there are more and more "odd failures" but the bot itself seems to run  just FINE..  its as if the failures are <em class="text-italics">INTENTIONAL</em> or as if the bot was designed to no longer allow the use of  the internal TCL scripting to run external functions... <br><br>I have tried reinstalling Eggdrop and TCL  but nothing has improved<br><br>I have tried  clean installs,  clean uninstalls, YUM and manual installs-  make static.. you name it!<br><br>I am totally STUMPED on this one!<br><br>anyone offer some help??  thanks!<br><br>DjZ<br><img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> <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=10318">dj-zath</a> — Sat Nov 15, 2008 7:31 am</p><hr />
]]></content>
	</entry>
	</feed>
