0 votes
by (180 points)

I apologize in advance if this question is unclear as I've been wrestling with it for quite a while and am still struggling to put my thoughts into words.

I'm trying to set up a passage to act as hub of sorts for other events. So far I have it set up to use widgets for the events. For example, if a bunch of events are happening in a prison cell:

/*If I have a passage named "Prison Cell" as the hub*/

Blah blah blah filler text for describing the cell.

<<Cell_Actions>>

 

Then in my "widget" tagged passage I'd set up the events. Such as:

/* In my widget tagged "Prison Events" passage */

<<nobr>>

<<widget "Cell_Actions">>
	You're all alone now.
	<br> <br>
	What should you do?
	<br> <br>
	<span id="choice">
	
		<<link "Explore the Cell">>
			<<replace "#choice">>
				<<Cell_Explore>>
			<</replace>>
		<</link>>
		
		<br>
		
		<<link "Sleep">>
			<<replace "#choice">>
				<<Cell_Sleep>>
			<</replace>>
		<</link>>
		
		<br>
		
		<<if $time < 5>>
			<<link "Wait">>
				<<replace "#choice">>
					<<Cell_Wait>>
				<</replace>>
			<</link>>
		<</if>>
		
	</span>
<</widget>>

<<nobr>>

With Cell_Explore, Cell_Sleep, and Cell_Wait being the name of widgets I'd create as subevents. So far, this works out. What I'd like to do, though, is run new events based on time. I set up a time system similar to what greyelf recommended in this topic: http://www.twinery.org/questions/11850/how-to-create-a-time-system?show=11850#q11850.

The only modifications I made were using "Day 1", "Day 2" etc. as the name of the days of the week and using $time to refer to the time periods. So my time system setup looks like this:

<<set setup.DAYS to ["Day 0", "Day 1", "Day 2", "Day 3", "Day 4", "Day 5", "Day 6", "Day 7"]>>
<<set setup.TIME to ["Asleep", "Morning", "Noon", "Afternoon", "Evening", "Night"]>>
<<set $day to 1>>
<<set $time to 1>>

What I'd like to do is make it so that at certain times, for example Noon, Day 2, a special event will happen the first time the player visits Prison Cell passage. So, something like:

/* This would go in the "Prison Cell" passage */

<<if $day is 2 and $time is 2>>
    <<Cell_GuardEncounter1>>
<</if>> 



/* And this would be the event widget */

<<widget "Cell_GuardEncounter1">>
    And the text of the event would go here.
<</widget>>

So I have a bunch of pieces but I'm not sure how to put it all together.

To recap, what I'd like for this specific situation is to set it up so that normally, visiting the "Prison Cell" passage plays the Cell_Actions event, but when the player first visits the "Prison Cell" passage at Noon on Day 2, they'll see the Cell_GuardEncounter1 event. Subsequent visits to the "Prison Cell" at Noon, Day 2 would then return to the default Cell_Actions event.

The potential solutions I've thought of have involved either doing a separate passage for each individual event or separate variables for toggling whether each individual event has been seen, both of which would make things get pretty cluttered and difficult to keep track of.

Again, sorry if my explanation of the problem is unclear. I'm more than happy to provide any additional information needed.

1 Answer

0 votes
by (980 points)
Maybe try this

<<if $day = 2 and $time = 2 and $visitTime ndef >>

<<set $visitTime = 1>>

<<Cell_GuardEncounter1>>

<</if>>
...