First of all, hi to everybody. I'm new here and i'm a real newbie in Tcl scripting too. (and sorry for my english too but it's not my first language).
I wanted to try to learn and to make a script by myself but i need a script that it's a bit too difficult for being my first script and so i prefer to ask some help.
I need a script for my eggdrop. The script should make a check when a nick joins in a specific channel. If the nick is on a list in a file on the shell the bot has to do nothing. If the nick isn't in the list the bot has to ban the nick (only the nick - so +b nick!*@*), and then delete the ban after 5 minutes. With the ban it has to send also a message to the banned nick.
The file with nicknames must be editable by some nicks with !add nick or !del nick commands.
Last... could be possible with a command like !take list ... (available only for some nicks) ... that the bot will send (through a dcc send) the file with the nick list?
... i was forgotten... could be possible to have a switch for running or not this script? I mean a !start and a !stop command.
I'm a newbie so it's all difficult for me.. but i've especially some doubts:
1) the file with the nick list ... on the shell... could be written/and read by the bot?
2) with the mirc script i use... this file is a .ini file. Must be the same for the bot? Have i to use a .txt file?
3) How can i say to the bot to take commands only from some nicks? Have i to make another file with a list? Is it enough to use flags?
4) Is it possible the use of dcc send for let the bot sending the file's list?
5) I think especially for nicks with { or [ should be more difficult for avoiding conflicts with the script.
6) Do i need any particular configuration of the bot for running a script such this one?
I try to past the script i'm using with mirc if can help to explain better what i need.
(the script hasn't the xdcc send option ... that i'd like to add for the bot).
;Name of the #channel and reason of the ban
alias protect.chan return #channel
alias motivo.ban return Guardian Banned You (Reason of the Ban)
;Nicks than can use !add or !del commands
;%except is for nicks won't be checked by the bot
on *:text:*:#:{
if ($chan == $protect.chan) {
if ($nick == first nick) || ($nick == second nick) || ($nick == ...all nicks can use !add or !del) {
if ($1 == !add) { add $2 }
if ($1 == !del) { del $2 }
}
}
}
on *:join:#:{
var %except = specialnicks*
if ($chan == $protect.chan) {
if ($youarein($nick) || (%except iswm $nick)) { .notice $nick 4Welcome 7 $nick 8In 9#channel 4:) }
else { .timer -o 1 $calc( 10 * 60) .mode # -b $nick | .mode # +b $nick | .kick # $nick 8Reason of the Ban }
}
}
on *:INPUT:#: {
if (!add == $1) { add $2 }
if (!del == $1) { del $2 }
}
alias youarein {
var %total = %nicks
var %x = 1
if (%total != 0) {
while (%x <= %total) {
if ($readini(nick.ini, list, %x) == $1) { return $true }
inc %x
}
}
return $false
}
alias add {
if (!$youarein($1)) {
inc %nicks
.writeini nick.ini list %nicks $1
.msg $protect.chan 9Added0,1 $1 4to the list!
echo -a 9Added0,1 $1 4to the list!
}
else { msg $protect.chan 9 $1 0,1It's already 4in the list! }
}
alias del {
if ($youarein($1)) {
var %x = 1
while (%x <= $calc(%nicks - 1)) {
if ($readini(nick.ini,list,%x) == $1) && (%a != $true) { .writeini nick.ini list %x $readini(nick.ini,list,$calc(%x + 1)) | var %a = $true }
if (%a == $true) { .writeini nick.ini list %x $readini(nick.ini,list,$calc(%x + 1)) }
inc %x
}
.remini nick.ini list %nicks
dec %nicks
.msg $protect.chan 9 $1 0,1deleted from 4the list!
echo -a 9Deleted0,1 $1 4from the list!
}
else { msg $protect.chan 9Il Nick0,1 $2 4Isn't in the list! }
}
alias debug.nick {
set %debug.nick on
var %x = 1
while (%debug.nick == on) {
if ($readini(nick.ini,list,%x)) { inc %x }
else { set %nicks $calc(%x - 1) | set %debug.nick off }
}
}
on 1:START:{ debug.nick }
on *:LOAD:{ set %nicks 0 }
Thank you to everybody.