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

	<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-21T18:33:59-04:00</updated>

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

		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2007-02-21T18:33:59-04:00</updated>

		<published>2007-02-21T18:33:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=70614#p70614</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=70614#p70614"/>
		<title type="html"><![CDATA[.add .del .list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=70614#p70614"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set datafile "/tmp/data.txt"bind pub - add procaddbind pub - del procdelbind pub - list proclistproc procadd {nick uhost hand chan text} {        global datafile        set text [split $text]        set ahand [lindex $text 0]        set amask [lindex $text 1]        set alvl [lindex $text 2]        # check for valid input        if {$ahand == "" || $amask == "" || $alvl == ""} {                puthelp "PRIVMSG $nick :Usage: add &lt;handle&gt; &lt;mask&gt; &lt;level&gt;"                return        }        # check for duplicate handles        if {[file exists $datafile]} {                set input [open $datafile r]                while {![eof $input]} {                        set curline [gets $input];set curline [split $curline]                        if {[lindex $curline 0] == $ahand} {                                puthelp "PRIVMSG $nick :handle $ahand already exists..Delete it first if you want to change it! :P"                                # or you could overwrite it, but I'm too lazy to do that here :P                                catch {close $input}                                return                        }                }                catch {close $input}        }        # no dupes found, so add the new line        # btw, reading/writing tcl-special chars is a real pain in the arse..You'll prolly find that out :^)        set output [open $datafile a]        puts $output "[join $ahand] [join $amask] [join $alvl]"        flush $output        catch {close $output}        puthelp "PRIVMSG $nick :Wrote [join $ahand] [join $amask] [join $alvl] to file.."}                       proc procdel {nick uhost hand chan text} {        global datafile        set text [split $text]        set ahand [lindex $text 0]        # check for valid input        if {$ahand == ""} {                puthelp "PRIVMSG $nick :Usage: del handle"                return        }        # check for data file        if {![file exists $datafile]} {                puthelp "PRIVMSG $nick :No data file, nothing to delete!"                return        }        # check for requested handle        set data ""        set input [open $datafile r]        while {![eof $input]} {                set curline [gets $input];set curline [split $curline]                if {$curline != ""} {                        set data [linsert $data end $curline]                }        }        catch {close $input}        set mark -1;set match ""        foreach line $data {                incr mark                if {[lindex $line 0] == $ahand} {                        set match $mark                        break                }        }        if {$match == ""} {                puthelp "PRIVMSG $nick :No handle matching $ahand found.."                return        }        set newdata [lreplace $data $mark $mark]        set output [open $datafile w]        foreach newline $newdata {                if {$newline != ""} {                        puts $output $newline                }        }        flush $output        catch {close $output}        puthelp "PRIVMSG $nick :Deleted $ahand.."        return                  }proc proclist {nick uhost hand chan text} {        global datafile        if {![file exists $datafile]} {                puthelp "PRIVMSG $nick :No data file.."                return        }        set input [open $datafile r]        set lines [split [read $input] \n]        catch {close $input}        set cnt 0        foreach line $lines {                if {$line != ""} {                        puthelp "PRIVMSG $nick :$line"                        incr cnt                }        }        if {$cnt == 0} {                puthelp "PRIVMSG $nick :No saved data";return        } else {                puthelp "PRIVMSG $nick :End of list.."        }}#####################################################################################################################################putlog "add/del script loaded.."</code></pre></div>What's the point of having a whois command in the bot?  Can't you just type /whois directly?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Wed Feb 21, 2007 6:33 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[edu]]></name></author>
		<updated>2007-02-21T14:16:30-04:00</updated>

		<published>2007-02-21T14:16:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=70609#p70609</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=70609#p70609"/>
		<title type="html"><![CDATA[.add .del .list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=70609#p70609"><![CDATA[
I know how to make this simple script, but I don't know how to "create" a file directer where with the public commands to add/del/change it.<br><br>:-/<br><br>edu<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8324">edu</a> — Wed Feb 21, 2007 2:16 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2007-02-21T14:13:24-04:00</updated>

		<published>2007-02-21T14:13:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=70608#p70608</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=70608#p70608"/>
		<title type="html"><![CDATA[.add .del .list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=70608#p70608"><![CDATA[
Plenty of examples for doing this kind of stuff around the forum. Take a look at the tcl faq section about basic file operations.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Wed Feb 21, 2007 2:13 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[edu]]></name></author>
		<updated>2007-02-21T14:10:08-04:00</updated>

		<published>2007-02-21T14:10:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=70607#p70607</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=70607#p70607"/>
		<title type="html"><![CDATA[.add .del .list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=70607#p70607"><![CDATA[
Hello <br><br>I need some help from you guys ... I need to make three simple public commands<br><br>Something like:<div class="codebox"><p>Code: </p><pre><code>.add &lt;handle&gt; &lt;hostname&gt; &lt;access&gt;.del &lt;handle&gt;.whois &lt;handle&gt;</code></pre></div>So .. here's what I need ..<br><br>When I type:<div class="codebox"><p>Code: </p><pre><code>.add edu *!*@edu.users.undernet.org 100</code></pre></div>I want that the eggdrop adds me into a file like scripts/userlist.txt like:<div class="codebox"><p>Code: </p><pre><code>$handle:$hostname:$channel:$access</code></pre></div>This should be the .add command<br><br>Then ..<br>The .del command will delete the $handle's dates from "userlist.txt"<br><br>The .whois command I want to return it some like:<div class="codebox"><p>Code: </p><pre><code>putquick "NOTICE $nickname :handle: $handle -- hostname: $hostname -- channel: $channel -- access: $access"</code></pre></div>Please help me, is very important. Thanks<br><br>edu<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8324">edu</a> — Wed Feb 21, 2007 2:10 pm</p><hr />
]]></content>
	</entry>
	</feed>
