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

	<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>2009-11-07T15:41:23-04:00</updated>

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

		<entry>
		<author><name><![CDATA[lenooxx]]></name></author>
		<updated>2009-11-07T15:41:23-04:00</updated>

		<published>2009-11-07T15:41:23-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90836#p90836</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90836#p90836"/>
		<title type="html"><![CDATA[ClanAvail]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90836#p90836"><![CDATA[
hey <br><br>i added ClanAvail scipt for my eggdrop<br>and i get this error message always<br><br> Tcl error [clanavail_showwar]: can't read "users": no such variable<br>Tcl error [clanavail_navail]: can't read "users": no such variable<br><br><img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad"><br><br>here is the script <br><br><div class="codebox"><p>Code: </p><pre><code>################ COMMANDS ############################################################## PUB ## !avail (Can be changed)                       ########### Sets you as available for the next war.       ########### --------------------------------------------- ########### !navail (Can be changed)                      ########### Sets you as not available for the next war.   ########### --------------------------------------------- ########### !maybe (Can be changed)                       ########### Sets you as maybe available for the next war. ########### --------------------------------------------  ########### !wardetails [details]                         ########### Shows the details for the next war.           ########### Availability is also shown, than cleared. If  ########### details are given, the war details will be    ########### set to the specified information.             ############################################################## MSG ## /msg &lt;bot&gt; auth &lt;password&gt;                    ########### Authorizes you to use commands.               ########### --------------------------------------------- ########### /msg &lt;bot&gt; deauth                             ########### De-authorizes you from using commands.        ############################################################## DCC ## .chanset &lt;channel&gt; +clantopic                 ########### Makes the bot set the topic of the specified  ########### channel to the details of the next war when   ########### information changes.                          ######################################################################################################################## Just load the script, edit the settings, and rehash. ############################################################################################################## Set the flag required to use the script here. ##################################################set clanavail_setting(flag) "o|o"################################################################## Set the command for setting yourself as maybe available here. ##################################################################set clanavail_setting(maybe) "!maybe"############################################################ Set the command for setting yourself as available here. ############################################################set clanavail_setting(avail) "!avail"################################################################ Set the command for setting yourself as not available here. ################################################################set clanavail_setting(navail) "!navail"##################################################################### When adding to the topic, should the war details be added to the ## end of the topic or the beginning? (0 for beginning, 1 for end)  #####################################################################set clanavail_setting(end) 1#################################### Set the database filename here. ####################################set clanavail_setting(database) "./scripts/clanavail.db"#################################################################### Enable bold in topic and !wardetails? (Makes it easier to read) ####################################################################set clanavail_setting(bold) 1##################### Code begins here #####################if {$numversion &lt; 1060800} { putlog "\002CLANAVAIL:\002 \002WARNING:\002 This script is intended to run on eggdrop 1.6.8 or later." }if {[info tclversion] &lt; 8.2} { putlog "\002CLANAVAIL:\002 \002WARNING:\002 This script is intended to run on Tcl Version 8.2 or later." }bind pub $clanavail_setting(flag) !wardetails clanavail_showwarbind pub $clanavail_setting(flag) $clanavail_setting(maybe) clanavail_maybebind pub $clanavail_setting(flag) $clanavail_setting(avail) clanavail_availbind pub $clanavail_setting(flag) $clanavail_setting(navail) clanavail_navailbind msg - auth clanavail_authbind msg - deauth clanavail_deauthbind part - * clanavail_deauth_partbind sign - * clanavail_deauth_signbind splt - * clanavail_deauth_spltsetudef flag clantopicproc clanavail_auth {nick uhost hand text} {if {![validuser $hand]} { putserv "NOTICE $nick :You are not a bot user." ; return }if {[string compare [lindex [set text [split $text]] 0] ""] == 0} { putserv "NOTICE $nick :Usage: /msg $::botnick auth &lt;password&gt;" ; return }if {![passwdok $hand [lindex $text 0]]} { putserv "NOTICE $nick :Invalid password." ; return }if {[matchattr $hand +Q]} { putserv "NOTICE $nick :You are already authorized." ; return }chattr $hand +Qputserv "NOTICE $nick :You are now authorized."}proc clanavail_deauth {nick uhost hand text} {if {![validuser $hand]} { putserv "NOTICE $nick :You are not a bot user." ; return }if {![matchattr $hand +Q]} { putserv "NOTICE $nick :You are not authorized." ; return }chattr $hand -Qputserv "NOTICE $nick :You are no longer authorized."}proc clanavail_deauth_sign {nick uhost hand chan text} {if {[validuser $hand] &amp;&amp; [matchattr $hand +Q]} { chattr $hand -Q }}proc clanavail_deauth_part {nick uhost hand chan text} {if {![onchan $nick] &amp;&amp; [validuser $hand] &amp;&amp; [matchattr $hand +Q]} { chattr $hand -Q }}proc clanavail_deauth_splt {nick uhost hand chan} {if {[validuser $hand] &amp;&amp; [matchattr $hand +Q]} { chattr $hand -Q }}proc clanavail_readarray {array file} {upvar $array oursif {[catch {open $file r} fd]} { return }if {[array exists ours]} { unset ours }foreach line [split [read $fd] \n] {if {[string range $line 0 2] != "%!%" || [scan [string range $line 3 end] "%\[^!!!\]!!!%s" name data] &lt;= 0} { continue }if {![info exists data]} { set data "" }set ours($name) $data}close $fd}proc clanavail_savearray {array file} {upvar $array oursif {![array exists ours] || [catch {open $file w} fd]} { return }foreach entry [array names ours] { puts $fd "%!%$entry!!!$ours($entry)" }close $fd}if {![array exists clanavail_users] &amp;&amp; [file exists $clanavail_setting(database)]} { clanavail_readarray clanavail_users $clanavail_setting(database) }proc clanavail_showwar {nick uhost hand chan text} {if {![matchattr $hand +Q]} { putserv "NOTICE $nick :You are not authorized. Please type \"/msg $::botnick auth &lt;password&gt;\" to authorize yourself." ; return }if {$text == ""} {if {![info exists ::clanavail_users(/warinfo)]} { set ::clanavail_users(/warinfo) "None" }foreach {a b} [list users [clanavail_getavail] avail [lindex $users 0] navail [lindex $users 1] maybe [lindex $users 2]] { set $a $b }putserv "PRIVMSG $chan :[clanavail_bold "Next War: $::clanavail_users(/warinfo) Available: $avail Not Available: $navail Maybe Available: $maybe."]"catch { unset ::clanavail_users(/warinfo) }return}set ::clanavail_users(/warinfo) $textclanavail_do_topicputserv "NOTICE $nick :[clanavail_bold "Next War: $::clanavail_users(/warinfo)"]"}proc clanavail_avail {nick uhost hand chan text} {global clanavail_usersif {![matchattr $hand +Q]} { putserv "NOTICE $nick :You are not authorized. Please type \"/msg $::botnick auth &lt;password&gt;\" to authorize yourself." ; return }if {[info exists clanavail_users($nick)] &amp;&amp; [string match avail $clanavail_users($nick)]} { putserv "NOTICE $nick :You are already marked as available." ; return }set clanavail_users($nick) availclanavail_savearray clanavail_users $::clanavail_setting(database)clanavail_do_topicputserv "NOTICE $nick :You are now marked as available."}proc clanavail_navail {nick uhost hand chan text} {global clanavail_usersif {![matchattr $hand +Q]} { putserv "NOTICE $nick :You are not authorized. Please type \"/msg $::botnick auth &lt;password&gt;\" to authorize yourself." ; return }if {[info exists clanavail_users($nick)] &amp;&amp; [string match navail $clanavail_users($nick)]} { putserv "NOTICE $nick :You are already marked as not available." ; return }set clanavail_users($nick) navailclanavail_savearray clanavail_users $::clanavail_setting(database)clanavail_do_topicputserv "NOTICE $nick :You are now marked as not available."}proc clanavail_maybe {nick uhost hand chan text} {global clanavail_usersif {![matchattr $hand +Q]} { putserv "NOTICE $nick :You are not authorized. Please type \"/msg $::botnick auth &lt;password&gt;\" to authorize yourself." ; return }if {[info exists clanavail_users($nick)] &amp;&amp; [string match maybe $clanavail_users($nick)]} { putserv "NOTICE $nick :You are already marked as maybe available." ; return }set clanavail_users($nick) maybeclanavail_savearray clanavail_users $::clanavail_setting(database)clanavail_do_topicputserv "NOTICE $nick :You are now marked as maybe available."}proc clanavail_do_topic {} {global clanavail_usersforeach {a b} [list users [clanavail_getavail] avail [lindex $users 0] navail [lindex $users 1] maybe [lindex $users 2]] { set $a $b }if {![info exists clanavail_users(/warinfo)]} {set clanavail_users(/warinfo) "None" }foreach c [channels] {if {![botisop $chan] || [lsearch -exact [channel info $chan] +chantopic] == -1} { continue }if {!$::clanavail_setting(end)} {if {[string match "*Next War:*Available:*Not Available:*Maybe Available:*. |*" [topic $chan]]} { set topic [string range [topic $chan] [expr [string first ". |" [topic $chan]] + 4] end] } { set topic [topic $chan] }set topic "[clanavail_bold "Next War: $clanavail_users(/warinfo) Available: $avail Not Available: $navail Maybe Available: $maybe."] | $topic"} {if {[string match "*| *Next War:*Available:*Not Available:*Maybe Available:*" [topic $chan]]} {if {$::clanavail_setting(bold)} { set topic [string range [topic $chan] 0 [expr [string first "| \002Next War:" [topic $chan]] - 2]] } { set topic [string range [topic $chan] 0 [expr [string first "| Next War:" [topic $chan]] - 2]] }} {set topic [topic $chan]}set topic "$topic | [clanavail_bold "Next War: $clanavail_users(/warinfo) Available: $avail Not Available: $navail Maybe Available: $maybe."]"}if {[string compare [topic $chan] $topic] != 0} { putserv "TOPIC $chan :$topic" }}}proc clanavail_bold {text} {if {$::clanavail_setting(bold)} {regsub -all -- " Not Available: "   $text " \002Not Available:\002 "   textregsub -all -- " Maybe Available: " $text " \002Maybe Available:\002 " textregsub -all -- " Available: "       $text " \002Available:\002 "       textregsub -all -- "Next War: "         $text "\002Next War:\002 "         text}return $text}proc clanavail_getavail {} {global clanavail_usersforeach a [array names clanavail_users] {if {[string match $a /warinfo]} { continue }switch -- $clanavail_users($a) {"avail" { lappend avail $a, }"navail" { lappend navail $a, }"maybe" { lappend maybe $a, }}}foreach v {avail navail maybe} {if {![info exists $v]} { set $v None }}regsub -all -- "," [lindex $avail end]  "" endregsub -all -- "," [lindex $navail end] "" end2regsub -all -- "," [lindex $maybe end]  "" end3return "[list [lreplace $avail end end $end] [lreplace $navail end end $end2] [lreplace $maybe end end $end3]]"}putlog "\002CLANAVAIL:\002 ClanAvail.tcl Version 1.4 by Wcc is loaded."</code></pre></div><span style="color:red"><br>Moderator: I took the liberty of adding the proper tags for code blocks. Makes the code a lot easier to read.<br>/NML_375</span><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10564">lenooxx</a> — Sat Nov 07, 2009 3:41 pm</p><hr />
]]></content>
	</entry>
	</feed>
