Decide1.1.tcl0100600000076400007640000001055507437557206011317 0ustar wccwcc############################ ### Decide.tcl ### ### Version 1.1 ### ### By Wcc ### ### wcc@techmonkeys.org ### ### http://dawg.dynu.com ### ### EFnet #|DAWG|Tcl ### ############################ ############################################################################ ### Copyright © 2000 - 2001 |DAWG| Scripting Group. All rights reserved. ### ############################################################################ ################################################################ # This script will randomly choose a word or words from a list # # of words specified via a pub or dcc command. # ################################################################ ############## ## COMMANDS ## ######################################################## ## DCC ## .decide (Can be changed) ## ######### Randomly chooses words from a list ## ######### of words ## ######################################################## ## PUB ## !decide (Can be changed) ## ######### Randomly chooses words from a list ## ######### of words ## ######################################################## ########################################################## ## Just load the script, edit the settings, and rehash. ## ########################################################## ######################################################### # Set the flag required to use the decide command here. # ######################################################### set decide_setting(flag) "-|-" ############################# # Set the pub command here. # ############################# set decide_setting(cmd_pub) "!decide" ############################# # Set the dcc command here. # ############################# set decide_setting(cmd_dcc) "decide" ################################### # Enable use of bold in DCC chat? # ################################### set decide_setting(bold) 1 ########################################## # Prefix "DECIDE:" in DCC chat messages? # ########################################## set decide_setting(DECIDE:) 1 #################### # Code begins here # #################### if {![string match 1.6.* $version]} { die "\002DECIDE:\002 \002CRITICAL ERROR\002 Decide.tcl requires eggdrop 1.6.x to run." } bind pub $decide_setting(flag) $decide_setting(cmd_pub) decide_pub bind dcc $decide_setting(flag) $decide_setting(cmd_dcc) decide_dcc proc decide_dopre {} { global decide_setting if {!$decide_setting(DECIDE:)} { return "" } elseif {!$decide_setting(bold)} { return "DECIDE: " } else { return "\002DECIDE:\002 " } } proc decide_pub {nick uhost hand chan text} { global decide_setting set number [lindex [split $text] 0] set text [lrange [split $text] 1 end] if {$number == ""} { puthelp "PRIVMSG $chan :Usage: .$decide_setting(cmd_pub) " } elseif {[regexp \[^0-9\] $number]} { puthelp "PRIVMSG $chan :$number is not a number." } elseif {[expr $number > [llength $text]]} { puthelp "PRIVMSG $chan :The number of choices to return must not be greater than the total number of choices." } else { set i 0 while {$i < $number} { set item [lindex $text [rand [llength $text]]] if {(![info exists returnlist]) || ([lsearch -exact $returnlist $item] == -1)} { lappend returnlist $item incr i } } if {![info exists returnlist]} { set returnlist \(error\) } puthelp "PRIVMSG $chan :$returnlist" } } proc decide_dcc {hand idx text} { global decide_setting set number [lindex [split $text] 0] set text [lrange [split $text] 1 end] if {$number == ""} { putdcc $idx "[decide_dopre]Usage: .$decide_setting(cmd_dcc) " } elseif {[regexp \[^0-9\] $number]} { putdcc $idx "[decide_dopre]$number is not a number." } elseif {[expr $number > [llength $text]]} { putdcc $idx "[decide_dopre]The number of choices to return must not be greater than the total number of choices." } else { set i 0 while {$i < $number} { set item [lindex $text [rand [llength $text]]] if {(![info exists returnlist]) || ([lsearch -exact $returnlist $item] == -1)} { lappend returnlist $item incr i } } if {![info exists returnlist]} { set returnlist \(error\) } putdcc $idx "[decide_dopre]$returnlist" } } putlog "\002DECIDE:\002 Decide.tcl Version 1.1 by Wcc is loaded."Decide.info.dawg0100600000076400007640000000046407420150136012146 0ustar wccwccInformation: This script will randomly choose a word or words from a list of words specified via a pub or dcc command. Changes log for Decide.tcl: Version 1.1 * Released to the public from the |DAWG| Scripting Team web site. * You can now chose how many choices to return, instead of just 2.