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

	<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-12-24T03:33:09-04:00</updated>

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

		<entry>
		<author><name><![CDATA[lebjustice]]></name></author>
		<updated>2007-12-24T03:33:09-04:00</updated>

		<published>2007-12-24T03:33:09-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=79522#p79522</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=79522#p79522"/>
		<title type="html"><![CDATA[hey rosc2112 thanks can u help me with this?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=79522#p79522"><![CDATA[
I found this in the forum<br>how can i add !delcommand and !listcommand and make it active only in that chans i want.<br><div class="codebox"><p>Code: </p><pre><code>set cmdsfile "uicn/cmds.txt" if {![file exists $cmdsfile]} { set fileid [open $cmdsfile w] close $fileid } { source $cmdsfile } bind pub n !addcommand add:command proc add:command {n u h c a} { global addedcommands set command [lindex [split $a] 0] set action [join [lrange [split $a] 1 end]] if {[info command added:$command] == ""} { set addedcommands($command) $action proc added:$command {n u h c a} { global addedcommands puthelp "privmsg $c :\001ACTION [string map [list %nick [lindex [split $a] 0]] $addedcommands($::lastbind)]\001" } bind pub - $command added:$command save:command $command $action puthelp "notice $n :Added add:$command command." } { puthelp "notice $n :Command added:$command already exists." } } proc save:command {c act} { global cmdsfile set cmdlist [split [read [set f [open $cmdsfile]]] \n][close $f] lappend cmdlist "bind pub - $c added:$c" lappend cmdlist "" lappend cmdlist "set addedcommands($c){$act}" lappend cmdlist "" set f [open $cmdsfile w] foreach cmd $cmdlist { puts $f $cmd } puts $f [printproc added:$c] close $f } # user's proc from the Tcl faq forum proc printproc proc { set args {} foreach arg [info args $proc] { if {[info default $proc $arg val]} { lappend args [list $arg $val] } { lappend args [list $arg] } } list proc $proc $args [info body $proc] }</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9073">lebjustice</a> — Mon Dec 24, 2007 3:33 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[lebjustice]]></name></author>
		<updated>2007-12-24T02:32:21-04:00</updated>

		<published>2007-12-24T02:32:21-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=79520#p79520</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=79520#p79520"/>
		<title type="html"><![CDATA[thanks for the fast reply but...]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=79520#p79520"><![CDATA[
can the command be !&lt;nospace&gt;&lt;word&gt; ? ex: !word <br>not as !&lt;space&gt;&lt;word&gt; ex: ! word<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9073">lebjustice</a> — Mon Dec 24, 2007 2:32 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2007-12-23T23:41:56-04:00</updated>

		<published>2007-12-23T23:41:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=79517#p79517</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=79517#p79517"/>
		<title type="html"><![CDATA[Script Editing/modifying Request Please]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=79517#p79517"><![CDATA[
Sounds counterproductive, as you'd have to use a pubm bind then check each and every word, not to mention other scripts that use bang(!) chars which would then also be caught by the pubm bind..  Whats so hard about using !command &lt;word&gt; anyway?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Sun Dec 23, 2007 11:41 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[lebjustice]]></name></author>
		<updated>2007-12-23T17:53:19-04:00</updated>

		<published>2007-12-23T17:53:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=79514#p79514</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=79514#p79514"/>
		<title type="html"><![CDATA[Script Editing/modifying Request Please]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=79514#p79514"><![CDATA[
it's dlearn.tcl the thing is users have to Trigg==&gt;  ??&lt;space&gt;&lt;word&gt;<br>i would love the trig itself to be the word so users can like trigg !word (no space)<br>I'll apreciate it.<br><div class="codebox"><p>Code: </p><pre><code>## Files &amp; Backup time (note: never give the same name to the files or the script will make the bot die ## #Don't forget, all this files need to have +rw permissions you can do that with chmod command.#The file to store learn dataset learn(file) "learn.dat"#The file to backup the dataset learn(backupfile) "learn.dat.old"#The file where the lock definitions will be stored/savedset learn(lockfile) "learn.lock.dat"#The temp file when you need to delete/insert something or add/delete words of lock fileset learn(tempfile) "learn.tmp"#The time in minutes between each backup, '0' for no backup usage but you can manualy force backup to be saved.set learn(backuptime) "480"## Triggers ###To add a definition to a word --&gt; trigger &lt;word&gt; &lt;definition&gt;set learn(add) "!learn"#To delete all word --&gt; trigger &lt;word&gt;set learn(forget) "!forget"#To insert a definition to word, the definition will be added to the end --&gt; trigger &lt;word&gt; &lt;definition&gt;set learn(insert) "!insert"#To delete one definition from word --&gt; trigger &lt;word&gt; &lt;n&gt;set learn(del) "!del"#To lock one word, if word is locked it's impossible insert/delete that word --&gt; trigger &lt;word&gt;set learn(lock) "!lock"#This will unlock a locked word --&gt; trigger &lt;word&gt;set learn(unlock) "!unlock"#This is used to retrieve a definition of word --&gt; ?? &lt;word&gt;set learn(view) "??"#The list of words in learn fileset learn(wordlist) "!learnlist"#This is used to see the lock wordsset learn(lockwords) "!locklist"#This is the trigger to force backup to be savedset learn(forcebackup) "!forceback"#This is the trigger to show some misc infoset learn(misc) "!learninfo"#The help with all triggers and other misc stuff. This will change consoant if you have or not permission to change the data.set learn(help) "!lhelp"## Misc ###The flag needed add/insert/delete one definition/delete wordset learn(flags-change) "o"#The flag needed to lock/unlock a word and even to force backup to be saved, i recomend and it's logical# never give less access than the flags-changeset learn(owner) "m"#This is the method PRIVMSG/NOTICE when something changed this will work only for the nick who changeset learn(method) "NOTICE"#This is the method PRIVMSG/NOTICE when you try to retrieve a definition, this will be sended to a target request(channel/nick)set learn(method-def) "PRIVMSG"#This is the exempt channels to the bot separated by commas(,)set learn(non-channels) "#Lame,#Bots"############# Don't change nothing below if you don't know what you are doing ################# BINDS ##bind pub - $learn(add) learn_addbind pub - $learn(forget) learn_forgetbind pub - $learn(lock) learn_lockbind pub - $learn(unlock) learn_unlockbind pub - $learn(insert) learn_insertbind pub - $learn(del) learn_delbind pub - $learn(view) learn_viewbind pub - $learn(forcebackup) learn_forcebackbind pub - $learn(lockwords) learn_lockwordsbind pub - $learn(wordlist) learn_listbind pub - $learn(misc) learn_miscbind pub - $learn(help) learn_helpbind msg - $learn(add) learn_addbind msg - $learn(forget) learn_forgetbind msg - $learn(lock) learn_lockbind msg - $learn(unlock) learn_unlockbind msg - $learn(insert) learn_insertbind msg - $learn(del) learn_delbind msg - $learn(view) learn_view_msgbind msg - $learn(forcebackup) learn_forcebackbind msg - $learn(lockwords) learn_lockwordsbind msg - $learn(wordlist) learn_listbind msg - $learn(misc) learn_miscbind msg - $learn(help) learn_help## Misc ##set learn(version) "v1.0.1"putlog "Dekadent Learn $learn(version) by CoolMaster &lt;coolmaster@GameOver.co.pt&gt; &lt;http://coolmaster.cjb.net&gt;"if {$learn(backuptime) &gt; 0} {timer $learn(backuptime) learn_backup}if {[string compare $learn(file) $learn(backupfile)] == 0} {die "Dekadent Learn, you probably have the same name to other types of file, please edit your Dekadent Learn"}if {[string compare $learn(file) $learn(lockfile)] == 0} {die "Dekadent Learn, you probably have the same name to other types of file, please edit your Dekadent Learn"}if {[string compare $learn(file) $learn(tempfile)] == 0} {die "Dekadent Learn, you probably have the same name to other types of file, please edit your Dekadent Learn"}if {[string compare $learn(backupfile) $learn(lockfile)] == 0} {die "Dekadent Learn, you probably have the same name to other types of file, please edit your Dekadent Learn"}if {[string compare $learn(backupfile) $learn(tempfile)] == 0} {die "Dekadent Learn, you probably have the same name to other types of file, please edit your Dekadent Learn"}if {[string compare $learn(tempfile) $learn(lockfile)] == 0} {die "Dekadent Learn, you probably have the same name to other types of file, please edit your Dekadent Learn"}if {![file exists $learn(file)]} {set fxtmp [open $learn(file) w] ; close $fxtmp}if {![file exists $learn(lockfile)]} {set fxtmp [open $learn(lockfile) w] ; close $fxtmp}## Procs ###This will check if word is locked, if is return 1 else return 2proc check_lock {word} {global learnset fx [open $learn(lockfile) r]while {![eof $fx]} {set word_check [gets $fx]if {[string compare $word $word_check] == 0} {close $fx ; return 1}}close $fx ; return 2}# Verify if user have access flags to use learn changes, return 1 if yes else return 2proc check_access {hand type} {global learnif {[matchattr $hand $learn($type)] == 1} {return 1} else {return 2}}# Verify if definition allready exists, if yes will return 1 else return 2proc check_word {word} {global learnset fx [open $learn(file) r]while {![eof $fx]} {set word_check [lindex [gets $fx] 0]if {[string compare $word $word_check] == 0} {close $fx ; return 1}}close $fx ; return 2}# Verify if channel is not on exempt list, if is return 1 else return 2proc isvalidchan {chan} {global learnset chans [string tolower [split "$learn(non-channels)" ","]]set i 0while {1} {set chan_c [lindex $chans $i]if {$chan_c == ""} {return 2} elseif {$chan_c == "$chan"} {return 1}incr i 1}}proc learn_add {nick host hand chan text} {global learnif {[check_access $hand flags-change] == 2} {putserv "$learn(method) $nick :You don't have access"return 0}set word [string tolower [lindex $text 0]]set definition [lrange $text 1 end]if {$definition == ""} {putserv "$learn(method) $nick :Invalid syntax, use $learn(add) &lt;word&gt; &lt;definition&gt;"return 0}if {[check_word $word] == 1} {putserv "$learn(method) $nick :Definition allready exists"return 0}set fx [open $learn(file) a]puts $fx "$word $definition ¦"close $fxputserv "$learn(method) $nick :Added \"$word\" to database"}proc learn_forget {nick host hand chan text} {global learnif {[check_access $hand flags-change] == 2} {putserv "$learn(method) $nick :You don't have access"return 0}set word [string tolower [lindex $text 0]]if {$word == ""} {putserv "$learn(method) $nick :Invalid syntax, use $learn(forget) &lt;word&gt;"return 0}if {[check_word $word] == 2} {putserv "$learn(method) $nick :Unable to delete, definition not found"return 0}if {[check_lock $word] == 1} {putserv "$learn(method) $nick :Unable to delete, definition is locked"return 0}set fx1 [open $learn(file) r]set fx2 [open $learn(tempfile) w]while {![eof $fx1]} {set tmp [gets $fx1]set word_check [lindex $tmp 0]if {$tmp != ""} {if {[string compare $word $word_check] == 0} {continue} else {puts $fx2 $tmp}}}close $fx1 ; close $fx2exec rm -f $learn(file) ; exec mv $learn(tempfile) $learn(file)putserv "$learn(method) $nick :\"$word\" deleted from database"}proc learn_list {nick host hand chan text} {global learnset words "" ; set check 0set fx [open $learn(file) r]while {![eof $fx]} {set tmp [lindex [gets $fx] 0]set words "$words $tmp"if {$tmp != ""} {set check 1}}close $fxif {$check == 0} {putserv "$learn(method) $nick :The learn file is empty"} else {putserv "$learn(method) $nick :Learn words: $words"}}proc learn_lockwords {nick host hand chan text} {global learnif {[check_access $hand owner] == 2} {putserv "$learn(method) $nick :You don't have access"return 0}set words "" ; set check 0set fx [open $learn(lockfile) r]while {![eof $fx]} {set tmp [gets $fx]set words "$words $tmp"if {$tmp != ""} {set check 1}}close $fxif {$check == 0} {putserv "$learn(method) $nick :The lock file is empty"} else {putserv "$learn(method) $nick :Lock words: $words"}}proc learn_forceback {nick host hand chan text} {global learnif {[check_access $hand owner] == 2} {putserv "$learn(method) $nick :You don't have access"return 0}putlog "#$hand# forced learn backup"learn_backup}proc learn_backup {} {global learnset fx1 [open $learn(file) r]set fx2 [open $learn(backupfile) w]while {![eof $fx1]} {set tmp [gets $fx1]if {$tmp != ""} {puts $fx2 $tmp}}putlog "Learn: backup saved to $learn(backupfile)"timer $learn(backuptime) learn_backupclose $fx1 ; close $fx2}proc learn_view {nick host hand chan text} {global learnif {[isvalidchan [string tolower $chan]] == 1} {putserv "$learn(method) $nick :I can't use learn in this channel"return 0}set word [string tolower [lindex $text 0]]if {$word == ""} {putserv "$learn(method) $nick :Invalid syntax, use $learn(view) &lt;word&gt;"return 0}if {[check_word $word] == 2} {putserv "$learn(method) $nick :The word \"$word\" is unknown to me"return 0}set fx [open $learn(file) r]while {![eof $fx]} {set tmp [gets $fx]if {[string compare $word [lindex $tmp 0]] != 0} {continue}set i 1set defs [split [lrange $tmp 1 end] "¦"]set defi ""while {1} {set d [lindex $defs [expr $i-1]]if {$d == ""} {break}putserv "$learn(method-def) $chan :$word\002\[\002$i\002\]\002\037:\037 $d"incr i 1}}close $fx}proc learn_view_msg {nick host hand chan text} {global learnif {[isvalidchan $chan] == 1} {putserv "$learn(method) $nick :I can't use learn in this channel"return 0}set word [string tolower [lindex $text 0]]if {$word == ""} {putserv "$learn(method) $nick :Invalid syntax, use $learn(view) &lt;word&gt;"return 0}if {[check_word $word] == 2} {putserv "$learn(method) $nick :The word \"$word\" is unknown to me"return 0}set fx [open $learn(file) r]while {![eof $fx]} {set tmp [gets $fx]if {[string compare $word [lindex $tmp 0]] != 0} {continue}set i 1set defs [split [lrange $tmp 1 end] "¦"]set defi ""while {1} {set d [lindex $defs [expr $i-1]]if {$d == ""} {break}putserv "$learn(method-def) $nick :$word\002\[\002$i\002\]\002\037:\037 $d"incr i 1}}close $fx}proc learn_del {nick host hand chan text} {global learnif {[check_access $hand flags-change] == 2} {putserv "$learn(method) $nick :You don't have access"return 0}set word [string tolower [lindex $text 0]]set n [lindex $text 1]if {$n == ""} {putserv "$learn(method) $nick :Invalid syntax, use $learn(del) &lt;word&gt; &lt;N&gt;"return 0}if {[check_word $word] == 2} {putserv "$learn(method) $nick :Word not found please use !learn first"return 0}if {[check_lock $word] == 1} {putserv "$learn(method) $nick :Unable to delete, word is locked"return 0}set fx1 [open $learn(file) r]set fx2 [open $learn(tempfile) w]while {![eof $fx1]} {set tmp [gets $fx1]set word_check [lindex $tmp 0]set i 0set defs [split [lrange $tmp 1 end] "¦"]set defi ""while {1} {if {[expr $i+1] == $n} {incr i 1 ; continue}set d [lindex $defs $i]if {$d == ""} {break}if {$defi == ""} {set defi $d¦} else {set defi $defi$d¦}incr i 1}if {$tmp != ""} {if {[string compare $word $word_check] == 0} {puts $fx2 "$word_check $defi"} else {puts $fx2 $tmp}}}close $fx1 ; close $fx2exec rm -f $learn(file) ; exec mv $learn(tempfile) $learn(file)putserv "$learn(method) $nick :Definition \"$n\" deleted from \"$word\" if exists"}proc learn_insert {nick host hand chan text} {global learnif {[check_access $hand flags-change] == 2} {putserv "$learn(method) $nick :You don't have access"return 0}set word [string tolower [lindex $text 0]]set definition [lrange $text 1 end]if {$definition == ""} {putserv "$learn(method) $nick :Invalid syntax, use $learn(insert) &lt;word&gt; &lt;definition&gt;"return 0}if {[check_word $word] == 2} {putserv "$learn(method) $nick :Word not found please use !learn first"return 0}if {[check_lock $word] == 1} {putserv "$learn(method) $nick :Unable to insert, word is locked"return 0}set fx1 [open $learn(file) r]set fx2 [open $learn(tempfile) w]while {![eof $fx1]} {set tmp [gets $fx1]set word_check [lindex $tmp 0]if {$tmp != ""} {if {[string compare $word $word_check] == 0} {puts $fx2 "$tmp$definition ¦"} else {puts $fx2 $tmp}}}close $fx1 ; close $fx2exec rm -f $learn(file) ; exec mv $learn(tempfile) $learn(file)putserv "$learn(method) $nick :Definition inserted at the end of word"}proc learn_unlock {nick host hand chan text} {global learnif {[check_access $hand owner] == 2} {putserv "$learn(method) $nick :You don't have access"return 0}set word [string tolower [lindex $text 0]]if {$word == ""} {putserv "$learn(method) $nick :Invalid syntax, use $learn(unlock) &lt;word&gt;"return 0}if {[check_word $word] == 2} {putserv "$learn(method) $nick :Unable to lock word, word not found"return 0}if {[check_lock $word] == 2} {putserv "$learn(method) $nick :Unable to unlock, word is not locked"return 0}set fx1 [open $learn(lockfile) r]set fx2 [open $learn(tempfile) w]while {![eof $fx1]} {set tmp [gets $fx1]set word_check [lindex $tmp 0]if {[string compare $word $word_check] == 0} {continue} else {puts $fx2 $tmp}}close $fx1 ; close $fx2exec rm -f $learn(lockfile) ; exec mv $learn(tempfile) $learn(lockfile)putserv "$learn(method) $nick :\"$word\" unlocked"}proc learn_lock {nick host hand chan text} {global learnif {[check_access $hand owner] == 2} {putserv "$learn(method) $nick :You don't have access"return 0}set word [string tolower [lindex $text 0]]if {$word == ""} {putserv "$learn(method) $nick :Invalid syntax, use $learn(lock) &lt;word&gt;"return 0}if {[check_word $word] == 2} {putserv "$learn(method) $nick :Unable to lock definition, not found"return 0}if {[check_lock $word] == 1} {putserv "$learn(method) $nick :Definition allready locked"return 0}set fx [open $learn(lockfile) a]puts $fx $word ; close $fxputserv "$learn(method) $nick :\"$word\" locked"}proc learn_misc {nick host hand chan text} {global learnif {[check_access $hand owner] == 2} {putserv "$learn(method) $nick :You don't have access"return 0}putserv "$learn(method) $nick :\002Dekadent Learn $learn(version) misc information\002"putserv "$learn(method) $nick :The learn file is: \"$learn(file)\", the backup file is: \"$learn(backupfile)\", the learn temp file is \"$learn(tempfile)\", the learn lock file is \"$learn(lockfile)\", the time between each backup is \"$learn(backuptime)\" minutes, the channels that learn views will not appear is/are \"$learn(non-channels)\"."putserv "$learn(method) $nick :The flags to learn/forget/insert/delete/list words is/are \"$learn(flags-change)\", the flags to lock/unlock/list locked words/force backup is/are \"$learn(owner)\", the method to response when a nick add/insert/delete/forget.... is \"$learn(method)\" to a nick, the method to response to a view is \"$learn(method-def)\" to a channel."}proc learn_help {nick host hand chan text} {global learnputserv "$learn(method) $nick :\002*** Dekadent Learn $learn(version) help, the help will be showed if you have the access to that command. ***\002"putserv "$learn(method) $nick :To view a word do: $learn(view) &lt;word&gt;"if {[check_access $hand flags-change] == 1} {putserv "$learn(method) $nick :To add a word do: $learn(add) &lt;word&gt; &lt;definition&gt;"putserv "$learn(method) $nick :To forget a word do: $learn(forget) &lt;word&gt;"putserv "$learn(method) $nick :To insert a definition to a word do: $learn(insert) &lt;word&gt; &lt;definition&gt;"putserv "$learn(method) $nick :To delete a definition from one word do: $learn(del) &lt;word&gt; &lt;N&gt;"putserv "$learn(method) $nick :To see all definied words do: $learn(wordlist)"}if {[check_access $hand owner] == 1} {putserv "$learn(method) $nick :To lock a word do: $learn(lock) &lt;word&gt;"putserv "$learn(method) $nick :To unlock a locked word do: $learn(unlock) &lt;word&gt;"putserv "$learn(method) $nick :To list all locked words do: $learn(lockwords)"putserv "$learn(method) $nick :To force the learn file to be backuped do: $learn(forcebackup)"putserv "$learn(method) $nick :If word is locked the word can't be deleted or some definition be inserted to the word"putserv "$learn(method) $nick :To see some misc information do: $learn(misc)"}}</code></pre></div>Script: <a href="http://www.egghelp.org/tclhtml/3478-4-0-0-1-dlearn.htm" class="postlink">Dekadent Learn</a><br>Edited by Alchera: <span style="color:red">Use</span> <div class="codebox"><p>Code: </p><pre><code></code></pre></div> tags when inserting code into a post (the format bar is right in front of you).[/color]<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9073">lebjustice</a> — Sun Dec 23, 2007 5:53 pm</p><hr />
]]></content>
	</entry>
	</feed>
