mIRC bot delay on commands

Hey, so I’m currently writing a script that responds to commands – the response to commands work, however I’m trying to have a delay across all commands.

on *:text:*:#shinylunatone: {
    if (%command. [ $+ [ $1 ] ]) {
        //used to debug, this is the main issue here
        msg $chan %commanddelay+5000 $ticks
        if(%commanddelay+5000 < $ticks) {
            msg $chan %command. [ $+ [ $1 ] ]
            set %commanddelay $ticks

Basically I’m checking if five seconds have passed before responding to the command (which have been added in variables). It’s recording the %commanddelay variable fine, however it’s not adding the 5000ms onto it. When test messaging the channel with %commanddelay+5000, it gives a blank space instead and so the second if-statement will always be true and thus there will never be a delay between commands. I was just looking for some help into whether this is incorrect or another approach would be better. Thank you

In mIRC you can’t just use math operators like that. To add to the variable you have to use the $calc function: $calc(%commanddelay + 5000)

1 Like

This is what I was looking for! Thank you so much.

Using the “set -u” I normally would do something like this.

on *:TEXT:!TRIGGER:#channel: {
if (%flood) { return }
set -u10 %flood On
/msg # Flood protection not active.

Set’s a variable with a timer for 10 seconds, at which point it decays away… if the variable has a value… just halt/return/stop. Otherwise, set the timer and respond.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.