A timestamp routine - every PW needs one right? These timestamps have been tested on the NWN2 pre-release toolset and NWN2 MP Beta - so they should be accurate. Should someone find an issue with them, please let me know so I can fix it right away!
Also if you have any ideas for features you would like to see added, let me know. :).
The use of the script is fairly straightforward, call TimeStamp() when you want to get the current time (probably want to store this somewhere). You can compare timestamps to see if a certain amount of time has passed - i.e., a monster spawning 5 minutes after it has been defeated.
//------------------------------------------------------------------------------
--------
//Written by Ryne Anderson of the Bid for Transcendence: The Age of Knowledge PW team.
//http://www.age-of-knowledge.com/
//Feel free to duplicate or modify this code to your content. But please be kind
//and give credit where credit is due =).
//
//Before calling TimeStamp() - make sure you have configured how many
//Minutes per hour your module is set up for (the default is 2). To configure it
//simply call SetMinPerHour(xxx) once - a good place to do it is on the event 'On Module Load'
//*To see how many minutes/hour your module is set to, go to
//View -> Module Properties -> Minutes Per Game Hour
//
//TimeStamp() usage
//Just call TimeStamp() when you want to store the current time of the module.
//To see if something occurred x minutes ago...
//1) Create a new timestamp
//2) Retrieve the previously stored timestamp
//3) Subtract the previously stored timestamp from the new timestamp
//4) If the result is greater than x, then x minutes have passed.
//
//ex)
//int iMinutesPassed = 10;
//int iCurrentTime = TimeStamp();
//int iPreviousTime = GetLocalInt(GetModule(),"LastStoredTime");
//if(iCurrentTime - iPreviousTime >= iMinutesPassed)
//{
// ...do stuff here
//}
//Note : All time comparisons must be done in minutes.
//------------------------------------------------------------------------------
--------
Posted by SorceressAshura at 2006-11-14 12:30:14 Voted 10.00 on 11/14/06
Great tool, thanks for explaning it to me Ryne. I can use this for scripts that are suppose to run once every hour. Or even work it into my weather system. _________________________ AKA: GuardianofLore.
10 - A Masterpiece, Genuinely Groundbreaking 9 - Outstanding, a Must Have 8 - Excellent, Recommended to Anyone 7 - Very Good, Deserves a Look 6 - Good, Qualified Recommendation 5 - Fair, Solid yet Unremarkable 4 - Some Merit, Requires Improvements 3 - Poor Execution, Potential Unrealized 2 - Very Little Appeal 1 - Not Recommended to Anyone