### start() Source: https://videlais.github.io/snowman/2/window_story/functions/start Begins playing the story. This function is part of the window.story global JavaScript variable. ```APIDOC ## start() ### Description Begins playing the story. ### Method JavaScript Function Call ### Parameters (None.) ### Return Type (None.) ``` -------------------------------- ### Listen for Story Start Event Source: https://videlais.github.io/snowman/2/events/story_events Use this snippet to execute code when the story has finished loading and is about to display the first passage. It logs the story object to the console. ```javascript $(window).on('sm.story.started', function(event, eventObject) { // window.story console.log(eventObject.story); }); ``` -------------------------------- ### Snowman 2.X HTML Structure Example Source: https://videlais.github.io/snowman/2/htmlandcss/elements This HTML structure demonstrates the basic layout used by Snowman 2.X, including story data, passage elements, and script inclusion. ```html Test File

Double-click this passage to edit it.

``` -------------------------------- ### Get Visit Count for Single Passage Name Source: https://videlais.github.io/snowman/2/utility/visited Use this to get the number of times a specific passage, identified by its name, has been visited. Ensure the name is a string. ```javascript // Returns number of visits visited("Start"); ``` -------------------------------- ### Get Visit Count for Single Passage ID Source: https://videlais.github.io/snowman/2/utility/visited Use this to get the number of times a specific passage, identified by its ID, has been visited. Ensure the ID is a number. ```javascript // Returns number of visits visited(1); ``` -------------------------------- ### Log Passage Names on Events Source: https://videlais.github.io/snowman/2/events/passage_events Use the `on()` function to listen for passage events and log the name of the passage to the console. The `eventObject.passage.name` property provides the name of the passage involved in the event. Note that `sm.passage.hidden` may not have a passage if the story is starting. ```javascript $(window).on('sm.passage.hidden', function(event, eventObject) { // No passage to hide when story starts if(eventObject.passage) { console.log(eventObject.passage.name); } }); $(window).on('sm.passage.showing', function(event, eventObject) { // Current Passage object console.log(eventObject.passage.name); }); $(window).on('sm.passage.shown', function(event, eventObject) { // Shown Passage object console.log(eventObject.passage.name); }); ``` -------------------------------- ### Get Smallest Visit Count for Multiple Passage Names Source: https://videlais.github.io/snowman/2/utility/visited When multiple passage names are provided, this function returns the smallest visit count among them. This is useful for checking if any of a set of passages has been visited a certain number of times. ```javascript // Returns smallest number of visits visited("Start", "Another"); ``` -------------------------------- ### Get Smallest Visit Count for Multiple Passage IDs Source: https://videlais.github.io/snowman/2/utility/visited When multiple passage IDs are provided, this function returns the smallest visit count among them. This is useful for checking if any of a set of passages has been visited a certain number of times. ```javascript // Returns smallest number of visits visited(1,2); ``` -------------------------------- ### getStyles() Source: https://videlais.github.io/snowman/2/utility/getStyles The global function `window.getStyles()` accepts one or more URLs of remote CSS stylesheets and attempts to load them. The function returns a Promise. If loading is successful, all remote CSS rules are applied as new `