Time Lapse Question

I am trying to get things to happen one time between certain intervals.

For example, in my game some actions take longer than others. A player driving between two cities may have a time lapse of 1 hour, whereas normal actions may have 1 minute or 10 minute durations. The problem I’m finding is how to get things to happen once when a turn does not land exactly on a specific time.


At 12:00 PM:
say “The sun climbs high overhead.”

This works fine if the move is right at noon, but if the person’s first turn is at 11:30 AM and second is at 12:30 PM, I7 seems to not display this because nothing occurred right at 12:00 PM.

A similar problem occurs with numbers. The game has a number called a “dayfigure,” which increments by 1 at midnight each day. However, this only works if the move is made exactly at 12:00, and not if it is a move that skips this time.

Anyone know how to resolve this? Thanks in advance.

Timed events only fire at most 30 minutes after the scheduled time. You have to tinker with the I6 code to change that.

[code]Delay is a number that varies. The delay is 30.

Include (-
[ TIMED_EVENTS_R i event_timer fire rule;
for (i=1: i<=(TimedEventsTable–>0): i++)
if ((rule=TimedEventsTable–>i) ~= 0) {
event_timer = TimedEventTimesTable–>i; fire = false;
if (event_timer<0) {
if (TimedEventTimesTable–>i == 0) fire = true;
} else {
if ((the_time >= event_timer) && (the_time < event_timer+ (+ delay +) )) fire = true;
if (fire) {
TimedEventsTable–>i = 0;
} }
rfalse; ];
-) instead of “Timed Events Rule” in “OrderOfPlay.i6t”.[/code]This lets you set the delay at some suitable time:

When play begins: now the delay is 60. [or] Before waiting in the House of Horrors for three turns: now the delay is 45. Before reading a command: now the delay is 30. [etc.]

(Another way might be not to advance the time of day in leaps after a certain action, but advancing it in long stretches a minute at a time by manually following the turn sequence rules the proper number of times as in examples 374 and 375 in the manual.)

Thanks! I didn’t know that. It certainly explains a lot of the problems I’ve been having.

I think I might have found a simple solution to this problem. Please tell me if you think there would be any fallout from doing it this way: in addition to advancing the “time of day,” I also advance the “turn count,” something like this:

Instead of going to X from Y:
	say "You enter X.";
	  increase the time of day by 90 minutes;
	  increase the turn count by 90;
	  continue the action.

So far, it seems to work. I stress “so far.”

What happens if you undo immediately afterwards?

I can’t seem to make that work. :frowning:
What about this?

[code]Instead of waiting:
fast-forward 90 minutes;
continue the action.

To fast-forward (N - number) minutes:
repeat with counter running from 1 to N:
follow the turn sequence rules.[/code]

The following is probably a preferable version of the fast-forward phrase, since, in the end, it keeps the turn count in line with the number of player’s commands:

To fast-forward (N - number) minutes: repeat with counter running from 1 to N: follow the turn sequence rules; decrease the turn count by N.

Maybe the code failed for you because I use a work duration rule, as follows:

Work duration is a number that varies. 

Every turn: 
	now work duration is 0; 
	increment the turn count; 
	follow the time allotment rules; 
	if work duration is 0, rule succeeds; 
	increase the time of day by (work duration minutes - 1 minute). 

I’m not sure, but I haven’t had any further problems, which is nice because parts of my IF include traveling between states, which almost always is more than 30 minutes.

I’m not sure if the fast forward rule would work in my case since it seems to require the command to be waiting, rather than any number of actions, but I guess that could always be modified.