Hi there. In this post I want to collect a few pearls I have seen over time in the forum, some generic algorithms and tools that people may use in a variety of situations. (Note this is a Wiki and not all edits are mine).
The table below (by @cup_half_empty) has links you can follow to find code examples and information on usage. You will find some common algorithms (sorting, shuffling) and some interesting ChoiceScript extensions, useful to develop and debug your game.
Feel free to contribute to this thread with other examples. Have fun!
General algorithms in Choicescript
Name | Description | Credits |
---|---|---|
Insertion Sorting | Sorting algorithm. It can be used to sort arrays, find the max/min of several values and more. | @stainedofmind |
Array Shuffle | Creates a random shuffle of a sequence of values. It can be used to make your game different every time. | @Lan |
Library for strings and arrays | String manipulation and list simulation. Functions: substring, indexOf, contains, replaceFirst, replaceAll | @Twiger_Fluff |
Plugins, Hacks & Mods (using Javascript)
These extensions modify the Choicescript engine and/or use *script. As such, they may not be fully supported.
Name | Description | Credits |
---|---|---|
Game Transcription | A modified version of the ChoiceScript engine that will output a transcript of the game, based on the player’s choices. | @Sargent |
Game Statistics | A modified version of the ChoiceScript engine that will output statistics of the game. | @Sargent |
Multi-player library | Implement multiplayer in ChoiceScript, by sending requests to a 3rd-party server. | @Twiger_Fluff |
Debugging tool | Debugging plugin which offers choice recording and playback . | @Twiger_Fluff |
Text tool | Present fancy text by using custom images from an external server | @Flurrywinde11 |
Development environments
Name | Description | Credits |
---|---|---|
CSIDE | ChoiceScript development environment. Edit and run your game in a very flexible environment | @CJW |
Visual Studio extension | Develop your game in Visual Studio | @Sargent |
Other useful code snippets
Name | Description | Credits |
---|---|---|
Gender and Pronoun Sample Code | Sample code for setting variable MC and NPC pronouns | @HannahPS |
Inventory | Code to present items from an inventory | CS Wiki |
General rouding | Rounds a number to a given precision. Uses the elusive ‘power’ operator. | @annwu23 |