Jump to content
Sign in to follow this  
Catchdog64

Tying a trigger to a date

Recommended Posts

Hello, I'm making a mission with ALIVE, wherein I want a force to invade on a specific date. I've been been trying to get this to work  if date // _now = [2017,05,10,5,00], I've put this into the condition field and it doesn't seem to work.

Share this post


Link to post
Share on other sites

What exactly did you put into the condition field? And which condition field? A trigger?

Please be as specific as possible, doesn't take that much time.

For a trigger try something like this:

 

date isEqualTo [2017,05,10,5,00]

 

Cheers

Share this post


Link to post
Share on other sites
Quote

if date // _now = [2017,05,10,5,00]

I put that into the condition field on my trigger.

Share this post


Link to post
Share on other sites

 

8 minutes ago, Catchdog64 said:

 

Quote

if date // _now = [2017,05,10,5,00]

I put that into the condition field on my trigger.

 

 

2 hours ago, Grumpy Old Man said:

try something like this:

 


date isEqualTo [2017,05,10,5,00]

 

Share this post


Link to post
Share on other sites
3 minutes ago, Catchdog64 said:

I put that into the condition field on my trigger.

When you do this game will check this condition 60 times each second until condition not satisfied. You can also create thread sleeping until date/time you want:

SleepUntilDate = {
	sleep (60 * 60 * 24 * 365 * (dateToNumber _this - dateToNumber date) / timeMultiplier)};

// Usage:
[2035,5,28,13,37] call SleepUntilDate;

 

Share this post


Link to post
Share on other sites
1 hour ago, serena said:

When you do this game will check this condition 60 times each second until condition not satisfied.


1. trigger condition is checked 120 times a minute

2. sleep only guaranteed to sleep at least given amount of seconds

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, serena said:

When you do this game will check this condition 60 times each second until condition not satisfied. You can also create thread sleeping until date/time you want:


SleepUntilDate = {
	sleep (60 * 60 * 24 * 365 * (dateToNumber _this - dateToNumber date) / timeMultiplier)};

// Usage:
[2035,5,28,13,37] call SleepUntilDate;

 

 

Calling a sleep will do you no good.

 

Cheers

Share this post


Link to post
Share on other sites
8 minutes ago, killzone_kid said:

1. trigger condition is checked 120 times a minute

2. sleep only guaranteed to sleep at least given amount of seconds

  1.  Ehh, you're right. Trigger condition is checked every 0.5 sec, waitUntil condition is every 0.0166 sec - 60 times per second. :)
  2. For task that is solved in this particular case, there is not much difference, the thread will wake up exactly after 100500.000 seconds or after 100500.001 seconds. Right?
13 minutes ago, Grumpy Old Man said:

Calling a sleep will do you no good.

Why?

Share this post


Link to post
Share on other sites
11 minutes ago, serena said:

Right?

Nope. As I said it will only be guaranteed to sleep given amount at least, but usually sleeps longer especially when engine is loaded, so you might just oversleep

Share this post


Link to post
Share on other sites
15 minutes ago, killzone_kid said:

Nope. As I said it will only be guaranteed to sleep given amount at least, but usually sleeps longer especially when engine is loaded, so you might just oversleep

Technically this can happen. The question is, how likely is it practically and how much will the gap be. I regularly use this approach and it always works perfectly. Maybe you're right, and I'll once face such a problem :)

Share this post


Link to post
Share on other sites
26 minutes ago, serena said:

Technically this can happen. The question is, how likely is it practically and how much will the gap be. I regularly use this approach and it always works perfectly. Maybe you're right, and I'll once face such a problem :)

Depends on how many spawned scripts there and how busy is script engine. If overloaded could be minutes over (extreme cases)

Share this post


Link to post
Share on other sites
36 minutes ago, killzone_kid said:

Depends on how many spawned scripts there and how busy is script engine. If overloaded could be minutes over

Checking trigger conditions and unscheduled environment in which it is running apparently gives some strong guarantees of timely execution :/

 

It is a pity that we can not do something like this: setThreadPriority "REALTIME" :)

 

P.S. Another funny moment: when the game performance falls so much that the scripts stop working, the last thing you think about is: "why is the sleeping script that is supposed to launch the spawn of the super-invasion force, fires 5 seconds later?" XDD

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×