Moved .twee to src directory

- Created new intermediate language specification for drafting interactive fiction
This commit is contained in:
Tony Bark 2025-02-21 13:36:27 -05:00
parent e7f43bf49e
commit 2763854a8b
3 changed files with 116 additions and 0 deletions

85
draft/README.md Normal file
View file

@ -0,0 +1,85 @@
# Interactive Story Draft (ISD) Specification
- **File Format:** `.isd`
The Interactive Story Draft (ISD) format is a intermediate language designed for drafting interactive fiction before implementation in Twines Harlowe or similar engines. It allows authors to structure branching narratives, define conditions, and track variables efficiently.
---
### Specifications
1. **Passages:**
- **Syntax:** `:: PassageName`
- **Description:** Defines a new passage or section in the story.
2. **Links:**
- **Syntax:** `[[Link Text -> TargetPassage]]`
- **Description:** Creates a navigational link to another passage.
3. **Variables:**
- **Syntax:** `$variableName`
- **Description:** Represents a variable to track states or information.
4. **Variable Assignment:**
- **Syntax:** `(set: $variableName to value)`
- **Description:** Assigns a value to a variable.
5. **Conditional Statements:**
- **Syntax:** `(if: condition)[Text if true]`
- **Description:** Displays text or content based on a condition.
6. **Else Clause:**
- **Syntax:** `(else:)[Text if false]`
- **Description:** Follows an `(if:)` statement to handle the false condition.
7. **Random Number Generation:**
- **Syntax:** `(set: $variableName to (random: min, max))`
- **Description:** Sets a variable to a random number between `min` and `max`.
8. **Text Styling:**
- **Syntax:** `''italic''`, `'''bold'''`, `^^superscript^^`, `~~subscript~~`
- **Description:** Applies basic text formatting.
### Usage
```
:: Introduction
Welcome to your adventure! You find yourself at a crossroads.
[[Take the left path -> LeftPath]]
[[Take the right path -> RightPath]]
:: LeftPath
You walk down the left path and encounter a mysterious stranger.
(set: $hasKey to true)
The stranger gives you a key.
[[Continue -> Crossroads]]
:: RightPath
You walk down the right path and find a locked door.
(if: $hasKey)[
You use the key to unlock the door and discover a treasure!
]
(else:)[
The door is locked. You need a key to open it.
]
[[Return to the crossroads -> Crossroads]]
:: Crossroads
You're back at the crossroads.
[[Take the left path -> LeftPath]]
[[Take the right path -> RightPath]]
```

31
draft/sample.isd Normal file
View file

@ -0,0 +1,31 @@
:: Introduction
Welcome to your adventure! You find yourself at a crossroads.
[[Take the left path -> LeftPath]]
[[Take the right path -> RightPath]]
:: LeftPath
You walk down the left path and encounter a mysterious stranger.
(set: $hasKey to true)
The stranger gives you a key.
[[Continue -> Crossroads]]
:: RightPath
You walk down the right path and find a locked door.
(if: $hasKey)[
You use the key to unlock the door and discover a treasure!
]
(else:)[
The door is locked. You need a key to open it.
]
[[Return to the crossroads -> Crossroads]]
:: Crossroads
You're back at the crossroads.
[[Take the left path -> LeftPath]]
[[Take the right path -> RightPath]]