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

	<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>2007-02-08T06:58:34-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Happolo2]]></name></author>
		<updated>2006-01-28T10:03:07-04:00</updated>

		<published>2006-01-28T10:03:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=59824#p59824</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=59824#p59824"/>
		<title type="html"><![CDATA[Script for banning on join if the nick isn't in a list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=59824#p59824"><![CDATA[
Hi Sir_Fz and hi all again.<br>Now the eggdrop load without any problems but it doesn't works.<br>Sometimes it bans randomly a nick with the message: "badnick".<br>But as i said... it's a random ban. The nick can be or not be in the list.<br><br>The !add and the !del commands doesn't work as well. <br><br>Unfortunately i can't say anything else 'cause also in telnet no error appears.<br><br>I just know that it doesn't work. Can be a shell trouble? Can be a bad set in the .conf file? Can be a problem of the net? Have i to make any other commands before can use !add or !del ? Can be a list problem? <br>I don't know which info i can give you for helping you to help me <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> Just ask pls.<br><br>Thank you.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7245">Happolo2</a> — Sat Jan 28, 2006 10:03 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2006-01-25T20:19:18-04:00</updated>

		<published>2006-01-25T20:19:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=59731#p59731</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=59731#p59731"/>
		<title type="html"><![CDATA[Script for banning on join if the nick isn't in a list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=59731#p59731"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>puts $f "[incr count]=$n"}</code></pre></div>should be<div class="codebox"><p>Code: </p><pre><code>puts $f "[incr count]=$n"</code></pre></div>I fixed it.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Wed Jan 25, 2006 8:19 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Happolo2]]></name></author>
		<updated>2006-01-25T20:01:02-04:00</updated>

		<published>2006-01-25T20:01:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=59728#p59728</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=59728#p59728"/>
		<title type="html"><![CDATA[Script for banning on join if the nick isn't in a list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=59728#p59728"><![CDATA[
Now i had this error loading the eggdrop:<br><blockquote class="uncited"><div>Tcl error in file 'killer.conf':<br>can not find channel named "file11"<br>    while executing<br>"close $f "<br>    (file "scripts/scriptfinale.tcl" line 21)<br>    invoked from within<br>"source scripts/scriptfinale.tcl"<br>    (file "killer.conf" line 323)</div></blockquote>(killer.conf it's the config file, scriptfinale.tcl it's the tcl where i copied your script).<br><br><br>----<br><br>I tried to add a {  <br><br>instead of <br><blockquote class="uncited"><div>proc save args { </div></blockquote>i wrote:<br><blockquote class="uncited"><div>proc save args {{ </div></blockquote><br>---<br><br>now it loads but it gives me this error:<br><blockquote class="uncited"><div> Tcl error [save]: invalid command name "<br> set f [open nick.txt w]<br> set count 0<br> foreach n $::nlist {<br>  if {$n != ""} {<br>   puts $f "[incr count]=$n"}<br>  }<br></div></blockquote>---<br><br>Maybe i put the { in the wrong place.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7245">Happolo2</a> — Wed Jan 25, 2006 8:01 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2006-01-25T19:00:16-04:00</updated>

		<published>2006-01-25T19:00:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=59723#p59723</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=59723#p59723"/>
		<title type="html"><![CDATA[Script for banning on join if the nick isn't in a list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=59723#p59723"><![CDATA[
For fixing the error, replace<div class="codebox"><p>Code: </p><pre><code>if {[set i [lsearch -exact $::nlist [string tolower $t]]] != -1}</code></pre></div>with<div class="codebox"><p>Code: </p><pre><code>if {[set i [lsearch -exact $::nlist [string tolower $t]]] != -1} {</code></pre></div>As for the nicks.txt format, make sure that the nicks are stored each on a new line because I don't see why it shouldn't read or write correctly.<br><br>Edit: I've edited the code above, try it now and see if the problem persists. (I've made some changes to reading and writing)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Wed Jan 25, 2006 7:00 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Happolo2]]></name></author>
		<updated>2006-01-25T18:33:34-04:00</updated>

		<published>2006-01-25T18:33:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=59722#p59722</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=59722#p59722"/>
		<title type="html"><![CDATA[Script for banning on join if the nick isn't in a list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=59722#p59722"><![CDATA[
Hi again.<br>Sorry if i haven't thank you before but i was busy in real life.<br>By the way i tried to config my first eggdrop (i thought it was easier) and to make the script as you wrote.<br><br>I've some problems with it.<br><br>Before starting the bot my nick list finishes with:<br><br>613=last nick in the list<br><br><br><br>As soon as i start the bot... the nick list becomes:<br><br>613=last nick in the list<br>614=<br>615=<br>616=<br><br><br>Then when i try to use:<br><br>!add nick<br><br>I can read this thing in the telnet:<br><br>Tcl error [bar]: wrong # args: no script following "{[set i [lsearch -exact $::nlist [string tolower $" argument<br><br><br>Can someone help me with this error?<br><br>I don't know if can be usefull to know, the nick.txt is in the main directory of the eggdrop and not in the one with tcl scripts.<br><br><br>Also the !del nick doesn't work.<br>The error is the same:<br><br>Tcl error [bar]: wrong # args: no script following "{[set i [lsearch -exact $::nlist [string tolower $" argument<br><br><br>Thank you again to everybody.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7245">Happolo2</a> — Wed Jan 25, 2006 6:33 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2007-02-08T06:58:34-04:00</updated>

		<published>2006-01-18T07:20:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=59518#p59518</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=59518#p59518"/>
		<title type="html"><![CDATA[Script for banning on join if the nick isn't in a list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=59518#p59518"><![CDATA[
<blockquote class="uncited"><div><blockquote class="uncited"><div> <br>1) you can, but you'll have to remove the 1=,2=...etc from each line or alter the script to skip it (but removing them is better).</div></blockquote>I try to explain why i was asking for using .ini file or .txt file but not modified.<br>Now with Mirc we have 3 mirc clients running this script on three different computers. So sometimes we have to check to have on each mirc the same list of nicks or a nick can be banned because it is only on 2 lists because the third client was out of the channel when the list has been modified.<br>Now i wanted to make this script running on the shell by the eggdrop and not on the computer... and with your precious help i think i can do it.<br>Just i thought to the Dcc send command ... so everyone (botmasters) can download the nick list from the shell and put it in his script on the mirc client on his computer.<br>The problem is that if i can't use the .ini file or if i've to modified the .txt file ... it becomes difficult to have a fast "upgrade" of all lists. (cause the list has more or less 600 nicks).<br>This is the reason for which i was asking if it was possible to use .ini file or .txt files "just changing .ini to .txt extension".</div></blockquote>Use:<div class="codebox"><p>Code: </p><pre><code># initialize empty nick listset nlist {}# try to read in the list from fileif ![catch {set f [open file.txt]}] { foreach nnick [split [read $f][close $f] \n] {  if {$nnick != ""} {   lappend nlist [string tolower [regsub {^[0-9]+=} $nnick ""]]  } }}# save the list into file every minutebind time - * saveproc save args { set f [open file.txt w] set count 0 foreach n $::nlist {  if {$n != ""} {   puts $f "[incr count]=$n"  } } close $f}bind join - {#yourchan %} fooproc foo {n u h c} {# don't check +o botusers if [matchattr $h o|o $c] return if {[lsearch -exact $::nlist [string tolower $n]] != -1} {  newchanban $c $n!*@* $::nick badnick 5  putkick $c $n badnick }}# allow commands from botmasters onlybind pub m !add barbind pub m !del barproc bar {n u h c t} { if {$::lastbind == "!add"} {  if {[lsearch -exact $::nlist [string tolower $t]] == -1} {   lappend ::nlist [string tolower $t]  } } {  if {[set i [lsearch -exact $::nlist [string tolower $t]]] != -1} {   set ::nlist [lreplace $::nlist $i $i]  } }}bind pub m !take mooproc moo {n args} { if {[dccsend file.txt $n] != 0} {  puthelp "notice $n :cannot send" }}</code></pre></div>This way you're able to use the file of list format like <strong class="text-strong">number=nick</strong>.<br><br>Edit2: Fixed bug in !add cmd.<br>Edit: Fixed Tcl error and edited the reading and writing.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Wed Jan 18, 2006 7:20 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2006-01-17T00:41:37-04:00</updated>

		<published>2006-01-17T00:41:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=59473#p59473</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=59473#p59473"/>
		<title type="html"><![CDATA[Script for banning on join if the nick isn't in a list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=59473#p59473"><![CDATA[
<blockquote class="uncited"><div>Is there a way for knowing which Tcl Version is on the server where i have my shell account? If there is a different version if i'm not wrong i could be able to install the version i like ... doesn't it?</div></blockquote>in your shell, type <em class="text-italics">tclsh</em> and then <em class="text-italics">info patchlevel</em><br><br>you can install your own Tcl library in your home directory by using <em class="text-italics">--prefix=/path/to/your/home/dir</em> switch of Tcl's <em class="text-italics">configure</em> script; then you'll need to recompile your bot against that library by using <em class="text-italics">--with-tcllib</em> and <em class="text-italics">--with-tclinc</em> switches of eggdrop's configure<br><br>but I wouldn't bother to install Tcl 8.5 just for the sake of using <em class="text-italics">-nocase</em> with [lsearch]<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Tue Jan 17, 2006 12:41 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Happolo2]]></name></author>
		<updated>2006-01-16T14:40:01-04:00</updated>

		<published>2006-01-16T14:40:01-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=59460#p59460</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=59460#p59460"/>
		<title type="html"><![CDATA[Script for banning on join if the nick isn't in a list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=59460#p59460"><![CDATA[
<blockquote class="uncited"><div> <br>1) you can, but you'll have to remove the 1=,2=...etc from each line or alter the script to skip it (but removing them is better).</div></blockquote>I try to explain why i was asking for using .ini file or .txt file but not modified.<br>Now with Mirc we have 3 mirc clients running this script on three different computers. So sometimes we have to check to have on each mirc the same list of nicks or a nick can be banned because it is only on 2 lists because the third client was out of the channel when the list has been modified.<br>Now i wanted to make this script running on the shell by the eggdrop and not on the computer... and with your precious help i think i can do it.<br>Just i thought to the Dcc send command ... so everyone (botmasters) can download the nick list from the shell and put it in his script on the mirc client on his computer.<br>The problem is that if i can't use the .ini file or if i've to modified the .txt file ... it becomes difficult to have a fast "upgrade" of all lists. (cause the list has more or less 600 nicks).<br>This is the reason for which i was asking if it was possible to use .ini file or .txt files "just changing .ini to .txt extension".<br><blockquote class="uncited"><div>2) You can but what are you so worried about, the list is being saved.</div></blockquote>I was just curious ... it's more than ok also with a save each minute <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><blockquote class="uncited"><div>3) <strong class="text-strong">!del nick</strong> is enough for deleting.</div></blockquote>[/quote]<br><br>Thanks <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>---<br><br>I add another question if i can. <br><blockquote class="uncited"><div># check if the joining nick is on the list <br># -nocase will only work on Tcl 8.5 and higher <br># for case-insensitive search on older Tcl versions,</div></blockquote>Is there a way for knowing which Tcl Version is on the server where i have my shell account? If there is a different version if i'm not wrong i could be able to install the version i like ... doesn't it?<br><br>----<br><br>Well thank you again for being so helpfull and with so much patience <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=7245">Happolo2</a> — Mon Jan 16, 2006 2:40 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2006-01-16T09:08:44-04:00</updated>

		<published>2006-01-16T09:08:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=59441#p59441</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=59441#p59441"/>
		<title type="html"><![CDATA[Script for banning on join if the nick isn't in a list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=59441#p59441"><![CDATA[
<blockquote class="uncited"><div>Really thanks to everybody. <br>Now i'm sure that i couldn't do it by myself <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><br><br>I try to ask you some things for trying to understand and learn.<br><br>1) <blockquote class="uncited"><div># initialize empty nick list <br>set nlist {} </div></blockquote>Now with mirc i use an .ini file of this kind:<br><br>[ list ]<br>1=nick1<br>2=nick2<br>...<br>600=nick600<br><br>----<br><br>Now if i convert this file from .ini to .txt and i upload it on the shell, can i let the bot using this file? Or have i to create an empty new one and add each nick through the bot and the !add command?<br><br><br><br>2) instead of <blockquote class="uncited"><div># save the list into file every minute <br>bind time - * save <br>proc save args { <br>   set f [open file.txt w] <br>   foreach n $::nlist {puts $f $n} <br>   close $f <br>} </div></blockquote>is it possible to save the file only when it is changed using !add or !del commands and not every minute? <br><br><br>3) i haven't understood the "delete" part of the script.<br>I mean if i type<br>!add bar nick1<br>it should add the nick1 to the list<br><br>if i type <br>!del bar nick1  does it works or have i to type !del bar "index" ? or another command?<br><br><br>Sorry if my questions are stupid but i prefer to try to understand what i'm doing and not only to copy a script.<br><br>Thanks again for your big help.</div></blockquote>1) you can, but you'll have to remove the 1=,2=...etc from each line or alter the script to skip it (but removing them is better).<br><br>2) You can but what are you so worried about, the list is being saved.<br><br>3) <strong class="text-strong">!del nick</strong> is enough for deleting.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Mon Jan 16, 2006 9:08 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Happolo2]]></name></author>
		<updated>2006-01-16T08:24:36-04:00</updated>

		<published>2006-01-16T08:24:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=59439#p59439</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=59439#p59439"/>
		<title type="html"><![CDATA[Script for banning on join if the nick isn't in a list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=59439#p59439"><![CDATA[
Really thanks to everybody. <br>Now i'm sure that i couldn't do it by myself <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><br><br>I try to ask you some things for trying to understand and learn.<br><br>1) <blockquote class="uncited"><div># initialize empty nick list <br>set nlist {} </div></blockquote>Now with mirc i use an .ini file of this kind:<br><br>[ list ]<br>1=nick1<br>2=nick2<br>...<br>600=nick600<br><br>----<br><br>Now if i convert this file from .ini to .txt and i upload it on the shell, can i let the bot using this file? Or have i to create an empty new one and add each nick through the bot and the !add command?<br><br><br><br>2) instead of <blockquote class="uncited"><div># save the list into file every minute <br>bind time - * save <br>proc save args { <br>   set f [open file.txt w] <br>   foreach n $::nlist {puts $f $n} <br>   close $f <br>} </div></blockquote>is it possible to save the file only when it is changed using !add or !del commands and not every minute? <br><br><br>3) i haven't understood the "delete" part of the script.<br>I mean if i type<br>!add bar nick1<br>it should add the nick1 to the list<br><br>if i type <br>!del bar nick1  does it works or have i to type !del bar "index" ? or another command?<br><br><br>Sorry if my questions are stupid but i prefer to try to understand what i'm doing and not only to copy a script.<br><br>Thanks again for your big help.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7245">Happolo2</a> — Mon Jan 16, 2006 8:24 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2006-01-16T06:16:48-04:00</updated>

		<published>2006-01-16T06:16:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=59437#p59437</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=59437#p59437"/>
		<title type="html"><![CDATA[Script for banning on join if the nick isn't in a list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=59437#p59437"><![CDATA[
You might also want to avoid duplicates, instead of<div class="codebox"><p>Code: </p><pre><code>if {$::lastbind == "add"} {   lappend ::nlist $t} else {</code></pre></div>use<div class="codebox"><p>Code: </p><pre><code>if {$::lastbind == "!add"} {   if {[lsearch -noc $::nlist $t] == -1} {      lappend ::nlist $t   }} else {</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Mon Jan 16, 2006 6:16 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[metroid]]></name></author>
		<updated>2006-01-16T03:34:12-04:00</updated>

		<published>2006-01-16T03:34:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=59433#p59433</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=59433#p59433"/>
		<title type="html"><![CDATA[Script for banning on join if the nick isn't in a list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=59433#p59433"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>if {$::lastbind == "add"} { </code></pre></div>should be<br><div class="codebox"><p>Code: </p><pre><code>if {$::lastbind == "!add"} { </code></pre></div>if the bind is !add (if i'm not mistaken :p)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5078">metroid</a> — Mon Jan 16, 2006 3:34 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2006-01-16T00:31:06-04:00</updated>

		<published>2006-01-16T00:31:06-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=59430#p59430</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=59430#p59430"/>
		<title type="html"><![CDATA[Re: Script for banning on join if the nick isn't in a list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=59430#p59430"><![CDATA[
<blockquote class="uncited"><div>1) the file with the nick list ... on the shell... could be written/and read by the bot?<br>2) with the mirc script i use... this file is a .ini file. Must be the same for the bot? Have i to use a .txt file?<br>3) How can i say to the bot to take commands only from some nicks? Have i to make another file with a list? Is it enough to use flags?<br>4) Is it possible the use of dcc send for let the bot sending the file's list?<br>5) I think especially for nicks with { or [ should be more difficult for avoiding conflicts with the script.<br>6) Do i need any particular configuration of the bot for running a script such this one?</div></blockquote>1) yes<br>2) no<br>3) bind to flags<br>4) yes<br>5) not at all<br>6) no<br><div class="codebox"><p>Code: </p><pre><code># initialize empty nick listset nlist {}# try to read in the list from fileif ![catch {set f [open file.txt]}] {   set nlist [split [read $f] \n]; close $f}# save the list into file every minutebind time - * saveproc save args {   set f [open file.txt w]   foreach n $::nlist {puts $f $n}   close $f}bind join - {#yourchan %} fooproc foo {n u h c} {# don't check +o botusers   if [matchattr $h o|o $c] return# check if the joining nick is on the list# -nocase will only work on Tcl 8.5 and higher# for case-insensitive search on older Tcl versions,# apply [string tolower] on [lsearch] arguments   if {[lsearch -noc $::nlist $n] != -1} {      newchanban $c $n!*@* $::nick badnick 5      putkick $c $n badnick   }}# allow commands from botmasters onlybind pub m !add barbind pub m !del barproc bar {n u h c t} {   if {$::lastbind == "add"} {      lappend ::nlist $t   } else {# Tcl has no 'delete from list by element name' command,# so we need to get element's index first and then use it with [lreplace]      if {[set i [lsearch -noc $::nlist $t]] != -1}         set ::nlist [lreplace $::nlist $i $i]      }   }}bind pub m !take mooproc moo {n args} {   if {[dccsend file.txt $n] != 0} {      puthelp "notice $n :cannot send"   }}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Mon Jan 16, 2006 12:31 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Happolo2]]></name></author>
		<updated>2006-01-15T19:45:33-04:00</updated>

		<published>2006-01-15T19:45:33-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=59420#p59420</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=59420#p59420"/>
		<title type="html"><![CDATA[Script for banning on join if the nick isn't in a list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=59420#p59420"><![CDATA[
Hi.<br>First of all, hi to everybody. I'm new here and i'm a real newbie in Tcl scripting too. (and sorry for my english too but it's not my first language).<br><br>I wanted to try to learn and to make a script by myself but i need a script that it's a bit too difficult for being my first script <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> and so i prefer to ask some help.<br><br>I need a script for my eggdrop. The script should make a check when a nick joins in a specific channel. If the nick is on a list in a file on the shell the bot has to do nothing. If the nick isn't in the list the bot has to ban the nick (only the nick - so +b nick!*@*), and then delete the ban after 5 minutes. With the ban it has to send also a message to the banned nick.<br><br>The file with nicknames must be editable by some nicks with !add nick or !del nick commands. <br><br>Last... could be possible with a command like !take list ... (available only for some nicks) ... that the bot will send (through a dcc send) the file with the nick list?<br><br>... i was forgotten... could be possible to have a switch for running or not this script? I mean a !start and a !stop command.<br><br><br>I'm a newbie so it's all difficult for me.. but i've especially some doubts:<br><br>1) the file with the nick list ... on the shell... could be written/and read by the bot?<br>2) with the mirc script i use... this file is a .ini file. Must be the same for the bot? Have i to use a .txt file?<br>3) How can i say to the bot to take commands only from some nicks? Have i to make another file with a list? Is it enough to use flags?<br>4) Is it possible the use of dcc send for let the bot sending the file's list?<br>5) I think especially for nicks with { or [ should be more difficult for avoiding conflicts with the script.<br>6) Do i need any particular configuration of the bot for running a script such this one?<br><br><br>I try to past the script i'm using with mirc if can help to explain better what i need.<br>(the script hasn't the xdcc send option ... that i'd like to add for the bot).<br><br><blockquote class="uncited"><div>;Name of the #channel and reason of the ban<br>alias protect.chan return #channel<br>alias motivo.ban return Guardian Banned You (Reason of the Ban)<br><br>;Nicks than can use !add or !del commands<br>;%except is for nicks won't be checked by the bot<br><br>on *:text:*:#:{ <br>  if ($chan == $protect.chan) {<br>    if ($nick == first nick) || ($nick == second nick) || ($nick == ...all nicks can use !add or !del)  { <br>      if ($1 == !add) { add $2 }<br>      if ($1 == !del) { del $2 }<br>    }<br>  }<br>}<br><br>on *:join:#:{<br>  var %except = specialnicks*<br>  if ($chan == $protect.chan) {<br>    if ($youarein($nick) || (%except iswm $nick)) { .notice $nick 4Welcome 7 $nick 8In 9#channel 4:) }<br>    else { .timer -o 1 $calc( 10 * 60) .mode # -b $nick | .mode # +b $nick | .kick # $nick 8Reason of the Ban }<br>  }<br>}<br><br>on *:INPUT:#: {<br>  if (!add == $1) { add $2 }<br>  if (!del == $1) { del $2 }<br>} <br><br>alias youarein {<br>  var %total = %nicks<br>  var %x = 1<br>  if (%total != 0) {<br>    while (%x &lt;= %total) {<br>      if ($readini(nick.ini, list, %x) == $1) { return $true }<br>      inc %x<br>    }<br>  }<br>  return $false<br>}<br><br>alias add {<br>  if (!$youarein($1)) {<br>    inc %nicks<br>    .writeini nick.ini list %nicks $1<br>    .msg $protect.chan 9Added0,1 $1 4to the list!<br>    echo -a 9Added0,1 $1 4to the list!<br><br>  }<br>  else { msg $protect.chan 9 $1 0,1It's already 4in the list! }<br>}<br><br>alias del {<br>  if ($youarein($1)) {<br>    var %x = 1<br>    while (%x &lt;= $calc(%nicks - 1)) { <br>      if ($readini(nick.ini,list,%x) == $1) &amp;&amp; (%a != $true) { .writeini nick.ini list %x $readini(nick.ini,list,$calc(%x + 1)) | var %a = $true }<br>      if (%a == $true) { .writeini nick.ini list %x $readini(nick.ini,list,$calc(%x + 1)) }<br>      inc %x<br>    }<br>    .remini nick.ini list %nicks<br>    dec %nicks<br>    .msg $protect.chan 9 $1 0,1deleted from 4the list!<br>    echo -a 9Deleted0,1 $1 4from the list!<br><br>  }<br>  else { msg $protect.chan 9Il Nick0,1 $2 4Isn't in the list! }<br>}<br><br>alias debug.nick {<br>  set %debug.nick on<br>  var %x = 1<br>  while (%debug.nick == on) {<br>    if ($readini(nick.ini,list,%x)) { inc %x }<br>    else { set %nicks $calc(%x - 1) | set %debug.nick off }<br>  }<br>}<br><br>on 1:START:{ debug.nick }<br>on *:LOAD:{ set %nicks 0 } </div></blockquote><br>Thank you to everybody.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7245">Happolo2</a> — Sun Jan 15, 2006 7:45 pm</p><hr />
]]></content>
	</entry>
	</feed>
