• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

TimeAPI

Status
Not open for further replies.
Level 21
Joined
Aug 3, 2004
Messages
710
JASS:
native GetTimeSeconds  takes nothing returns integer // seconds (0 - 60)
native GetTimeMinutes  takes nothing returns integer // minutes (0 - 59)
native GetTimeHours    takes nothing returns integer // hour (0 - 23)
native GetTimeMonth    takes nothing returns integer // month (0 - 11, 0 = January)
native GetTimeDayWeek  takes nothing returns integer // day of week (0 - 6, 0 = Sunday)
native GetTimeDayMonth takes nothing returns integer // day of month (1 - 31)
native GetTimeDayYear  takes nothing returns integer // day of year (0 - 365)
native GetTimeYear     takes nothing returns integer // year since 1900

Tutorial: N/A
Download: N/A
Native Set Type: Single Player or WarSoc
Release: 0.03alpha
Other: N/A
 
Level 5
Joined
Jun 26, 2007
Messages
63
Nice job Mindy! Thanks for adding my ideas. :smile:
-Saitek

[EDIT]

Here's a trigger that syncs the system clock with the Warcraft 3 game clock.

JASS:
function Trig_Real_Time_Actions takes nothing returns nothing  
call SetTimeOfDay((I2R(GetTimeHours())) + (I2R(GetTimeMinutes()))/60 + 
(I2R(GetTimeSeconds()))/3600) 
endfunction 
//===========================================================================
 function InitTrig_Real_Time takes nothing returns nothing
  set gg_trg_Real_Time = CreateTrigger( )
  call TriggerRegisterTimerEventPeriodic( gg_trg_Real_Time, 30.00 )
  call TriggerRegisterTimerEventSingle( gg_trg_Real_Time, 0.00 )
  call TriggerAddAction( gg_trg_Real_Time, function Trig_Real_Time_Actions )
  call SetTimeOfDayScale(0.0055) 
endfunction
The time is re synced every 30 seconds just in case someone pauses the game thus pausing the WC3 clock.

Note: This will only work in single player.
In a LAN or Bnet game it will cause a desync.

Have fun! :thumbs_up:
 
Last edited:
Status
Not open for further replies.
Top