mIRC Home    About    Download    Register    News    Help

Print Thread
[Twitch] Advanced Timed Messages #255474 27/10/15 12:55 PM
Joined: Oct 2015
Posts: 112
B
Blas Offline OP
Vogon poet
OP Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
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!

Re: [Twitch] Advanced Timed Messages [Re: Blas] #255475 27/10/15 02:01 PM
Joined: Feb 2015
Posts: 243
O
OrFeAsGr Offline
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
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
}
}
}
}


Last edited by OrFeAsGr; 27/10/15 02:02 PM.
Re: [Twitch] Advanced Timed Messages [Re: OrFeAsGr] #255476 27/10/15 02:57 PM
Joined: Oct 2015
Posts: 112
B
Blas Offline OP
Vogon poet
OP Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
Thank you so much! I will be using/testing this out right away! grin

Re: [Twitch] Advanced Timed Messages [Re: OrFeAsGr] #255477 27/10/15 04:01 PM
Joined: Oct 2015
Posts: 112
B
Blas Offline OP
Vogon poet
OP Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
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

Re: [Twitch] Advanced Timed Messages [Re: Blas] #255479 27/10/15 04:23 PM
Joined: Feb 2015
Posts: 243
O
OrFeAsGr Offline
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
No problem! But unset command unsets the variable, So the line wasn't needed.

Last edited by OrFeAsGr; 27/10/15 04:26 PM.
Re: [Twitch] Advanced Timed Messages [Re: OrFeAsGr] #256215 30/12/15 07:07 AM
Joined: Dec 2015
Posts: 1
T
turtleturtle Offline
Mostly harmless
Offline
Mostly harmless
T
Joined: Dec 2015
Posts: 1
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

Last edited by turtleturtle; 30/12/15 08:25 AM.
Re: [Twitch] Advanced Timed Messages [Re: turtleturtle] #256274 04/01/16 12:57 PM
Joined: Feb 2015
Posts: 243
O
OrFeAsGr Offline
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
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)

Last edited by OrFeAsGr; 04/01/16 12:58 PM.