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

	<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-09-15T16:05:26-04:00</updated>

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

		<entry>
		<author><name><![CDATA[ProXy]]></name></author>
		<updated>2002-09-15T16:05:26-04:00</updated>

		<published>2002-09-15T16:05:26-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10933#p10933</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10933#p10933"/>
		<title type="html"><![CDATA[No vars reset :(]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10933#p10933"><![CDATA[
Ah, I got it know - THX a lot <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=1729">ProXy</a> — Sun Sep 15, 2002 4:05 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2002-09-15T16:03:11-04:00</updated>

		<published>2002-09-15T16:03:11-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10932#p10932</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10932#p10932"/>
		<title type="html"><![CDATA[No vars reset :(]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10932#p10932"><![CDATA[
And I have told you the solution in allmost every post since the problem was discovered.<br><br>I knew all along, what you where trying to discribe. You, howver, have failed to even look at any of the posts I have sent for a solution.<br><br>As stated, we will help people along the way, but we will not tell them exactly how to fix it. Not when it is blindingly obvious how to fix it.<br><br>Lets make things a little more simple.<br><br>1:<div class="codebox"><p>Code: </p><pre><code>set var "test &lt;CODE&gt;"regsub -all -- "&lt;CODE&gt;" $var "test" var</code></pre></div>2:<div class="codebox"><p>Code: </p><pre><code>set var "test"regsub -all -- "&lt;CODE&gt;" $var "test" test</code></pre></div>Version 1 is the equivilant of your regsub code. The value of $var will remain at the update value of "test test" thorugh the remainder of the script. You cna't tell later on, that the value of $var was originaly "test &lt;CODE&gt;".<br><br>Aplying this to you script<div class="codebox"><p>Code: </p><pre><code>set var "http://&lt;IP&gt;/channel"regsub -all -- "&lt;IP&gt;" $var "192.168.254.1" var</code></pre></div>At the end of this script, $var is set to "<a href="http://192.168.254.1/channel" class="postlink">http://192.168.254.1/channel</a>". Thus, if the IP changes, and we need to update any output made by the regsub, it can't be done, because &lt;IP&gt; is now missing.<br><br><br>Version 2 however, does not change the avlue of $var, thus, the substitution can take place many times, dynamicaly updating the output.<br><br>Apply this theory to both your script, and the mini script's above, and you will see, that the substiture can be made many times.<br><br><strong class="text-strong"><em class="text-italics">NOTE</em></strong>: This thread is becoming a severe waste of time. While all scripters lives begin as a newcomer, with very little knowledge. They usualy attempt to read things through, and/or try things themselves.<br><br>As this thread has become pathetic (due tot he fact, the answer has been repeated time and time again, refrased in allmost everyway possible), it will be locked next time anything is posted to it.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Sun Sep 15, 2002 4:03 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ProXy]]></name></author>
		<updated>2002-09-15T15:23:50-04:00</updated>

		<published>2002-09-15T15:23:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10931#p10931</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10931#p10931"/>
		<title type="html"><![CDATA[No vars reset :(]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10931#p10931"><![CDATA[
OMG.<br><br>You just explained what i wanted to explain to you. The source you pasted is nearly like mine, the same error. You don`t have to tell me some examples about my error, but try to say how to do it right. And please try to do it so, that i will follow it! And i do NOT want to have a random output. The output has to depend on the channel the eggdrop is atm!<br><br>I know how to use regsub and what it does. But i DO NOT KNOW how to solve the problem that the vars always have the same value!<br><br>I ran my script in #abc so the URL is <a href="http://123.123.123.123:1234/abc" class="postlink">http://123.123.123.123:1234/abc</a> and it IS RIGHT!<br>I ran it again in another channel but the output is still the same! In all your posts you describe how to use regsub like i already did!<br><br>The Script shall always look the chan the eggdriop is on atm and replace &lt;CHANNEL&gt; with that channel!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1729">ProXy</a> — Sun Sep 15, 2002 3:23 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2002-09-15T13:23:04-04:00</updated>

		<published>2002-09-15T13:23:04-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10926#p10926</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10926#p10926"/>
		<title type="html"><![CDATA[No vars reset :(]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10926#p10926"><![CDATA[
My example is exactly the same as yours.<br><br>The only2 differances, mine doesn't do what you want it, and it doesn't use regsub.<br><br>You say mine changes the value of var, and add stuff too it.<br><br>Then look at your own. It may not add stuff to it, but instead changes somthing. In eccance, adding is a change.<br><br>If it is a real must, and you realy are too thick, here is my example again, using resubs.<br><div class="codebox"><p>Code: </p><pre><code>set sub "ppslim is &lt;WORD&gt;"set word "cool"proc test {} {  global sub word  regsub -all -- "&lt;WORD&gt;" $sub $word sub  puts stdout "$sub"}puts stdout "$sub"testputs stdout "$sub"</code></pre></div>This will produce<div class="codebox"><p>Code: </p><pre><code>ppslim is &lt;WORD&gt;ppslim is coolppslim is cool</code></pre></div>When in your thinking, you want it to produce<br><div class="codebox"><p>Code: </p><pre><code>ppslim is &lt;WORD&gt;ppslim is coolppslim is &lt;WORD&gt;</code></pre></div>the command "regsub" uses the following format<br><br>regsub ?switches? expression input-string subtituation-spec varname<br><br>Switches = Items that can effect how the command interets the input-string or expression. EG, rather than substituting the first match, replace them all.<br><br>expression = The item within input-string that should be replaced (seeing as this is a regular expression command, you can use these here).<br><br>input-string = the string of text, that the substitutions should be made on.<br><br>substitution-spec = what should the matches be replaced with<br><br>varname = where do we store the new item<br><br>using this small rement of code<div class="codebox"><p>Code: </p><pre><code>set text "hello &lt;WORD&gt; all"regsub -all -- "&lt;WORD&gt; $text "to" text</code></pre></div>We can see, that the variable $text, should be searched for the text "&lt;WORD&gt;.<br><br>If found, it should be replaced with the text "to".<br><br>The end result should be saved to the variable text.<br><br>As such, this command overwrites the variable text, with a new one.<br><br>This is exactly the same as what is happening in yours.<br><br>You are overwriting you input string "http://&lt;IP&gt;:&lt;PORT&gt;/&lt;CHANNEL&gt;" with the value you want to send to the channel.<br><br>If, for example, the first time you run the script, <br>&lt;IP&gt; = 192.168.254.1<br>&lt;PORT&gt; = 24<br>&lt;CHANNEL&gt; = mirchelp (#mirchelp with the # removed, as you wished)<br><br>Then all works well, and the message is displayed correctly.<br><br>Next time the script is run, the input-string becomes "<a href="http://192.168.254.1:24/mirchelp" class="postlink">http://192.168.254.1:24/mirchelp</a>"<br><br>This is not want you want.<br><br>Now look at my prevous post, to see an example at how things should be done.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Sun Sep 15, 2002 1:23 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ProXy]]></name></author>
		<updated>2002-09-15T12:08:25-04:00</updated>

		<published>2002-09-15T12:08:25-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10924#p10924</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10924#p10924"/>
		<title type="html"><![CDATA[No vars reset :(]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10924#p10924"><![CDATA[
But I don`t want to extend the var. All your examples set a var to another one adding some stuff...<br>The script is only running once, and the output has to be http://IP:PORT/ROOM<br><br>Seems that i am too stupid for this..<br><br>I only want to set the var like http://&lt;IP&gt;:&lt;PORT&gt;/&lt;CHANNEL&gt; before the proc and then replace the 3 Parts by vars... (http://$ip:$port/$room)<br><br>Then I can simply output the URL because all vars have the right value!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1729">ProXy</a> — Sun Sep 15, 2002 12:08 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2002-09-15T11:51:24-04:00</updated>

		<published>2002-09-15T11:51:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10923#p10923</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10923#p10923"/>
		<title type="html"><![CDATA[No vars reset :(]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10923#p10923"><![CDATA[
This is rather simple<br><br>Take the following code<br><div class="codebox"><p>Code: </p><pre><code>set var "ppslim is"proc test {} {  global var  set var "$var cool"  puts stdout "$var"}puts stdout "$var"testputs stdout "$var"[code]Runt his scode through tclsh and you get[code]ppslim isppslim is coolppslim is cool</code></pre></div>Maybe i didn't want to change the value of var outside of the proc, but I needed to change part of it, only inside the proc.<br><br>EG, I wnated it to post this following output<br><div class="codebox"><p>Code: </p><pre><code>ppslim isppslim is coolppslim is</code></pre></div>To do this, i should have used the code<br><div class="codebox"><p>Code: </p><pre><code>set var "ppslim is"proc test {} {  global var  set temp "$var cool"  puts stdout "$temp"}puts stdout "$var"testputs stdout "$var"[code]Follow the same sort of procedure in your own script.</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Sun Sep 15, 2002 11:51 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ProXy]]></name></author>
		<updated>2002-09-15T11:46:04-04:00</updated>

		<published>2002-09-15T11:46:04-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10922#p10922</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10922#p10922"/>
		<title type="html"><![CDATA[No vars reset :(]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10922#p10922"><![CDATA[
I don`t understand why there should be a solution if i use another var for regsub. I still need to make the other global to set $int with the right value!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1729">ProXy</a> — Sun Sep 15, 2002 11:46 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2002-09-15T11:36:16-04:00</updated>

		<published>2002-09-15T11:36:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10919#p10919</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10919#p10919"/>
		<title type="html"><![CDATA[No vars reset :(]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10919#p10919"><![CDATA[
Perhaps you could get a clue <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><br><br>You fail to understand what is wrong in this script.<br><br>If you read my post, and understand why it's happening, you will locate the answer.<br><br>Once again, maybe you should be trying this yourself.<br><br>You may not have access to a machine, but this is not our problem, or should I get the forms together to call myself rover or spot!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Sun Sep 15, 2002 11:36 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ProXy]]></name></author>
		<updated>2002-09-14T20:07:15-04:00</updated>

		<published>2002-09-14T20:07:15-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10898#p10898</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10898#p10898"/>
		<title type="html"><![CDATA[No vars reset :(]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10898#p10898"><![CDATA[
Just to do it right: I should not set $getipoutput as global, but set $int = $getipoutput. Do i have to set $int before or behind the proc? Perhaps you could paste a little example... <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=1729">ProXy</a> — Sat Sep 14, 2002 8:07 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2002-09-14T18:40:05-04:00</updated>

		<published>2002-09-14T18:40:05-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10896#p10896</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10896#p10896"/>
		<title type="html"><![CDATA[No vars reset :(]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10896#p10896"><![CDATA[
s stated, it was somthing else int he script.<br><br>you are making the variable "getipoutput" global, which means, any changes made to it are saved.<br><br>Thus, next time the script is called, it no longer has the &lt;IP&gt; or so on in it, as these have been replaced with the values from the previous call.<br><br>You should use an intermediate var in the regsub.<br><br>IE<br><br>at the begining of the proc, use "set int $getipoutput"<br><br>Then use "$int" instead of "$getipoutput" in the regsub's.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Sat Sep 14, 2002 6:40 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ProXy]]></name></author>
		<updated>2002-09-14T18:32:12-04:00</updated>

		<published>2002-09-14T18:32:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10894#p10894</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10894#p10894"/>
		<title type="html"><![CDATA[No vars reset :(]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10894#p10894"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>#### Flag for global users ####set getipglobalflag "*"#### Flag for local users #####set getiplocalflag "*"####### Public command ########set getipcommand "!stats"### Port of the stats site ####set getipport "50000"####### Default Output ########set getipoutput "Stats @ http://&lt;IP&gt;:&lt;PORT&gt;/&lt;CHANNEL&gt;"#### END OF CONFIGURATION #####set getipusage "Usage: $getipcommand"bind pub $getipglobalflag|$getiplocalflag $getipcommand pub:getipproc pub:getip { nick uhost handle channel arg } {global botnick getipoutput getipport getipusageif {[llength $arg]!=0} {putserv "PRIVMSG $channel :$getipusage"} else {set getipip [lindex [exec host [lindex [split [getchanhost $botnick] @] 1]] end]set getipchannel [string replace $channel 0 0]regsub -all &lt;IP&gt; $getipoutput $getipip getipoutputregsub -all &lt;PORT&gt; $getipoutput $getipport getipoutputregsub -all &lt;CHANNEL&gt; $getipoutput $getipchannel getipoutputputserv "PRIVMSG $channel :$getipoutput this is channel $channel"}}putlog "LOADED: GetIP v0.1"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1729">ProXy</a> — Sat Sep 14, 2002 6:32 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2002-09-14T18:06:15-04:00</updated>

		<published>2002-09-14T18:06:15-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10889#p10889</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10889#p10889"/>
		<title type="html"><![CDATA[No vars reset :(]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10889#p10889"><![CDATA[
The only explanation is for it to be another part of the script.<br><br>Maybe your method of getting the channel name in the ifrst place is at fault.<br><br>As you noted in your first post, the code does at it says it should.<br><br>But you also aknoledge that there is more code.<br><br>Just becuase an economy car can do 100 MPH, doen't mean that when it breaks down ater 4 hours solid driving, the engine should be to blame. It's the drivers fault, even more so for not acknoledginf so.<br><br>This applies here. Just because the script works the first time round, do no blame one simgle part of it, when it breaks. You need to look at the whole problem.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Sat Sep 14, 2002 6:06 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ProXy]]></name></author>
		<updated>2002-09-14T16:21:56-04:00</updated>

		<published>2002-09-14T16:21:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10888#p10888</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10888#p10888"/>
		<title type="html"><![CDATA[No vars reset :(]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10888#p10888"><![CDATA[
The script works the first time and sets a channel to the var $getipchannel.<br><br>I do NOT unset this var. When i wanted to run the script in other channels the value of $getipchannel is the same old channel like the first run!<br><br>The  other code does NOt have influence to the problem so there`s no need to paste it!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1729">ProXy</a> — Sat Sep 14, 2002 4:21 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2002-09-14T15:39:14-04:00</updated>

		<published>2002-09-14T15:39:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10887#p10887</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10887#p10887"/>
		<title type="html"><![CDATA[No vars reset :(]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10887#p10887"><![CDATA[
The error must be somewhere else. If this works the first time, then it'll work every time. But maybe you're mismanaging the variables and using old data. So we'd need to see the other code.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8">stdragon</a> — Sat Sep 14, 2002 3:39 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ProXy]]></name></author>
		<updated>2002-09-14T14:38:51-04:00</updated>

		<published>2002-09-14T14:38:51-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10886#p10886</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10886#p10886"/>
		<title type="html"><![CDATA[No vars reset :(]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10886#p10886"><![CDATA[
Yes it was right: The posted source will first remove the first sign of the string, and then replace an URL like "http://&lt;IP&gt;:&lt;PORT&gt;/&gt;CHANNEL&gt; with the right settings.<br><br>The problem is, that the &lt;CHANNEL&gt; is the same value in all channels i run the script after the first time!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1729">ProXy</a> — Sat Sep 14, 2002 2:38 pm</p><hr />
]]></content>
	</entry>
	</feed>
