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

	<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-05-04T16:31:05-04:00</updated>

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

		<entry>
		<author><name><![CDATA[zeuz]]></name></author>
		<updated>2005-05-04T16:31:05-04:00</updated>

		<published>2005-05-04T16:31:05-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=49003#p49003</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=49003#p49003"/>
		<title type="html"><![CDATA[Need some help with mirc-script to tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=49003#p49003"><![CDATA[
Thanks both of you! <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=6174">zeuz</a> — Wed May 04, 2005 4:31 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[spock]]></name></author>
		<updated>2005-05-04T14:42:38-04:00</updated>

		<published>2005-05-04T14:42:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=49000#p49000</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=49000#p49000"/>
		<title type="html"><![CDATA[Need some help with mirc-script to tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=49000#p49000"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>bind pub - !lexp lexp proc rslvlexp p {   set points 0  set level 1  while {$level&lt;$p} {    set points [expr floor($points + $level + 300 * pow(2,$level / 7.0))]     incr level   }  set outputnum [expr round(floor($points / 4))]} proc lexp {n u h c a} {   if ![llength [split $a]] return  foreach n [split $a] {    if {$n&lt;=0||$n&gt;99} {      puthelp "PRIVMSG $c :something funny happened"      return    }  }  set n [scan $a "%i %i %i" f s x]  if {$n&lt;2} {     puthelp "PRIVMSG $c :[rslvlexp $f]"  } elseif {$n&lt;3} {    puthelp "PRIVMSG $c :[expr [rslvlexp $s] - [rslvlexp $f]]"  } {    puthelp "PRIVMSG $c :[expr ([rslvlexp $s] - [rslvlexp $f])/$x]"     }  return}</code></pre></div>edit: bleh! fz beat me. didnt refresh thread before starting  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_evil.gif" width="15" height="15" alt=":evil:" title="Evil or Very Mad"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2369">spock</a> — Wed May 04, 2005 2:42 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2005-05-04T14:19:32-04:00</updated>

		<published>2005-05-04T14:19:32-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=48998#p48998</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=48998#p48998"/>
		<title type="html"><![CDATA[Need some help with mirc-script to tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=48998#p48998"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>bind pub - !lexp lexp proc rslvlexp p {   set points 0   set level 1   while {$level&lt;$p} {     set points [expr floor($points + $level + 300 * pow(2,$level / 7.0))]     incr level   }   set outputnum [expr round(floor($points / 4))] } proc lexp {n u h c a} {   if ![llength [split $a]] return   if {[scan $a "%s %s %s" f s x] == 1} {     if {$f&lt;=0||$f&gt;99} return     puthelp "PRIVMSG $c :[rslvlexp $f]"   } elseif {[scan $a "%s %s %s" f s x] == 2} {     if {$f&lt;=0||$f&gt;99||$s&lt;=0||$s&gt;99} return     puthelp "PRIVMSG $c :[expr [rslvlexp $s] - [rslvlexp $f]]"   } elseif {[scan $a "%s %s %s" f s x] == 3} {    if {$f&lt;=0||$f&gt;99||$s&lt;=0||$s&gt;99||$x&lt;=0||$x&gt;99} return     puthelp "PRIVMSG $c :[expr {([rslvlexp $s] - [rslvlexp $f]) / $x}]"  }  return }</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Wed May 04, 2005 2:19 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zeuz]]></name></author>
		<updated>2005-05-04T13:08:28-04:00</updated>

		<published>2005-05-04T13:08:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=48996#p48996</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=48996#p48996"/>
		<title type="html"><![CDATA[Need some help with mirc-script to tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=48996#p48996"><![CDATA[
Thats great, thanks! <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> Just one more thing, how can i add a third argument? As the mirc-script is now you can type !lexp 5 10 20 and get the amount of items needed for that amount of experience. Like !lexp &lt;level1&gt; &lt;level2&gt; &lt;experience you get when doing something&gt;<br><br>[expr [rslvlexp $s] - [rslvlexp $f] / $x] where $x is the third one...<br><br><br>How can i check that $s, $f and... $x? is numeric? Just noticed that some people tend to try chars...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6174">zeuz</a> — Wed May 04, 2005 1:08 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[spock]]></name></author>
		<updated>2005-05-04T12:40:08-04:00</updated>

		<published>2005-05-04T12:40:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=48995#p48995</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=48995#p48995"/>
		<title type="html"><![CDATA[Need some help with mirc-script to tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=48995#p48995"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>bind pub - !lexp lexp proc rslvlexp p {   set points 0  set level 1  while {$level&lt;$p} {    set points [expr floor($points + $level + 300 * pow(2,$level / 7.0))]     incr level   }  set outputnum [expr round(floor($points / 4))]} proc lexp {n u h c a} {   if ![llength [split $a]] return  if {[scan $a "%s %s" f s] &lt; 2} {     if {$f&lt;=0||$f&gt;99} return    puthelp "PRIVMSG $c :[rslvlexp $f]"  } {    if {$f&lt;=0||$f&gt;99||$s&lt;=0||$s&gt;99} return    puthelp "PRIVMSG $c :[expr [rslvlexp $s] - [rslvlexp $f]]"  }  return}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2369">spock</a> — Wed May 04, 2005 12:40 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zeuz]]></name></author>
		<updated>2005-05-04T12:30:12-04:00</updated>

		<published>2005-05-04T12:30:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=48994#p48994</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=48994#p48994"/>
		<title type="html"><![CDATA[Need some help with mirc-script to tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=48994#p48994"><![CDATA[
Yup, thats how i want it to work. If the user enters two levels it should return the experience between thoose. Something like this: rslvlexp(21) - rslvlexp(14).<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6174">zeuz</a> — Wed May 04, 2005 12:30 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2005-05-04T12:12:33-04:00</updated>

		<published>2005-05-04T12:12:33-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=48991#p48991</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=48991#p48991"/>
		<title type="html"><![CDATA[Need some help with mirc-script to tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=48991#p48991"><![CDATA[
lets take <blockquote class="uncited"><div>!lexp 14</div></blockquote> for an example.<br><br>you want to pass 14 to rslvlexp and then output the result ?<br><br>Also, if 2 numbers were entered with !lexp (for example !lexp 14 21) what should be done with the other ?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Wed May 04, 2005 12:12 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zeuz]]></name></author>
		<updated>2005-05-04T10:11:51-04:00</updated>

		<published>2005-05-04T10:11:51-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=48988#p48988</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=48988#p48988"/>
		<title type="html"><![CDATA[Need some help with mirc-script to tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=48988#p48988"><![CDATA[
Works now, thanks spock! <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>Now for the other part, not sure on how to solve that.<br><br>What i want it to do is when !lexp is used in a channel it will call lexp. lexp will then check to see if the user tries something funny, like going over level 99 or trying with negative numbers etc. When that is checked and ok it should msg the channel with the help of rslvlexp wich returns the experience needed for a stated level, or the experience between two levels. <br><br>Example:<br>&lt;user&gt; !lexp 14<br>&lt;bot&gt; Level 1-14: xxx exp<br>&lt;user&gt; !lexp 14 21<br>&lt;bot&gt; Level 14-21: xxx exp<br><br>This is how the script currently looks like:<div class="codebox"><p>Code: </p><pre><code>bind pub - !lexp lexp## returns amount of experience needed for the stated level#proc rslvlexp { nick uhost handle channel firstlevel } {    set outputnum 0    set points 0    set level 1    while {$level &lt; $firstlevel} {        set points [expr floor($points + $level + 300 * pow(2,$level / 7.0))]        set outputnum [expr round(floor($points / 4))]        incr level    }    #puthelp "PRIVMSG $channel :$firstlevel - $outputnum experience"    return $outputnum}## proc to call when !lexp is used#proc lexp { nick uhost handle channel firstlevel secondlevel } {    return 0}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6174">zeuz</a> — Wed May 04, 2005 10:11 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[spock]]></name></author>
		<updated>2005-05-04T09:13:27-04:00</updated>

		<published>2005-05-04T09:13:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=48980#p48980</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=48980#p48980"/>
		<title type="html"><![CDATA[Need some help with mirc-script to tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=48980#p48980"><![CDATA[
"incr $level" should be "incr level" (gets rid of the error, dont know if it'll do what you expect)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2369">spock</a> — Wed May 04, 2005 9:13 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zeuz]]></name></author>
		<updated>2005-05-04T08:55:23-04:00</updated>

		<published>2005-05-04T08:55:23-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=48976#p48976</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=48976#p48976"/>
		<title type="html"><![CDATA[Need some help with mirc-script to tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=48976#p48976"><![CDATA[
Anyone knows what i've done wrong?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6174">zeuz</a> — Wed May 04, 2005 8:55 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zeuz]]></name></author>
		<updated>2005-05-02T13:51:50-04:00</updated>

		<published>2005-05-02T13:51:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=48899#p48899</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=48899#p48899"/>
		<title type="html"><![CDATA[Need some help with mirc-script to tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=48899#p48899"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>alias levelexp {  var %outputnum = 0  var %points = 0  var %lvl = 1  while (%lvl &lt; $$1) {    %points = $int($calc(%points + %lvl + 300 * 2 ^ (%lvl / 7.0)))    %outputnum = $int($calc(%points / 4))    inc %lvl 1  }  return $int(%outputnum)} </code></pre></div>Is a function that calculates the experience for the stated level. $$1 is the level stated when calling the function. I didn't make the formula for it though. Need to know anything more about it?<br><br>This is the error im getting: <br>Tcl error [msg:levelexp]: can't read "1": no such variable<br><br>Same function in php if that helps:<div class="codebox"><p>Code: </p><pre><code>function GetLevelExperience($level){$outputnum = 0;$points = 0;$lvl = 1;while($lvl &lt; $level) {$points += floor($lvl + 300 * pow(2, $lvl / 7.0));$outputnum = floor($points / 4);$lvl++;}return $outputnum;}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6174">zeuz</a> — Mon May 02, 2005 1:51 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2005-05-02T13:11:05-04:00</updated>

		<published>2005-05-02T13:11:05-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=48895#p48895</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=48895#p48895"/>
		<title type="html"><![CDATA[Need some help with mirc-script to tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=48895#p48895"><![CDATA[
If you trace the code, so we can understand it more (since, atleast me, we don't know mirc language very well), then we can provide more help on this script.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Mon May 02, 2005 1:11 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zeuz]]></name></author>
		<updated>2005-05-02T13:52:08-04:00</updated>

		<published>2005-05-02T12:43:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=48894#p48894</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=48894#p48894"/>
		<title type="html"><![CDATA[Need some help with mirc-script to tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=48894#p48894"><![CDATA[
Tried to write it myself, this is how it look likes this far:<br><div class="codebox"><p>Code: </p><pre><code>bind pub - !lexp  msg:levelexpproc msg:levelexp { nick uhost handle channel firstlevel } {    set outputnum 0    set points 0    set level 1    while {$level &lt; $firstlevel} {        set points [expr $points + $level + 300 * pow(2,$level / 7.0)]        set outputnum [expr $points / 4]        incr $level    }    puthelp "PRIVMSG $channel :$firstlevel - $outputnum experience"    return 0}</code></pre></div>Any help is very much appreciated, this is my first tcl script ever (if it counts since it don't work as planned <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz">), started to read some a couple of hours ago.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6174">zeuz</a> — Mon May 02, 2005 12:43 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zeuz]]></name></author>
		<updated>2005-05-01T04:52:26-04:00</updated>

		<published>2005-05-01T04:52:26-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=48798#p48798</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=48798#p48798"/>
		<title type="html"><![CDATA[Need some help with mirc-script to tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=48798#p48798"><![CDATA[
It feels like i'm asking for too much, but it's worth a try. Currently i'm running the script on my own client (mirc). I would like to use my eggdrop to run the script instead. <br><br>What the script does is answer on !lexp &lt;from-level&gt; &lt;to-level&gt; &lt;optional: exp per item&gt; with experience between from-level and to-level, and, if stated, calculates amount of items needed for that amount of experience. (It's for a game called runescape.)<br><br>I know that this may be too much to ask for, but it would be greatly appreciated. Some lines is in swedish, so ask if you don't understand. I have never worked with tcl, but have some basic knowledge in c++ and some other languages, so any hints and things like that is welcome.<br><br>Here's the code:<div class="codebox"><p>Code: </p><pre><code>alias levelexp {  var %outputnum = 0  var %points = 0  var %lvl = 1  while (%lvl &lt; $$1) {    %points = $int($calc(%points + %lvl + 300 * 2 ^ (%lvl / 7.0)))    %outputnum = $int($calc(%points / 4))    inc %lvl 1   }  return $int(%outputnum)}alias tusen {  var %word = $null  var %length = $len($$1)  var %i = 0  var %left = 0    while (%i &lt; %length) {    var %pos = $calc(%length - %i - 2)    if (%pos &lt;= 0) { %left = $left($$1, $calc(%length - %i)) }        else { %left = $mid($$1, %pos, 3) }    %word = %left %word    inc %i 3    }  return %word}alias lexp {  if ($nick != $null) var %nick = $nick  else %nick = $me    if ($$1 !isnum 1-1000) {    .notice %nick Syntax error! Använd !lexp &lt;level&gt; &lt;level&gt; utan streck    halt  }  if ($1 &gt; 150 || $2 &gt; 150) {    .notice %nick För hög högsta level! Max är 150!     halt  }   else if ($2) {    var %expsak = $3    var %lvls = $calc($$2 - $$1)    var %expkvar = $calc($levelexp($$2) - $levelexp($$1))    if ($3) {      msg # Level $$1 $+ - $+ $$2 $+ : $tusen(%expkvar) exp - Antal "Saker": $tusen($int($calc(%expkvar / %expsak)))           }    else {        msg # Level $$1 $+ - $+ $$2 $+ : $tusen(%expkvar) exp    }  }  else {    msg # Level 1 $+ - $+ $$1 $+ : $tusen($levelexp($$1)) exp   } }on *:TEXT:!lexp*:#runescape.se:{ $lexp($$2, $3, $4) }</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6174">zeuz</a> — Sun May 01, 2005 4:52 am</p><hr />
]]></content>
	</entry>
	</feed>
