StoryScript Reference

Use this reference to quickly find the create commands, code snippets and concepts available in StoryScript.

Create a new game and switching between games

To create a new game, run this command in your IDE's terminal:

npx storyscript game YourGameName

To switch between games, open the currentGameName.js file in your project folder and change the currentGameName constant to the name of the game you want to work on.

Create commands

These commands create new entities for your games. Run them in the terminal of your IDE. They will be added to the mentioned folder in your game's directory. You can get an idea on how to work with the entities in the tutorial shown.

Create Command Folder Tutorial
Location
npx storyscript location LocationName
locations tutorial 2, tutorial 8
Feature (standalone)
npx storyscript feature FeatureName
features tutorial 4
Map
npx storyscript map MapName
maps tutorial 3
Item
npx storyscript item ItemName
items tutorial 4, tutorial 9
Key
npx storyscript key KeyName
items tutorial 10
Enemy
npx storyscript enemy EnemyName
enemies tutorial 10
Person
npx storyscript person PersonName
persons tutorial 11
Quest
npx storyscript quest QuestName
quests tutorial 11
Action (standalone)
npx storyscript action ActionName
actions tutorial 8

Code snippets

StoryScript comes with VS Code code snippets that are set up when you create your first game. You can use these to automatically add StoryScript code parts, like a new destination. Rider code snippets are available as well, but you need to install these yourself. You can find the snippets (called Live Templates in Rider) in the LiveTemplates folder of your repository, and instructions on how to install them in the 'import live templates' section here.

These snippets are available to create additional properties for your entities quickly. Run them inside of the file type specified using your IDE's autocomplete functionality.

Context File type Snippet Purpose
Locations .ts ssdestination Adds a new destination to the location's destinations array
Locations .ts ssbarriers Adds a new barriers array to a location's destination with one barrier
Locations .ts ssbarrier Adds a new barrier to a location's destination's barriers array
Locations .ts ssfeature-inline Adds a new inline feature to a location's features array
Maps .ts ssmaplocation Adds a new map location to a map's locations array
Combinations .ts sscombinationaction Adds a combination action to your game's getCombinationActions method of your setup rules
Combinations .ts sscombination Adds combinations to a feature (remember that items, enemies etc. are also features!)
Combinations .ts sscombine Adds a new combine option to a feature's combinations array
Conversations .ts ssconversationaction Adds a new conversation action to a person's conversation
(Multiple) .ts ssaction Adds a new StoryScript action
(Multiple) .ts ssfunction Adds a new StoryScript function
Character creation .ts ssattributes Adds a new StoryScript attributes step
Character creation .ts ssattribute Adds a new attribute list
Character creation .ts ssattributeentry Adds a new attribute entry
Character creation .ts ssquestions Adds a new questions step
Character creation .ts ssquestion Adds a new question
Character creation .ts ssquestionentry Adds a new question entry
Locations, Persons .ts sstrade Adds a new trade option to a location or a person
Persons .html ssconversation Adds a new conversation
Persons .html ssnode Adds a new conversation node
Persons .html ssreply Adds a new conversation reply
Locations, Items, Enemies, Persons .html ssdescription Adds a new description
Locations .html ssfeature Adds a new text feature
Locations .html ssvisualfeatures Adds a new visual features collection
Locations .html ssarea Adds a new visual feature
Locations .html sstrigger Adds a new trigger
Any description or conversation node .html ssaudio Add a new audio element