mIRC Home    About    Download    Register    News    Help

Print Thread
#271258 29/01/23 08:53 AM
Joined: Jun 2022
Posts: 8
C
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Jun 2022
Posts: 8
Hello everyone.
I am looking for a script that could tell me 10 minutes before the DJ goes live from: Hey! There goes a DJ live over 10 minutes.
I don't know how to make something like that?

Is there somebody with that kind of information who'll ready to share or make me a script like that

Thanks for the sender of this message.

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
I had to read your post many times before I could figure out part of what you wanted. Your post read as if you were looking for someone literally saying the word OVER. So if below is not what you want, you need to explain better. This code looks in all channels for someone saying a message containing

dj live in SOMETHING minutes

... where SOMETHING is a number.

* This uses a 'regular expression' so you must be careful if you need to modify the match-text to change the message which triggers it. The ' *' are so that it works if the message has several consecutive spaces, and the * does not mean the same thing in regular expressions that it means in wildcards.

* You did not say how it should 'tell' you. Should it only display the 10 minutes reminder in channel window, or also play a sound? It currently shows a message reminder in the channel, and then it makes a beep 10 times. If you do not want the sound, you can remove the line containing the word BEEP. If you want it to instead play-to-yourself-only a .WAV sound file that's in your WAV sounds folder, you can change it to something like:

/splay alert.wav

... and it will play alert.wav if that filename exists in your .wav folder. (And of course if sounds are enabled)

* If the message says the DJ is coming sooner than 10 minutes, it will do the alert now

* You can change the 10 in %reminder if you want the advance notice to be a different number of minutes

* It uses the same timer name for the same channel, so that "live in 25" and then 5 minutes later "live in 20" do not create 2 alerts at the same time. The alert is created using the last time this text is seen

* the 1st line of the ON TEXT is an "if" statement to check if the nick has +voice or higher status. You can remove that if you do not want it.

* You can change :#: to list 1 channel, or be a list of comma-separated channelnames to avoid this triggering in every channel. For example:

:#music:
or
:#music,#badmusic:

Code
ON $*:TEXT:/dj *live *in *(\d+) *minutes/iS:#:{
  if (!$nick($chan,$nick,a,r)) return
  var %reminder 10
  var %alert $max(0,$calc($regml(1) - %reminder))
  var %alert.time $asctime($calc($ctime + 60*%alert),HH:nn)
  var %DJ.time $asctime($calc($ctime + 60*$regml(1)),HH:nn)
  echo -g $target setting alert for %alert minute(s) in the future at %alert.time for DJ here at %DJ.time
  .timerDJalert $+ $network $+ $target -o 1 $max(0,$calc(60*%alert)) DJ_Alert $unsafe( $target %alert %DJ.time )
}

alias DJ_Alert {
  echo -g $1 DJ Alert for $2 minutes in the future at $3 $+ !
  beep 10 500
}

Joined: Jun 2022
Posts: 8
C
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Jun 2022
Posts: 8
I do really understand what you mean but..

I was officialy searching for something like this

if ($asctime(HH:NN:SS) == 09:50:00) {
// Do something
}

and if the time is not for example 09:50:00 then do nothing in that case, i need a function to put the script on name of the DJ name.

I want to do a check up on four different days on four different times.

Sunday: 09:50:00
Monday: 11:50:00
Thursday: 11:50:00
Friday: 09:50:00

Last edited by ChatSmurf; 30/01/23 08:25 AM. Reason: Giving more information about my wishes.
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Well after reading your latest post, I went back to the original, and there's no way I could've possible read the 1st post to be close to what you're wanting in the 2nd one.

I didn't run this script or change my clock to test it, but it should work.

What this alias does is check the current time that it's running, then sets %day to the 3-letter code for the day of the week, Sun thru Sat, and sets %now to be the current HourMinutes. It then creates %next as whichever is the next closest future time of the day between these 2 times, so obviously the variable contains a time between 950 and 1149 then the next nearest time will be 11:50, but otherwise it would be 09:50.

If the alias runs at 9:50am on Sun or Fri, the echo is where you can put your 'do stuff'.
And likewise, if it runs at 11:50am on Mon or Thu, there's another echo for that stuff.

But regardless of whether it matches any of those day/time combos, it then launches the timer again trying to execute at the next time window.

The syntax for timer lets you either set it to run at a specific hours:minutes within the next 24 hours, or to run at a specific number of seconds in the future. It's a lot simpler here to let it execute on each day of the week, but only do things on the correct days.

I have no idea what you mean by putting the script on the name, or doing a checkup. So that's probably in the place for the 'do stuff'. Depending on what you want to do those 4 days, it might be needed to split the Sun Fri trigger into 2 sections.

Code
alias DJtime {
  var %now $asctime($ctime,HHnn) , %day $asctime($ctime,ddd)
  var %next 09:50
  if (%now isnum 0950-1149) var %next 11:50

  if ( (%now == 0950) && ( $istok(Sun Fri,%day,32) )) {
    echo -s do stuff at 950am on Sun or Fri

    goto next
  }

  if ( (%now == 1150) && ( $istok(Mon Thu,%day,32) )) {
    echo -s do stuff at 1150am on Mon Thu

    goto next
  }

  :next
  .timerDJtime -o %next 1 0 DJtime
}


Link Copied to Clipboard