Hi, I am trying to set up a series of actions using !commands
Atm, I have it set up so I can do all the !commands, but, I cannot get it to work for others.... I would like help in setting this up for others to also use this...
Here is the TCL file stuff I have atm.... it's one of the scripts available from eggdrop.org :)
atm, I have only to wish the ability for others (ops) to type !add {name} {Text goes here} type situations....
In this way, a person can type:
!add Help Help is designed to walk you through the text system. ?? Help is how you access it. It is CASE/case Sensitive, and requires ops to input data. !add is the command to add new info.
and get:
(via /notice from the bot) Help Help is designed to walk you through the text system. ?? Help is how you access it. It is CASE/case Sensitive, and requires ops to input data. !add is the command to add new info.
Below is the actual code. All assistance is appreciated :)
##############################################################################################
## DictionarySystem v1.03 || Created by: dbz-gt || Editors: N/A || Made on 14-08-2002 #
##############################################################################################
## Edited on 25-08-2002 ||
#######################################################################################
## AGAIN A SCRIPT OF DBZ-GT :D //\\ Do you need more, come on irc.Quakenet.org ##
## and join #dbz-gt and ask me (dbz-gt, duh) for the other scripts that I have made. ##
#######################################################################################
##
## Copyright stuff:
## -----------------
## You may change the script like you want it, but please don't delete the copyright.
## I want to become 'important' ;). Anyway, you may edit the script like you wish and
## if you have some cool tips or stuff edit, you can always message me about them.
## E-mail: dbz_gt01@hotmail.com
## IRC: irc.Quakenet.org // Channel: #dbz-gt // Nick: dbz-gt
##
##
## !That's all!
#######################################################################################
##########
### BEGIN CONFIG
### EDIT THE NEXT LINES
### IF YOU DON'T EDIT THEM, MAYBE THE SCRIPT WILL NOT WORK
##########
### The file name where all the words of the dictionary
### system will be saved so they don't lost when the bot
### goes offline
set file "words.db"
### This function is new, added in version 1.03
### If you want to disable this script in some channels
### You have to put them in this variable and they
### can't use this script anymore
set chan_ign "#test.channel"
##########
### END CONFIG
### DON'T EDIT THE LINES HERE BELOW, IF YOU DON'T KNOW WHAT
### YOU ARE DOING!
##########
### Binds
bind pub m|m !add pub:add
bind pub m|m !del pub:del
bind pub - ?? pub:check
bind pub m|m !list pub:list
bind pub m|- .globadd pub:globaladd
bind pub m|- .globdel pub:globaldel
bind time - "* * * * *" start:save
### On starting the bot the file with the name $file will be readed
### so the words will be saved into the arrays
proc start:read {} {
global cwd file
if {[file exist $file]} {
set fs [open $file r]
while {![eof $fs]} {
gets $fs line; set $line [join $line]
if {[llength $line] >= 2 } {
set wchan [lrange $line 0 0]
if {![info exist cwd($wchan)]} { set disc [lrange $line 1 end]; set cwd($wchan) "$disc" }
}
}
close $fs
}
}
### Every minute the arrays will be saved into the file with the name $file
proc start:save {mi ho da mo ye} {
global cwd file
set fs [open $file w+]
set total "[llength [array names cwd]]"
foreach array_id [array names cwd] {
if {$cwd($array_id) != ""} {
set disc "$cwd($array_id)";
puts $fs "$array_id $disc"
}
}
close $fs
putcmdlog "UPDATE: \002$total\002 words saved in the file \002$file\002."
}
### The add function here below will add the word and discription in the array
proc pub:add { nick username handle channel args } {
global chan_ign
set args [join $args]
set word [lrange $args 0 0]
set disc [join [lrange $args 1 end]]
set channel [string tolower $channel]; set chan_ign [string tolower $chan_ign]
if {[lsearch $chan_ign $channel] < "0" } {
if {$word == ""} {
putserv "NOTICE $nick :You forgot the word! \037Syntax: \002!add <word> <discription>\002\037"
} elseif {$disc == ""} {
putserv "NOTICE $nick :You forgot the discription! \037Syntax: \002!add <word> <discription>\002\037"
} else {
global cwd
set cwd($word$channel) "$disc"
putserv "NOTICE $nick :Added succesfully the word \002$word\002 in the channel \002$channel\002 with the discription: \002$disc\002"
}
} else { putserv "NOTICE $nick :This channel is ignored for using the DictionarySystem. Please take contact with the owner of this bot." }
}
### This is a new proc as well, it is added in version 1.03
### It add the word GLOBAL so all the channels read it
proc pub:globaladd { nick username handle channel args } {
global chan_ign
set args [join $args]
set word [lrange $args 0 0]
set disc [join [lrange $args 1 end]]
set channel [string tolower $channel]; set chan_ign [string tolower $chan_ign]
if {[lsearch $chan_ign $channel] < "0" } {
if {$word == ""} {
putserv "NOTICE $nick :You forgot the word! \037Syntax: \002.globadd <word> <discription>\002\037"
} elseif {$disc == ""} {
putserv "NOTICE $nick :You forgot the discription! \037Syntax: \002.globadd <word> <discription>\002\037"
} else {
global cwd
set cwd(global-$word) "$disc"
putserv "NOTICE $nick :Added succesfully the word \002$word\002 in the \002GLOBAL LIST\002 with the discription: \002$disc\002"
}
} else { putserv "NOTICE $nick :This channel is ignored for using the DictionarySystem. Please take contact with the owner of this bot." }
}
### Here you will get a discription about the word you want, IF it exists.
proc pub:check { nick username handle channel args } {
global cwd chan_ign
set args [join $args]
set word [lindex $args 0]
set channel [string tolower $channel]; set chan_ign [string tolower $chan_ign]
if {[lsearch $chan_ign $channel] < "0" } {
if {$word == ""} {
putserv "NOTICE $nick :You forgot the word! \037Syntax: \002?? <word>\002\037"
} else {
if {[info exist cwd(global-$word)]} {
putserv "NOTICE $nick :\037\[GLOBAL\] $word\037: [join $cwd(global-$word)]"
} elseif {[info exist cwd($word$channel)]} {
putserv "NOTICE $nick :\037$word\037: [join $cwd($word$channel)]"
} else {
putserv "NOTICE $nick :Couldn't find the word \002$word\002 (even not in the GLOBAL list)"
}
}
}
}
### With a while you will get the holl list of words
proc pub:list { nick username handle channel args } {
global cwd chan_ign
set channel [string tolower $channel]; set chan_ign [string tolower $chan_ign]
if {[lsearch $chan_ign $channel] < "0" } {
if {![info exist cwd]} {
putserv "NOTICE $nick :No words in database found."
} else {
foreach array_id [array names cwd] {
if {$cwd($array_id) != ""} {
set disc "$cwd($array_id)"; set parts [split $array_id #]; set word [lrange $parts 0 0]; set chan [lrange $parts 1 1]
if {$channel == "#$chan"} { putserv "NOTICE $nick :\[\037$word\037\]: $disc" }
}
}
}
} else { putserv "NOTICE $nick :This channel is ignored for using the DictionarySystem. Please take contact with the owner of this bot." }
}
### You can delete the words you want.
proc pub:del { nick username handle channel args } {
global cwd chan_ign
set args [join $args]
set word [lrange $args 0 0]
set channel [string tolower $channel]; set chan_ign [string tolower $chan_ign]
if {[lsearch $chan_ign $channel] < "0" } {
if {$word != ""} {
array unset cwd "$word$channel"
putserv "NOTICE $nick :Removed the word \002$word\002 of the channel \002$channel\002"
} else {
putserv "NOTICE $nick :You forgot the word! \037Syntax: \002!del <word>\002\037"
}
} else { putserv "NOTICE $nick :This channel is ignored for using the DictionarySystem. Please take contact with the owner of this bot." }
}
### This is a new proc as well, it is added in version 1.03
### It removes GLOBAL words
proc pub:globaldel { nick username handle channel args } {
global cwd chan_ign
set args [join $args]
set word [lrange $args 0 0]
set channel [string tolower $channel]; set chan_ign [string tolower $chan_ign]
if {[lsearch $chan_ign $channel] < "0" } {
if {$word != ""} {
array unset cwd "global-$word"
putserv "NOTICE $nick :Removed the word \002$word\002 from the \002GLOBAL\002 list"
} else {
putserv "NOTICE $nick :You forgot the word! \037Syntax: \002.globdel <word>\002\037"
}
} else { putserv "NOTICE $nick :This channel is ignored for using the DictionarySystem. Please take contact with the owner of this bot." }
}
start:read
putlog "DictionarySystem is succesfully \002LOADED\002. Version 1.03 created by \037dbz-gt\037 (c) 2002"