mIRC Homepage
Posted By: Blas [Twitch] Advanced Timed Messages - 27/10/15 12:55 PM
Good day. I am somewhat new to mIRC scripting, but I have figured out enough to easily make a script that will post messages into chat after X lines of chat OR after X number of minutes. What I want is to create is a script that will check for BOTH. For example, it will only post the message if at least ten minutes have passed and there have been at least ten lines of chat, and then it would reset both counters and post the message again once both variables are true.


Message counter script:

Code:
on *:TEXT:*:#: {
  INC %msgCounter {
    if (%msgCounter = 10) { msg $chan This is my auto-message | return }
  }
  if (%msgCounter < 10) { return }
  set -u1 %msgCounter On
}


Timed message script:

Code:
on *:TEXT:!startannouncer:#: {
  if ($nick isop #) {
    msg # Announcer is now starting.
    .timerAnnouncer 0 600 /play # C:\testfile.txt
  }
}
 
on *:TEXT:!stopannouncer:#: {
  if ($nick isop #) {
    msg # Announcer is now stopping.
    .timerAnnouncer off
  }
}


I'm not sure if I can combine these two somehow, or if I would need an entirely new script. Any help would be appreciated. Thanks!
Posted By: OrFeAsGr Re: [Twitch] Advanced Timed Messages - 27/10/15 02:01 PM
Hello smile
You have a little typo in the second line of the counter script.
You don't need a { there and since you dont need that you dont need a closing bracket as well.
Other than that the scripts are just fine but they need a slight modification to do what you want.
Code:
on *:TEXT:!startannouncer:#: {
  if ($nick isop #) {
if (!%announce) {
    msg # Announcer is now starting.
    set %announce $ctime
}
  }
}
 
on *:TEXT:!stopannouncer:#: {
  if ($nick isop #) {
if (%announce) {
    msg # Announcer is now stopping.
unset %announce
    }
  }
}

Code:
ON *:TEXT:*:#: {
if (%announce) {
inc %msgcounter 1
if (%msgcounter >= 10) {
if ($calc($ctime - %announce) >= 600) {
msg #chan YOur msg here
unset %msgcounter
set %announce $ctime
}
}
}
}

Posted By: Blas Re: [Twitch] Advanced Timed Messages - 27/10/15 02:57 PM
Thank you so much! I will be using/testing this out right away! grin
Posted By: Blas Re: [Twitch] Advanced Timed Messages - 27/10/15 04:01 PM
So I got the script to work. I had to add a line after the "unset %msgcounter" from your script, otherwise the %msgcounter variable simply continued adding since it's last variable number.

Code:
set -u1 %msgCounter On


So I think it's working flawlessly now. Thanks again for the help. smile
Posted By: OrFeAsGr Re: [Twitch] Advanced Timed Messages - 27/10/15 04:23 PM
No problem! But unset command unsets the variable, So the line wasn't needed.
Posted By: turtleturtle Re: [Twitch] Advanced Timed Messages - 30/12/15 07:07 AM
Hi there OrFeAsGr ,
Thank you for being so awesome <3 .... after much tinkering with a few characters in your awesome script I was able to figure how to have the script respond to all the chat channels active after #of time and # of msg lines! ... it's amazing!!!!



Many thanks yous.. <3
Posted By: OrFeAsGr Re: [Twitch] Advanced Timed Messages - 04/01/16 12:57 PM
Your welcome smile Happy new year smile ^_^
(In my site (in the signature) you can also see mirc scripting faq I'm adding more stuff that can help)
© mIRC Discussion Forums