# Make schedules for characters?

Twine Version: 2.5.1.0

I’m trying to make a free roaming game when characters follow their own schedule. Their routines are mostly fixed but in some hours they go to random room and may interact with each other.

Here’s an overly simplified 3-hour sunday schedule for 2 characters:
CharA:
12:00-13:00 In the living room
13:01-14:00 either in living room or bedroom.
14:01-15:00 outside
CharB:
12:00-13:00 outside
13:01-14:00 either in living room or bedroom.
14:01-15:00 In the living room

In this scenario there’s a chance to find both of them in a single room.

What I’m currently doing is check every room for their schedule. Below is an example code for the Living Room passage (except the \$charArand and \$charBrand which is set when the day change but I’m placing it here for context).

``````<<set \$charArand to random(1, 2)>>\
<<set \$charBrand to random(1, 2)>>\
<!--1 is living room and 2 is bedroom-->\
\
<<if GameDays[\$gameDate.getDay()] === "Sunday">>  <!-- Check if it's Sunday -->\
<<if \$gameDate.getHours() === 12 && \$gameDate.getMinutes() <= 59>>  <!-- Check if it's between 12:00 and 12:59 -->\
<<set _charA = 1>>  <!-- Set _charA to 1 -->\
<<elseif \$gameDate.getHours() === 13 && \$gameDate.getMinutes() <= 59>>  <!-- Check if it's between 13:00 and 13:59 -->\
<<if \$charArand === 1>>  <!-- Check if \$charArand is 1 -->\
<<set _charA = 1>>  <!-- Set _charA to 1 -->\
<</if>>\
<<if \$charBrand === 1>>  <!-- Check if \$charBrand is 1 -->\
<<set _charB = 1>>  <!-- Set _charB to 1 -->\
<</if>>\
<<elseif \$gameDate.getHours() === 14 && \$gameDate.getMinutes() <= 59>>  <!-- Check if it's between 14:00 and 14:59 -->\
<<set _charB = 1>>  <!-- Set _charB to 1 -->\
<</if>>\
<<elseif GameDays[\$gameDate.getDay()] === "Saturday">>  <!-- Check if it's Saturday -->\
<!--temp1-->\
<<else>>  <!-- If it's not Sunday or Saturday -->\
<!--temp2-->\
<</if>>\
\
<<if _charA === 1 and _charB === 1>>  <!-- Check if _charA and _charB are both 1 -->\
CharA and CharB is here.
<<elseif _charA === 1>>  <!-- Check if _charA is 1 -->\
CharA is here.
<<else>>\
CharB is here
<</if>>\
``````

It’s not perfect and it can get really long and messy. I’m wondering if there’s a better way to do this.

I would not use Twine for this. You would be better with a system that has a world model (i.e., tracking items across a series of locations) built in. Like QuestJS, which is also JavaScript based, though there are plenty of others out there.

Probably not the answer you were looking for…

It’s alright and I expected as much. I prefer to work with twine for now because it’s very easy to learn but I’ll check out QuestJS.