0 votes
by (950 points)

I found this threat in which a passage talks about the ability to tag certain passages and cause the time with those tag to flow differently. This was the original post though: https://twinery.org/questions/3368/madexiles-gregorian-time-widgets-might-advance-clock-certain I would have replied there, but it's on a different site.

This was the sample:

predisplay["advanceTimeEveryTurn"] = function () {
	if (tags().contains("notime")) { return; }

	var storyVars = variables();
	storyVars["gameDate"].setUTCMinutes(storyVars["now"].getUTCMinutes() + 15);
};

Now I would love to convert it to make the time go faster with certain tags that way I can let an player character sleep and pass like 8 hours and maybe additionally set up different time flows for showering and bathing.

How would that look like if adapted correctly?

....I am sorry... posting so much questions and again expressing my happiness about your all helpful advices. :)

Mr. Peppermint

1 Answer

+1 vote
by (154k points)
selected by
 
Best answer

One simple technique you could do is modify the advanceTimeEveryTurn predisplay handler to check for the tags you are using to represent the length you want to pass.

eg. Assuming you have a time2h tag that represents 2 hours passing, and time8h representing 8 hours passing.

predisplay["advanceTimeEveryTurn"] = function () {

	if (tags().contains("notime")) { return; }

	var offset = 15;	// default of 15 minutes.

	if (tags().contains("time2h")) {
		offset = 120;	// 2 x 60 minutes.

	} else if (tags().contains("time8h")) {
		offset = 480;	// 8 x 60 minutes.
	}

	var timestamp = variables()["gameDate"];
	timestamp.setUTCMinutes(timestamp.getUTCMinutes() + offset);
};

 

by (950 points)
Thank you, greyelf :)

Do you know also if there would be an addition that could be included to start a countdown beginning at a certain tag and ending it at another tag including an action that would show only if the timer has finished counting?

I suppose you'd first set a tag to a countdown into above coding sample that you posted and then include an <<if>> rule with the tag into a passage, telling it to fire the action when timer that began with the tag has reached 0 ...

I also suppose if you want the countdown to keep counting silently in the background (without showing up somewhere that it counts) even if you change the passage... you'd then need to add the tag to all passages along with that <<if>> rule that are affected... like if you move about the house with the countdown counting in the background and wherever you are inside the house, the action would show only when the countdown reach 0 in any passage you happen to be in.

Would the time8 tag and the countdown tag then be able to be in the same passage to fit them into the bedroom like first sleep then school after X-hours (after finishing sleep) have passed once you woke up?

I am sorry if this sounds confusing and thank you for helping me out ;)

*waves*

Mr. Peppermint
by (154k points)
See my answer in your other question related to this topic.
...