Allowing a link to appear only at certain days and times

I’m using Harlowe in Twine, and I’m writing a story in which the player can only access a particular room on the following days and times:

Wednesday, Saturday, Sunday
9AM - 10AM, 12PM - 1PM, 3PM - 4PM, 6PM - 7PM

The way I’m trying to do it is to allow the link to the room [[Enter Library]] to appear as an option only during those timeframes. Otherwise, the player’s only option is to go back to the main room [[Back to Penthouse]]. But I can’t figure out the right coding to use. It won’t allow me to use multiple days and times. Is this achievable? What I have now looks something like this:

Today is (weekday:), (current-time:).
(if: (weekday:) is "Wednesday")+(if: (weekday:) is "Saturday")+(if: (weekday:) is "Sunday")+(if: (current-time:) is "12:00 PM")[[[Enter Library]]]
[[Back to Penthouse]]

You probably want the or and and operators (see the booleans section of the Harlowe manual). Something like:

(if: (weekday:) is "Wednesday" or (weekday:) is "Saturday" or (weekday:) is "Sunday")[
    [[Enter Library]]
]

Times would be trickier, since there are probably 60 different time strings for each hour that the library is open. There are ways to handle that, but I’m not sure of the best way to write it in Harlowe off the top of my head.

Can I ask what you’re doing? Is this an ARG, or some sort of analogue to a real-world escape room, or a game where you play a little bit every day? In traditional interactive fiction I feel like players would just quit and never come back when you tell them they have to play at particular real-world times on particular real-world days…

The game has three levels in which the player meets different people in different rooms. The day and time element I’m trying to do only comes into play during the third and final level of the game, which features the Penthouse and Library.

The game has multiple endings, and the Library endings are only possible when the Library is open. Figuring out a way to limit access to the Library during certain time periods is what I’m having trouble with.

Another method that can be used to determine if a specific value is one of a limited list of potential values is to place those values within a temporary Array, and then check if the specific value is contained within it.

(if: (a: "Wednesday", "Saturday", "Sunday") contains (weekday:))[Current "weekday" is in List]
1 Like

The (weekday:) and (current-time:) macros use the current “Real-world” time of your Operating System to obtain the values they return. Which means those macros aren’t a good fit for a “Game-world” time system, unless you want the Reader of your Story to have to wait until it is really “Wednesday”, “Saturday”, or “Sunday” before that conditional expression is true.

When designing a “Game-world” time system you need to consider a number of things:

  1. Is it important that the “Current Day” behaves like the Gregorian Calendar, or is simply tracking the number of Days since the Story start enough?
    eg. Do you really need: Date within a Month; Months that have different number of days; etc
  2. What level of “Current Time” precision do you really need?
    eg. Do you really need to track time to the minute, or would a larger unit like either “15 minute” or “1 hour” be enough

I you do need a real-world like Calendar and/or a high level of precision, then you may want to consider using a data-type like a JavaScript Date object. However if don’t need either/both of those things then you could simply use two Integer variables, one to track the current “unit” of the Day, and the other to track a Day count.

I want it to use the real-world day and time of the player. There are certain in-game occurrences that only happen on certain days and times, so the player will have to coordinate their play time to acquire these things. This is only the case for particular parts of the game.

I think I figured out a solution. Instead of trying to do hour-long intervals, I just reduced it down to the exact minute. I tried the coding at a couple different times of day to make sure it works.