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

	<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>2004-06-24T14:38:26-04:00</updated>

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

		<entry>
		<author><name><![CDATA[arcane]]></name></author>
		<updated>2004-06-24T14:38:26-04:00</updated>

		<published>2004-06-24T14:38:26-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=37813#p37813</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=37813#p37813"/>
		<title type="html"><![CDATA[advertising script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=37813#p37813"><![CDATA[
<blockquote class="uncited"><div>...I don't get confused where an if ends and where another starts. </div></blockquote>well, this is no matter of if or switch - this is a matter of how you format your code <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2617">arcane</a> — Thu Jun 24, 2004 2:38 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[DarkJFMan]]></name></author>
		<updated>2004-06-23T05:30:28-04:00</updated>

		<published>2004-06-23T05:30:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=37745#p37745</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=37745#p37745"/>
		<title type="html"><![CDATA[advertising script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=37745#p37745"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code> bind pubm - "*#*" pub:adv  proc pub:adv {nick uhost hand chan arg} {    global logo botnick ad    if {![isop $nick $chan] &amp;&amp; ![isvoice $nick $chan] &amp;&amp; ![validuser $hand] &amp;&amp; ([string tolower $chan] == "#hooters")} {      if {![info exists ad($uhost)]} {        set ad($uhost) 1      } else {        incr ad($uhost)      }      if {$ad($uhost) == 1} {        putserv "NOTICE $nick :Please don't advertise"      } elseif {$ad($uhost) == 2} {        putserv "MODE $chan +b *!*@[set bh [lindex [split $uhost @] 1]]"        putserv "KICK $chan $nick :Don't advertise in here."        utimer 600 [list putserv "MODE $chan -b *!*@$bh"]      } elseif {$ad($uhost) == 3} {        putserv "MODE $chan +b *!*@[set bh [lindex [split $uhost @] 1]]"        putserv "KICK $chan $nick :Don't advertise in here."        utimer 1800 [list putserv "MODE $chan -b *!*@$bh"]      }      utimer 3600 [list unset ad($uhost)]    }  }</code></pre></div><blockquote class="uncited"><div>[01:13:15am] &lt;DarkJFGirl&gt; [04:15] wrong # args: should be "proc name args body"</div></blockquote>any ideas?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4261">DarkJFMan</a> — Wed Jun 23, 2004 5:30 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2004-06-23T00:04:21-04:00</updated>

		<published>2004-06-23T00:04:21-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=37725#p37725</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=37725#p37725"/>
		<title type="html"><![CDATA[advertising script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=37725#p37725"><![CDATA[
Indeed.. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_redface.gif" width="15" height="15" alt=":oops:" title="Embarassed"> switch kinda suck <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><br><br>Well, yes, if you want to get just a result for 1, 2, 3 or default (nothing) then switch is good, else a bunch of if's if there are a lot of checks.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Wed Jun 23, 2004 12:04 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[strikelight]]></name></author>
		<updated>2004-06-22T17:56:02-04:00</updated>

		<published>2004-06-22T17:56:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=37716#p37716</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=37716#p37716"/>
		<title type="html"><![CDATA[advertising script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=37716#p37716"><![CDATA[
<blockquote class="uncited"><div>To be honest I like switch more that a bunch of if's cos it looks a lot nicer and I don't get confused where an if ends and where another starts. Also, the switch has a lot more *features* that a bunch of if's. I did a lil test on my own with the exact example you gave and here are my results.<blockquote class="uncited"><div>% time {testa 0} <br>11 microseconds per iteration<br>% time {testb 0} <br>12 microseconds per iteration<br>% time {testa 1} <br>11 microseconds per iteration<br>% time {testa 1} <br>11 microseconds per iteration<br>% time {testa 1} <br>11 microseconds per iteration<br>% time {testb 0}<br>43 microseconds per iteration<br>% time {testb 0}<br>13 microseconds per iteration<br>% time {testb 0}<br>13 microseconds per iteration</div></blockquote>I'll let you be the judge of this. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_mrgreen.gif" width="15" height="15" alt=":mrgreen:" title="Mr. Green"></div></blockquote>proc testb was the one with "switch"...<br>and you have a 43 microseconds result for it... lol ;p<br><br>But seriously, what happened there was probably a cpu spike, where the cpu was doing work some where else at the time.<br><br>And as for switch having more features... not true.....<br>For example, say if you wanted to check against what $var1 was AND what $var2 was..... you could have a bunch of nested switches which would be really ugly and inefficient, or you could use the &amp;&amp; expression within if statements, which is alot neater and proper.<br><br>Don't get me wrong, switch has it's uses, I use it.. but you have to know when it's really more convenient to do so.. This specific example may be one of those times even.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2005">strikelight</a> — Tue Jun 22, 2004 5:56 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[DarkJFMan]]></name></author>
		<updated>2004-06-22T16:44:18-04:00</updated>

		<published>2004-06-22T16:44:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=37712#p37712</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=37712#p37712"/>
		<title type="html"><![CDATA[advertising script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=37712#p37712"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code># Advertisebind pubm - # pub:advproc pub:adv {nick uhost hand chan text} {global spamset advnick($uhost) 0if {[isop $nick $chan] || [isvoice $nick $chan]} {return 0}elseif {[string equal -nocase $chan "#hooters"]} {incr advnick{$uhost}}elseif {$advnick($uhost) == 1} {putserv "NOTICE $nick :Please don't advertise here}elseif {$advnick($uhost} == 2} {putserv "MODE $chan +b *!*@[join [lindex [split $uhost "@"] 1]]"putkick $chan $nick "TempBan 10 min for advertising"utimer 600 [list putserv "MODE $chan -b *!*@[join [lindex [split $uhost "@"] 1 ]]"}elseif {$advnick($uhost) == 3} {putserv "MODE $chan +b *!*@[join [lindex [split $uhost "@"] 1 ]]"putkick $chan $nick "TempBan 30 min for advertising"utimer 1800 [list putserv "MODE $chan -b *!*@[join [lindex [split $uhost "@"] 1 ]]"}utimer 3600 [list unset $advnick($uhost)]}}</code></pre></div>I still have no idea how to make it switch, and can you please check if code is completely correct, i swtiches &amp;&amp; with || and make it pubm. so with that should the script work fine?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4261">DarkJFMan</a> — Tue Jun 22, 2004 4:44 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2004-06-22T15:18:48-04:00</updated>

		<published>2004-06-22T15:18:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=37707#p37707</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=37707#p37707"/>
		<title type="html"><![CDATA[advertising script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=37707#p37707"><![CDATA[
To be honest I like switch more that a bunch of if's cos it looks a lot nicer and I don't get confused where an if ends and where another starts. Also, the switch has a lot more *features* that a bunch of if's. I did a lil test on my own with the exact example you gave and here are my results.<blockquote class="uncited"><div>% time {testa 0} <br>11 microseconds per iteration<br>% time {testb 0} <br>12 microseconds per iteration<br>% time {testa 1} <br>11 microseconds per iteration<br>% time {testa 1} <br>11 microseconds per iteration<br>% time {testa 1} <br>11 microseconds per iteration<br>% time {testb 0}<br>43 microseconds per iteration<br>% time {testb 0}<br>13 microseconds per iteration<br>% time {testb 0}<br>13 microseconds per iteration</div></blockquote>I'll let you be the judge of this. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_mrgreen.gif" width="15" height="15" alt=":mrgreen:" title="Mr. Green"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Tue Jun 22, 2004 3:18 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[strikelight]]></name></author>
		<updated>2004-06-22T15:13:47-04:00</updated>

		<published>2004-06-22T15:13:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=37706#p37706</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=37706#p37706"/>
		<title type="html"><![CDATA[advertising script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=37706#p37706"><![CDATA[
<blockquote class="uncited"><div>Use switch cos is a lot faster to check &lt;snip&gt;</div></blockquote>You've been saying this alot lately... for the record, they are pretty much equal performance wise:<br><div class="codebox"><p>Code: </p><pre><code>% proc testa {var} {  if {$var == 0} {    return $var  } elseif {$var == 1} {    return $var  } elseif {$var == 2} {    return $var  } elseif {$var == 3} {    return $var  } }% proc testb {var} {  switch -- $var {    "0" { return $var }    "1" { return $var }    "2" { return $var }    "3" { return $var }  }}% time {testa 0} 1007 microseconds per iteration% time {testb 0} 1006 microseconds per iteration% time {testa 1} 1006 microseconds per iteration% time {testb 1} 1005 microseconds per iteration% time {testa 2} 1005 microseconds per iteration% time {testb 2} 1005 microseconds per iteration% time {testa 3} 1003 microseconds per iteration% time {testb 3} 1005 microseconds per iteration</code></pre></div>The advantage switch holds over if's, is its compactness in typing out a scenario, not performance however.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2005">strikelight</a> — Tue Jun 22, 2004 3:13 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2004-06-22T12:02:47-04:00</updated>

		<published>2004-06-22T12:02:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=37700#p37700</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=37700#p37700"/>
		<title type="html"><![CDATA[advertising script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=37700#p37700"><![CDATA[
Consult the tcl-commands.doc file for the difference betwen pub and pubm.<br><br>&amp;&amp; stands for AND and || stand for OR<br><br>Use switch cos is a lot faster to check if $advnick($uhost) is equal with 1, 2 or 3.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Tue Jun 22, 2004 12:02 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[DarkJFMan]]></name></author>
		<updated>2004-06-22T06:52:24-04:00</updated>

		<published>2004-06-22T06:52:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=37694#p37694</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=37694#p37694"/>
		<title type="html"><![CDATA[advertising script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=37694#p37694"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>bind pub - # pub:advproc pub:adv {nick uhost hand chan text} {global spamset advnick($uhost) 0if {[isop $nick $chan] &amp;&amp; [isvoice $nick $chan]} {return 0}elseif {[string equal -nocase $chan "#hooters"]} {inc advnick{$uhost}}elseif {$advnick($uhost) == 1} {putserv "NOTICE $nick :Please don't advertise here}elseif {$advnick($uhost} == 2} {putserv "MODE $chan +b *!*@[join [lindex [split $uhost "@"] 1]]"putkick $chan $nick "TempBan 10 min for advertising"utimer 600 [list putserv "MODE $chan -b *!*@[join [lindex [split $uhost "@"] 1 ]]"}elseif {$advnick($uhost) == 3} {putserv "MODE $chan +b *!*@[join [lindex [split $uhost "@"] 1 ]]"putkick $chan $nick "TempBan 30 min for advertising"utimer 1800 [list putserv "MODE $chan -b *!*@[join [lindex [split $uhost "@"] 1 ]]"}utimer 3600 [list unset $advnick($uhost)]}}</code></pre></div>Could this work at all?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4261">DarkJFMan</a> — Tue Jun 22, 2004 6:52 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[DarkJFMan]]></name></author>
		<updated>2004-06-22T03:33:28-04:00</updated>

		<published>2004-06-22T03:33:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=37690#p37690</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=37690#p37690"/>
		<title type="html"><![CDATA[advertising script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=37690#p37690"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>bind pub - "#" pub:advproc pub:adv {nick uhost hand chan arg} {global logo botnickif {[nickisreg $chan]} &amp;&amp; {[string equal -nocase $chan "#hooters"]} {set ad. [ [ $nick ] ]if {ad. [ [ $nick ] ] == 1 } {pustserv "NOTICE $nick :Please don't advertise}if {ad. [ [ $nick ] ] == 2 } {putserv "MODE $chan +b *!*@[join [lindex [split [$uhost] "@"] 1]]"putkick $chan $nick "Don't advertise in here."utimer 600 [list putserv "MODE $chan -b *!*@[join [lindex [split [$uhost] "@"] 1]]"]}if {ad. [ [ $nick ] ] == 3 } {putserv "MODE $chan +b *!*@[join [lindex [split [$uhost] "@"] 1]]"putkick $chan $nick "Don't advertise in here."utimer 1800 [list putserv "MODE $chan -b *!*@[join [lindex [split [$uhost] "@"] 1]]"]}unset ad . [ [ $nick ] ]}</code></pre></div>That's what I got from 1 and 4, by using arrays, do you mean create a new file, and make it write in there:<br>DarkJFMan == 2<br>someguy == 1 ...<br><blockquote class="uncited"><div>2. Use arrays, write in to file how many warnings did a user got.<br>3. instead of lots of if's use switch cos is a lot faster.</div></blockquote>And i have never used switch, can you give me an example plz thank you.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4261">DarkJFMan</a> — Tue Jun 22, 2004 3:33 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Alchera]]></name></author>
		<updated>2004-06-21T18:22:50-04:00</updated>

		<published>2004-06-21T18:22:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=37678#p37678</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=37678#p37678"/>
		<title type="html"><![CDATA[advertising script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=37678#p37678"><![CDATA[
Sorry DarkJFMan, I misread your post.  Was fairly distracted at the time.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3646">Alchera</a> — Mon Jun 21, 2004 6:22 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2004-06-21T11:45:22-04:00</updated>

		<published>2004-06-21T11:45:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=37671#p37671</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=37671#p37671"/>
		<title type="html"><![CDATA[advertising script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=37671#p37671"><![CDATA[
1. [getchanhost $nick] = $uhost<br>2. Use arrays, write in to file how many warnings did a user got.<br>3. instead of lots of if's use switch cos is a lot faster.<br>4. string match $chan #hooters ? better string equal -nocase $chan "#hooters"<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Mon Jun 21, 2004 11:45 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[DarkJFMan]]></name></author>
		<updated>2004-06-21T11:17:50-04:00</updated>

		<published>2004-06-21T11:17:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=37670#p37670</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=37670#p37670"/>
		<title type="html"><![CDATA[advertising script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=37670#p37670"><![CDATA[
i made the script, i just want to know if it's correct, because when i made it, it was in mirc scripting, and i changed it to tcl, i'm just asking is this the way you do it?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4261">DarkJFMan</a> — Mon Jun 21, 2004 11:17 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Alchera]]></name></author>
		<updated>2004-06-21T08:41:08-04:00</updated>

		<published>2004-06-21T08:41:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=37667#p37667</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=37667#p37667"/>
		<title type="html"><![CDATA[advertising script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=37667#p37667"><![CDATA[
You answered your own question. Next time read the script description.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3646">Alchera</a> — Mon Jun 21, 2004 8:41 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[DarkJFMan]]></name></author>
		<updated>2004-06-21T07:02:30-04:00</updated>

		<published>2004-06-21T07:02:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=37664#p37664</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=37664#p37664"/>
		<title type="html"><![CDATA[advertising script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=37664#p37664"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>bind pub - "#" pub:advproc pub:adv {nick uhost hand chan arg} {global logo botnickif {[nickisreg $chan]} &amp;&amp; {[string match $chan #hooters]} {set ad. [ [ $nick ] ]if {ad. [ [ $nick ] ] == 1 } { pustserv "NOTICE $nick :Please don't advertise}if {ad. [ [ $nick ] ] == 2 } {putserv "MODE $chan +b *!*@[join [lindex [split [getchanhost $nick] "@"] 1]]"putkick $chan $nick "Don't advertise in here."utimer 600 [list putserv "MODE $chan -b *!*@[join [lindex [split [getchanhost $nick] "@"] 1]]"]}if {ad. [ [ $nick ] ] == 3 } {putserv "MODE $chan +b *!*@[join [lindex [split [getchanhost $nick] "@"] 1]]"putkick $chan $nick "Don't advertise in here."utimer 1800 [list putserv "MODE $chan -b *!*@[join [lindex [split [getchanhost $nick] "@"] 1]]"]}unset ad . [ [ $nick ] ]}</code></pre></div>What this script supposed to do, is if someone is trying to use # which usualy used for chan for advertising, 1) warn in notice 2) ban for 10 min 3) ban for 30 min<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4261">DarkJFMan</a> — Mon Jun 21, 2004 7:02 am</p><hr />
]]></content>
	</entry>
	</feed>
