How do I put a on/off switch than can be use from a bind to owner (+n) only?
like !timemsg and the script starts.... I would also like it to be disabled by default, only starting with !timemsg
proc mute::av { nickname hostname handle channel arguments } {
set mode [lindex [split $arguments] 0]
switch $mode {
on {
if {[channel get $channel "autovoice"]} {
putquick "NOTICE $nickname :autovoice is already enabled for $channel."
return 0
}
channel set $channel +autovoice
putquick "NOTICE $nickname :autovoice has been enabled for $channel."
}
off {
if {![channel get $channel "autovoice"]} {
putquick "NOTICE $nickname :autovoice is already disabled for $channel."
return 0
}
channel set $channel -autovoice
putquick "NOTICE $nickname :autovoice has been disabled for $channel."
}
default {
if {[channel get $channel "autovoice"]} {
putquick "NOTICE $nickname :autovoice is currently enabled for $channel."
} else {
putquick "NOTICE $nickname :autovoice is currently disabled for $channel."
}
}
}
}
##################################
### TimeMessage.tcl ###
### Version 1.0 ###
### By Wcc ###
### wcc@techmonkeys.org ###
### http://www.dawgtcl.com:81/ ###
### EFnet #|DAWG|Tcl ###
##################################
############################################################################
### Copyright c 2000 - 2002 |DAWG| Scripting Group. All rights reserved. ###
############################################################################
############################################################################
## This script sends a message to a channel (or channels) every x seconds ##
## (or minutes). ##
############################################################################
##########################################################
## Just load the script, edit the settings, and rehash. ##
##########################################################
setudef flag antiadver
bind pub n|n !adver adver:switch
proc adver:switch {nick host hand chan text} {
set option [lindex [split $text] 0]
if { $option == "on" } {
channel set $chan -antiadver
puthelp "NOTICE $nick : Advertise is 9ON9"
}
if { $option == "off" } {
channel set $chan +antiadver
puthelp "NOTICE $nick : Advertise is 4OFF4"
}
}
#################################
# Set the message to send here. #
#################################
set timemessage_setting(message) {
"blablablabla"
}
##########################################
# Set the channel(s) to send it to here. #
##########################################
set timemessage_setting(channel) "#channel"
###########################################################################
# Set the time in minutes between messages here. Prefix the time with a ! #
# to use seconds. #
###########################################################################
set timemessage_setting(time) "15"
####################
# Code begins here #
####################
if {![string match 1.6.* $version]} { putlog "\002TIMEMESSAGE:\002 \002WARNING:\002 This script is intended to run on eggdrop 1.6.x or later." }
if {[info tclversion] < 8.2} { putlog "\002TIMEMESSAGE:\002 \002WARNING:\002 This script is intended to run on Tcl Version 8.2 or later." }
if {[string compare [string index $timemessage_setting(time) 0] "!"] == 0} { set timemessage_timer [string range $timemessage_setting(time) 1 end] } { set timemessage_timer [expr $timemessage_setting(time) * 60] }
if {[lsearch -glob [utimers] "* timemessage_go *"] == -1} { utimer $timemessage_timer timemessage_go }
proc timemessage_go {} {
foreach chan $::timemessage_setting(channel) {
if {![validchan $chan] || ![botonchan $chan]} { continue }
if {![channel get $chan antiadver]} {
foreach line $::timemessage_setting(message) { putserv "PRIVMSG $chan :$line" }
}
}
if {[lsearch -glob [utimers] "* timemessage_go *"] == -1} { utimer $::timemessage_timer timemessage_go }
}
putlog "\002TIMEMESSAGE:\002 TimeMessage.tcl Version 1.0 by Wcc is loaded."
This variance must work correctly.
Hm.. I think it does not work because of codepage. When i copy code in file and try to launch, bot putlog a message.. Mm.. something about '=' symbol before every string /-:. But when i retype all spaces in cp1251 codepage, script will work correctly.. Also i fix some part of code..
--
Sorry for my english..
you set a channel flag. This flag maybe + or - ( == 1 or <>1 ). You can see that in .chaninfo #chan. Also exists setudef int, setudef str. Read more in tcl manuals.