Search code examples
mirc

Repeat task, random message Mirc Scipt


Currently it reads the text.txt at random and it displays on a channel

on *:TEXT:!command:#channel:{
  /msg $chan $read(text.txt)

I don't understand how to make it auto execute at x minute intervals, whitout using the !command

I've beginner at this, I want to make it like a /timer but can add read random lines from the text everytime


Solution

  • It's been a while since I last worked with mIRC, so I had to look up the documentation on /timer, but you should be able to do something like this:

    on *:TEXT:!command:#channel:{
      /timer 0 60 /msg $chan $!read(<textfile>)
    }
    

    This will execute /msg $chan $!read(<textfile>) an infinite number of times at 60 second intervals once !command has been entered into a channel.

    If you need to cancel the timer for some reason, you would need to name the timer, which can be done by appending a name to the command, such as /timerMESSAGE or /timer1, and then including a command to turn the timer off, such as:

    on *:TEXT:!timeroff:#channel:{
      /timer<name> off
    }
    

    replacing <name> with the name of your timer.

    EDIT: Thanks to Patrickdev for pointing out the difference of $!read() versus $read() for timer commands.