Forked is a prototype system for scripting interactive narratives in DragonRuby.
Forked uses a simplified markup similar to markdown. It is intended to be simple to use, easy to learn for people without programming experience and to make it easier to focus on writing.
Additional functionality can be added by writing commands in Ruby.
What it lets you do:
- Write stories in a readable format with minimal distraction
- Player navigates to different parts of your story with button clicks
- Issue commands from within your story
- Premade commands available for non-programmers
- Custom commands are simple to create using Ruby
- Conditions allow allow you to control what the player sees
- Show or hide text based on conditions
- Show or hide buttons based on conditions
- Buttons can link to other parts of the story or run code
Download or clone the project and run it in DragonRuby.
The default project is the user manual. Click here to see how it's built!
# Title
## Heading Name {#chunk_id}`
Target a chunk by Chunk ID
[Trigger text](#target_id)
Target the following chunk in the story file:
[Trigger text](#)
Display an inactive trigger:
[Trigger text]()
> This text is displayed as a blockquote.
~~~
# This text is displayed as code, in a monospace font with lines wrapped for length but otherwise without any changes.
~~~
---
::
action
::
[Trigger text](:
action
:)
<:
condition
:>
<:
condition
::
This text is displayed if the condition is true.
:>
// this line is a comment
> This text is inside a blockquote
> This text is inside the same blockquote
~~~
This text looks like code
~~~
@@ any formatting in this line is ignored
Add a backslash \
at the end of a line to display the following line in the file to display as a new line in Forked (instead of continuing the same line).
This is the first line\
This is the second line
Bag: Inventory Management | (experimental) |
---|---|
bag_add item |
adds an item to the player's inventory |
bag_remove item |
removes an item from the player's inventory |
bag_has? item |
true if the item is in the player's inventory or false if not |
bag_clear |
clear all items from the inventory |
Memo: Storing Information | (experimental) |
---|---|
memo_add "memo name", "memo value" |
Creates a new memo using the supplied name and storing the supplied value |
memo_remove "memo name" |
Deletes the named memo |
memo_clear |
Deletes all memos |
memo_check "memo name" |
Returns the value of the named memo |
Wallet: Financial Management | (experimental) |
---|---|
wallet |
Returns the amount of coins, dollars, schekels, etc. in the player's wallet |
wallet_plus 10 |
Adds 10 to the player's wallet |
wallet_minus 5 |
Removes 5 from the player's wallet |
wallet_clear |
Discards all the player's money |
Timer: Time Management | (experimental) |
---|---|
timer_add "timer name", 10.seconds |
Creates a new timer with the provided name and the provided duration. The duration can be given in ticks (1/60 seconds) or in seconds as shown here. |
timer_remove "timer name" |
Deletes the timer with the provided name |
timer_check "timer name" |
Returns the time remaining for the named timer (will keep counting down after reaching zero) |
timer_seconds "timer name" |
Returns the time remaining for the named timer in seconds (will stop counting down at zero) |
timer_done? "timer name" |
Returns true if the timer is complete |
Counter: Number Tracking | (experimental) |
---|---|
counter_add "counter name", 5 |
Creates a new counter with the provided name and the (optional) provided duration |
counter_remove "counter name" |
Deletes the named counter |
counter_up "counter name", 1 |
Increases the value of the named counter by the provided value (or by 1 if no value is provided) |
counter_down "counter name", 1 |
Decreases the value of the named counter by the provided value (or by 1 if no value is provided) |
counter_check "counter name" |
Returns the value of the named counter |
counter_clear |
Deletes all stored counters |
Background Image | (experimental) |
---|---|
background_image "sprites/bg_image.png" |
Sets the story background to the provided image. It is recommended to put images in mygame/sprites . This action should only be used with conditional blocks (see manual). |
Roll Dice | (experimental) |
---|---|
roll "2d6" |
Returns the result of a dice roll with two, six sided dice. Any other numbers may be substituted. The first number represents the number of dice. The second number represents the number of sides for all rolled dice. |
Headings | (experimental) |
---|---|
heading |
Gets the text of the current heading |
heading_set |
Sets the text of the current heading |
Navigation | (experimental) |
---|---|
jump "#chunk_id" |
navigates to the chunk specified by #chunk_id |
jump 3 |
navigates chunks in the story file relative to the current chunk (e.g. 3 chunks below the current chunk) |
fall |
navigates to the next chunk in the story file |
jump |
navigates to the previous chunk in the story file |
history[-1] |
Gets the chunk_id for the current chunk |
history[-2] |
Gets the chunk_id for the last visited chunk |
Author mode provides some features that may be useful while writing your story. Note that the shortcut keys may change in the future.
Shortcuts | Action |
---|---|
Hold f and press u |
Toggle Author Mode on or off. When author mode is active, a red square appears in the bottom left corner of the screen. The following shortcuts become available when Author Mode is on. |
q |
Display information sidebar. This displays the current chunk ID and the text of the current chunk heading. |
n |
Navigate to the following chunk in the story file until the last chunk is displayed. |
h |
Navigate to the preceding chunk in the story file until the first chunk is displayed. |