---
# System prepended metadata

title: 故事系統－腳本設計

---

# 故事系統－腳本設計

<!-- 頁首通用模組 -->
{%hackmd xcsnQTMQQ0SZQ9QF7YUp_g %}

---

[TOC]

---

> FUUUUUUUUUUUUUUUUUUUUUUUUUUUCK!
> FUUUUUUUUUUUUUUUUUUUUUUUUUCK!
> FUUUUUUUUUUUUUUUUUUUUUUUCK!
> FUUUUUUUUUUUUUUUUUUUUUCK!
> FUUUUUUUUUUUUUUUUUUUCK!
> FUUUUUUUUUUUUUUUUUCK!
> FUUUUUUUUUUUUUUUCK!
> FUUUUUUUUUUUUUCK!
> FUUUUUUUUUUUCK!
> FUUUUUUUUUCK!
> FUUUUUUUCK!
> FUUUUUCK!
> FUUUCK!
> FUCK!
> [name=Mibudin]

---


## Document Usage Guide

### Design Concepts
:::info
- Imperative commands based.
- Do not make type recursive circles.
:::

### Files
:::info
- `.m5ss`: **m**y**5**tone **S**tory **S**cript.
:::

### Signs
:::info
#### Suggestion
- {*DEP*}: Deprecated.

#### Alias
- {*~*}: Alias name (equivalent).

#### Objects
- {*ABS*}: Abstract class.
- {*ONLY*}: Included only one.

#### Using
- {*R*}: Required.
- {*O*}: Optional.

#### Content Type
- {*EMPTY*}: Empty-element Tag (with no content).

:::



## Objects Relation Guide
### Models
- C# namespace: `my5tone.Story.Model`

#### Including Relation
- `SceneModel`
    - `StageModel`
        - `EntityModel` s
    - `GuiModel`
        - `WindowModel` s

#### Inheritance Chain
- `BaseModel`
    - `SceneModel`
    - `StageModel`
    - `EntityModel`
        - `BackgroundModel`
        - `TachieModel`
    - `GuiModel`
    - `WindowModel`
        - `DialogueModel`
        - `BranchButtonModel`

#### UI Corresponding Relation
- (`Canvas`) `SceneModel`
    - (`Canvas`) `StageModel`
        - `EntityModel` s
    - `GuiModel`
        - `WindowModel` s

### Controller
- C# namespace: `my5tone.Story.Controller`

#### Inheritance Chain
- `BaseController`
    - `ProgramController`
    - `OuterController`
    - `SceneController`
    - `StageController`
    - `EntityController`
        - `BackgroundController`
        - `TachieController`
    - `GuiController`
    - `WindowController`
        - `DialogueController`
        - `BranchButtonController`

### Parser
- C# namespace: `my5tone.Story.Parser`




## Sign Meaning
> NOT serious
- `^`: Preprocess
- `!`: Include
- `*`: Macro
- `#`: Comment
- `?`: Elementary arithmetic
- `$`: Register
- `%`: GUID
- `@`: Label
- `{...}`: Special scope
- `"..."`: String



## Statements

### Includes
- `^ !<scriptPath>`


### Macros
- `*<macroId> [<parameter> ...]`
- `^ *<macroId> <macroContent>`
- ```
    ^ *{<macroId> [<parameter> ...]
    <macroContent>
    <macroContent>
    }*
    ```


### Comments
- `#<comment>`
- ```
    #{<comment>
    <comment>
    <comment>}#
    ```


### Strings
- `"<stringContent>"`


### Elementary Arithmetic
- `?{<expression>}`
    - `+` `-` `*` `/` `%` `(` `)` `==` `!=` `&&` `||` `<` `<=` `>` `>=` ` ` combines `<register>/<number>`s.
- `?~`


### Numbers
- `<literalNumber>/<exExp>`


### Register
- `$<registerIndex>`


### GUID
- `%<guidName>`
- `%~`
    - `Guid.Empty`
- `^ %<guidName>`


### Labels
- `@<labelName>`
    - NOT inline.


### Commands
- `<command>`
- ```
    <command>
    <command>
    <command>
    ```



## Basic Commands

### Program Controls
- `prg goto <label> [-if <register>/<number>]`
- `prg call <functionName> [<parameter> ...]`

### Outer
- `otr log <string> [-w]/[-e]`



## Story Commands

### Scene
- `scn enter`
- `scn leave`
- `scn display [-n]`
- `scn pause [-t <number>]`


### Stage
- `stg display [-n]`
- `stg inject <entityModelId>/%~`


### Entity
- `ent bind <entityModelId>`
- `ent unbind`
- `ent display <entityModelId>/%~ [-n]`
- `ent locate <entityModelId>/%~ <xNumber>/?~ <yNumber>/?~ [-r]`
- `ent scale <entityModelId>/%~ <xNumber>/?~ <yNumber>/?~`
- `ent load <entityModelId>/%~ <entityModelPath> [-c [-s]] [-b]`
- `ent unload <entityModelId>/%~ [-c [-s]]`
- `ent cache <entityModelId>/%~ [-s]`
- `ent uncache <entityModelId>/%~`


### GUI
- `gui display [-n]`
- `gui inject <windowModelId>/%~`


### Window
- `win bind <windowModelId>`
- `win unbind`
- `win display <windowModelId>/%~ [-n]`
- `win load <windowModelId>/%~ <windowModelPath> [-c [-s]] [-b]`
- `win unload <windowModelId>/%~ [-c [-s]]`
- `win inject ?????????????????`
- `win cache <windowModelId>/%~ [-s]`
- `win uncache <windowModelId>/%~`
