mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2014
Posts: 18
D
Pikka bird
OP Offline
Pikka bird
D
Joined: Dec 2014
Posts: 18
Ok, so what I am wanting to do is have an !addcom !delcom !editcom script that puts a delay in between uses of the command. For example,
MOD: !addcom !Hello Hey
NOOB: !Hello
BOT: Hey
NOOB:!Hello
(it takes 15 seconds before the command works again for normal users, but for a mod it works instantly)
This is what I have so far

on *:text:!addcom *:#: {
if ($nick isop #) {
var %r = $read(commands.txt,ns,$2)
if (%r) { .msg $chan [ $+ $nick $+ ]: Error, This command $qt($2) is already exist into the database! | return }
write commands.txt $2-
msg $chan /me + Command $2 has been added to the database!
}
}
on *:text:!delcom *:#: {
if ($nick isop #) {
var %r = $read(commands.txt,ns,$2)
if (!%r) { .msg $chan [ $+ $nick $+ ]: Error, This command $qt($2) does NOT exist into the database! | return }
write -dl $+ $readn commands.txt
msg $chan /me - Command $2- has been deleted from the database!
}
}
on *:text:!editcom & *:#: {
if ($nick isop #) {
var %r = $read(commands.txt,ns,$2)
if (!%r) { .msg $chan [ $+ $nick $+ ]: Error, This command $qt($2) does NOT exist into the database! | return }
write -l $+ $readn commands.txt $2-
msg $chan /me -> Command $2 has been updated!
}
}
ON *:TEXT:*:#: { tokenize 32 $strip($1-,burci)
if ($read(commands.txt, nts, $1)) {
var %com = $v1
var %com = $replace(%com,@user@,$iif($2,$2,?),@nick@,$nick,@target@,$target)
if (-ul=mod == $gettok(%com,1,32)) && ($nick !isop $chan) { msg $chan | return }
msg $chan $iif(-ul=mod == $gettok(%com,1,32),$gettok(%com,2-,32),$gettok(%com,1-,32))
}

Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Code:
on *:text:!addcom *:#: {
  if ($nick isop #) && (!%addcom) {
    set -u15 %addcom .
    var %r = $read(commands.txt,ns,$2)
    if (%r) { .msg $chan [ $+ $nick $+ ]: Error, This command     $qt($2) is already exist into the database! | return }
    write commands.txt $2-
    msg $chan /me + Command $2 has been added to the database!
  }
}

This should work, but i didnt test it. As lon as %addcom exist the code halt, and it will be unset after 15 seconds.

And by the way, use the code tags when posting code, easyer so see the code that way. Start [ code ] end [ /code ] <- remove the spaces.


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Dec 2014
Posts: 18
D
Pikka bird
OP Offline
Pikka bird
D
Joined: Dec 2014
Posts: 18
Im not wanting the delay on the !addcom part. I am wanting it to be on the response. So there is a 15 second delay between when each individual command can be used.

Viewer: !Hi
Bot: Hey!
Viewer: !Hi
(wait 15 seconds)
Viewer: !hi
Bot: !hey


And I want each viewer to have to wait the 15 seconds, so 30 viewers dont do !hi all at once


Link Copied to Clipboard