daily pastebin goal
15%
SHARE
TWEET

Register For Next Weekday

Matthiaswagg Apr 27th, 2015 16 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. float Function HoursUntilTimeOnDOW(float hour, int dow)  ; Sundas is 0, Morndas is 1, etc.
  2. {Returns number of hours until the target time on a specific day of the week.
  3. Values of 9.5 and 1 will return 2 if it's 7:30 on a Morndas, but those same
  4. values would return 166 (7 * 24 - 2) if it's already 11:30 on a Morndas.}
  5.         float targetTime = dow * 24 + hour  ; scale target time into hour offset during week
  6.         float currentTime = Utility.GetCurrentGameTime()  ; scale current time to match
  7.     currentTime = (((currentTime as int) % 7) + (currentTime - (currentTime as int))) * 24
  8.         if currentTime >= targetTime ; it's already past the target time this week
  9.                 targetTime += 7 * 24 ; add a week
  10.         endif
  11.         return targetTime - currentTime
  12. EndFunction
  13.  
  14.  
  15. ; Register for 9:30 on next Morndas + one week (7 days * 24 hours)
  16. RegisterForSingleUpdateGameTime(HoursUntilTimeOnDOW(9.5, 1) + 168)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top