mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2008
Posts: 22
I
ix007 Offline OP
Ameglian cow
OP Offline
Ameglian cow
I
Joined: Jan 2008
Posts: 22
How would I check conflicting times?
example: if i had an event at 1:30pm and I wanted a hour and a half cushion. Meaning it wouldn't pick up anything before 3:00pm could not be triggered, but anything before 1:30pm could be triggered.

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
difficult, but not impossible.. you'd have to store the event time and the cushion time, then check any subsequent event times to ensure that they are greater than the event time + the cushion time.

If you could give a better example of the type of event you have in mind, it would help.

Joined: Jan 2008
Posts: 22
I
ix007 Offline OP
Ameglian cow
OP Offline
Ameglian cow
I
Joined: Jan 2008
Posts: 22
Well, right now. its for a gameserver rental service. when someone types .schedule <time>
its triggered in an ON TEXT.
I was going to try to make an if statement but it seems like a long hard process.
Time format is hh:nntt

Joined: Aug 2006
Posts: 183
T
Vogon poet
Offline
Vogon poet
T
Joined: Aug 2006
Posts: 183
With what you wrote you're saying you you do NOT want anything BEFORE 3pm to trigger it but you also want it triggered on anything BEFORE 1:30pm? Anything that's before 3pm will be before 1:30 pm.

Now, I'm going to assume for a second that you want it to trigger at anytime BETWEEN 1:30pm and 3pm?

If so...

Code:
if ( ( $Gettok($asctime(HH:nn:ss),1,58) <= 15 ) && ( $calc($Gettok($asctime(HH:nn:ss),1,58) + $Gettok($asctime(HH:nn:ss),2,58) / 60 ) >= 13.5 ) ) { do stuff here }


There's probably an easier way, using Regex. I'm tired and the brain doesn't want to be bothered with Regex though.

Last edited by Thrull; 23/03/08 03:55 AM.

Yar
Joined: Jan 2008
Posts: 22
I
ix007 Offline OP
Ameglian cow
OP Offline
Ameglian cow
I
Joined: Jan 2008
Posts: 22
if there is a time like 2:00. I want it not to be able to be triggered until after a hour and a half time period.

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I was thinking almost the opposite.. if the event gets set between 1:30 and 3 pm, then nothing happens.
Code:
on *:text:.schedule*:#:{
  if !$3 { .msg $nick Usage: .schedule [length] [start time] }
  else {
    inc %schedule
    set $+(%,schedule.start,%schedule) $ctime($date $$3-)
    if $($+(%,schedule.start,%schedule),2) < $ctime {      inc $+(%,schedule.start,%schedule) 86400    }
    set $+(%,schedule.end,%schedule) $calc($($+(%,schedule.start,%schedule),2) + $duration($2))
  }
  var %a = 1, %b = %schedule
  while %a < %b {
    if $($+(%,schedule.start,%schedule),2) isnum $+($($+(%,schedule.start,%a),2),-,$($+(%,schedule.end,%a),2)) {
      .msg $nick Sorry but your requested schedule time conflicts with a previous schedule
      unset $+(%,schedule.*,%schedule)
      dec %schedule
      halt
    }
    inc %a
  }
}

Joined: Jan 2008
Posts: 22
I
ix007 Offline OP
Ameglian cow
OP Offline
Ameglian cow
I
Joined: Jan 2008
Posts: 22
ahh. Perfect! This was exactly what I was looking for. Thanks for the help.

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
That will also allow people to set schedules up to 24 hours in advance, but not any further and it also won't keep track on a channel by channel and/or network basis.


Link Copied to Clipboard