logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Timer, timer event and logout

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules
View previous topic :: View next topic  
Author Message
Valgav



Joined: 28 Aug 2010
Posts: 53

PostPosted: Sat Apr 18, 2015 19:25    Post subject: Timer, timer event and logout Reply with quote

I need some counter not very accurate, probably not shorter than one minute but it would be great if it could.

Currently I'm using something like that:

-setting local variable with current timestamp on PC
-DelayCommand function
-function checks variable and removes it then do the stuff

-another function check variable on enter and if it exists and if current timestamp is later than that in variable, it applies the function if not and server was restarted it applies new delay.

But it's somehow messy and there are delays going even when player logs out so is there any other nice way to do that better? I thought about global function checking some array of current timers. But it's like going through list each time.
Back to top
View user's profile Send private message
elven



Joined: 28 Jul 2006
Posts: 259
Location: Germany

PostPosted: Sun Apr 19, 2015 12:23    Post subject: Reply with quote

Instead of using DelayCommand, you could just use the Module Heartbeat to check for timer expiry on each PC (with GetFirst/NextPC). That HB runs every 6 seconds.
_________________
silm.pw, a player-driven Forgotten Realms NWN1 persistent world for tinkerers.
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Wed Apr 29, 2015 14:02    Post subject: Reply with quote

Heartbeat or even pseudo HB's are more reliable than a single DelayCommand.

DelayCommand can be impacted by the Set time methods in nwscript.
Eg: Advancing the time by 1 hour, will advance the DelayCommand by RoundToSeconds(HourToRound(1)) ; or something like that.

On occasion I have found that by doing SetTime commands incorrectly, could actually trigger a 72 hour reboot timer instantly.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group