[Snowman] Getting passage name during showpassage

According to the wiki:

showpassage: occurs before the passage is rendered. The passage about to be shown is the ‘passage’ parameter to the event.

If I write a function that logs passage.name during showpassage, the result is the name of the previous passage (or NaN if it’s the first). Apparently passage.name hasn’t been given a value at this moment.

But for me showpassage:after is too late, because I need to use the current passage name before the passage has been displayed. (My function adds all passage names to a history, then I use that history as a condition for changing the text according to what the player has seen during the whole game.)

Is there any way of getting the name of the passage about to be displayed during showpassage?


The event you want is ‘hidepassage’ if you want to log the previous passage. ‘showpassage’ will not get you that information, as noted on the wiki. It will only have the passage that is about to be shown.

For both your question, and future audiences, I’ve written up a demo to catch all Snowman 1.3 passage events and some information about their order.


 Snowman 1.3:
  In order, the passage events are:
		('startstory' on story start)

 The passage (passage.passage) object of each event is:
 		the passage being hidden,
		the passage about to be shown, and
		the passage being shown.
	The only difference is that 'hidepassage' will have have
	 an Element when tested immediately after the 'startstory' event.


$(window).on('hidepassage', function(event, passage) {
	// HTML Element on Start
	// Passage object otherwise
	if( !(passage.passage instanceof Element) ) {

$(window).on('showpassage', function(event, passage) {
	// Current Passage object

$(window).on('showpassage:after', function(event, passage) {
	// Shown Passage object

I also want to note that this event naming mentioned here is the standard for Snowman 1.3. It has changed for Snowman 1.4 (due out in September 2019) and Snowman 2.0 (due out in September 2019).

Did you mean to list them both coming out the same month? Or was v2.0 supposed to be 2020 or something?

Nope. 2.0 has been done for a little over a week and I only need to make one more change before I officially move to 1.4.

One of the version requirements for the main three story formats in Twine 2.X is that each major semantic branch is maintained. Like for Harlowe and SugarCube, there will be also multiple versions of Snowman in starting in September.

Thanks @videlais! It’s all working now using your input (the parameters (event,passage) and using passage.passage.name). My explanation wasn’t exactly right, but all this pointed me in the right direction.

Also, excited about the new Snowman in September!