# Writing scenarios

## 1. Concepts

.lim was made to remove, through the rules of the format itself, the places where writing a scenario tends to go wrong. Instead of finding mistakes afterwards, it makes them hard to make.

| Where writing tends to go wrong | How .lim handles it |
|---|---|
| Implicit rules (a forgotten click wait, a speaker carried over from an earlier line) | One line is one click. A dialogue line carries its own speaker |
| Symbol collisions (symbols written in the text are read as commands) | The only special characters in text are `{` `}` `\` |
| Mistyped values that only show up when you run the game | There are types such as durations, numbers, booleans and colors, and the syntax check checks them |
| Errors that don't tell you where or what went wrong | Problems are reported before running, with the line and a suggested fix |
| Gaps filled with free-form scripts, so every game is written differently | `@html` without JS for display. Logic goes in plugin commands. `@script` is a place to keep imported JS until it's rewritten, and it doesn't run |

Two more things are assumed.

- **You write together with AI.** Whether a person or an AI writes it, the result has the same form, a machine can check it, and mistakes show up right away with their position.
- **Existing TyranoScript games can be imported.** Import .ks with `lim import` and run it as is (chapter 11).

### Seven principles

| Principle | What it means |
|---|---|
| How parameters are written | Unnamed parameters can't be written with a name. A named boolean can be written as just its name instead of writing `true` |
| Each line stands on its own | A dialogue line carries its own speaker and doesn't depend on the state of the line before it. Whichever line you take out and edit, the speaker assignment and line structure don't break |
| Text appears as written | The only special characters in text are `{` `}` `\`. `{` always starts some syntax, and if it doesn't match any, it's an error (it isn't silently shown as a character) |
| Command specs live in one place | The syntax check, completion, reference and runtime read the same definitions, so the reference and the actual behavior don't drift apart |
| Mistakes are caught before running, with the position and a fix | Diagnostics have the line, column, identifier and a suggested fix (hint) (chapter 9) |
| Results of running can be inspected by machine | Running without a browser gives the results as JSON, and screenshots of a given line can be taken (`lim trace`, `lim shot`) |
| Randomness and time can be fixed | The same input gives the same result |
