docs update and moved around the test stories
This commit is contained in:
@@ -7,7 +7,7 @@ For help with syntax, see [this documentation](/docs/SYNTAX.md)
|
|||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
This is not really out of development, but to run it, clone the repo, go into /server/ and use cargo run story.zip to run a file called story.zip, relative to your current location.
|
This is not really out of development, but to run it, clone the repo, go into /server/ and use cargo run story.zip to run a file called story.zip, absolute or relative file location.
|
||||||
|
|
||||||
## Technical Details
|
## Technical Details
|
||||||
|
|
||||||
@@ -103,14 +103,11 @@ Move a character with @CHARACTER to fr
|
|||||||
> fr means front-right for instance.
|
> fr means front-right for instance.
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
- Variables
|
|
||||||
- /about.json
|
- /about.json
|
||||||
- If/Else if/Else
|
|
||||||
- PAN
|
|
||||||
- INPUT
|
|
||||||
- tokeniser check for lack of END
|
- tokeniser check for lack of END
|
||||||
- Fix no closing brace edge case
|
- Fix no closing brace edge case
|
||||||
- Support single quotes for strings
|
- Support single quotes for strings
|
||||||
|
- backslashes in strings
|
||||||
- Brace index getter check for closing
|
- Brace index getter check for closing
|
||||||
- Proper Error messages centralised???
|
- Proper Error messages centralised???
|
||||||
|
|
||||||
|
|||||||
Executable
+4
@@ -0,0 +1,4 @@
|
|||||||
|
killall happening-server
|
||||||
|
RUST_LOG=debug
|
||||||
|
happening-server $XDG_DATA_HOME/happening/stories/$1 &
|
||||||
|
cargo run .
|
||||||
+64
-6
@@ -15,22 +15,57 @@ This is done in the about.json file,
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Characters
|
## Characters
|
||||||
|
|
||||||
See [Character documentation](/docs/CHARACTER.md) for more info
|
See [Character documentation](/docs/CHARACTER.md) for more info
|
||||||
Referencing a character using the @, @NARRATOR is reserved for the Narrator.<br/>
|
Referencing a character using the @, @NARRATOR is reserved for the Narrator.<br/>
|
||||||
Customisation is done with @CHARACTER change \<feature\> into \<feature name\><br/>
|
Customisation is done with @CHARACTER change \<feature\> \<feature name\><br/>
|
||||||
Move a character with @CHARACTER to fr
|
Move a character with @CHARACTER to fr
|
||||||
|
Outputting can be done with @CHARACTER says "string", see more at (outputs)[##outputs]
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> fr means front-right for instance.
|
> fr means front-right for instance.
|
||||||
|
|
||||||
|
## Variables
|
||||||
|
Currently only strings and integers are supported as variable types (booleans are planned).<br/>
|
||||||
|
The interpreter can assume the data type so this doesn't need to be specified.<br/>
|
||||||
|
To assign new variables (or overwrite existing ones):
|
||||||
|
```
|
||||||
|
$x = 1
|
||||||
|
$an_integer = 3
|
||||||
|
$y = "hello"
|
||||||
|
$a_string = "world"
|
||||||
|
```
|
||||||
|
> [!NOTE]
|
||||||
|
> Variable names can be as long as you want and can contain any characters except whitespaces
|
||||||
|
|
||||||
|
To modify existing variables:
|
||||||
|
```
|
||||||
|
$x + 1 // Adds 1 to an integer x
|
||||||
|
$x - 1 // Subtracts 1 from an integer x
|
||||||
|
$y + " world" // Appends " world" to the end of a string y
|
||||||
|
```
|
||||||
|
|
||||||
|
Other uses:
|
||||||
|
```
|
||||||
|
$x = choice "choice 1" { // Assigns to x the choice made by the client
|
||||||
|
...
|
||||||
|
$x = input // Assigns to x the string input made by the client
|
||||||
|
```
|
||||||
|
|
||||||
## Outputs
|
## Outputs
|
||||||
|
|
||||||
```
|
```
|
||||||
@CHARACTER says "this string
|
@CHARACTER says "this string
|
||||||
is multi-line
|
is multi-line
|
||||||
and ends with a"
|
and ends with a"
|
||||||
|
|
||||||
|
$x = "hello world"
|
||||||
|
@CHARACTER says $x
|
||||||
|
|
||||||
|
$name = "deadvey"
|
||||||
|
@CHARACTER says "hello $name"
|
||||||
```
|
```
|
||||||
|
> [!NOTE]
|
||||||
|
> Strings only support double quotes now ("") and do not support having quotes within quotes.
|
||||||
|
|
||||||
## Variables
|
## Variables
|
||||||
|
|
||||||
@@ -41,18 +76,20 @@ Variables are referenced with the \$, only integers will be supported.<br/>
|
|||||||
Condition based:
|
Condition based:
|
||||||
|
|
||||||
```
|
```
|
||||||
if (condition) {
|
if condition {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
elif (condition) {
|
elif condition { // Only gets checked if the if and all previous elif statements failed
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else // Always passes if all previous if and elif statements failed
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
> [!NOTE]
|
||||||
|
> See [conditions](##conditions)
|
||||||
|
|
||||||
Choice based:
|
Choice based:
|
||||||
|
|
||||||
@@ -69,15 +106,35 @@ or "choice 3" {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
You can assign a variable to the result of a choice by doing the following:
|
||||||
|
```
|
||||||
|
$x = choice "choice 1" {
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
## Positioning
|
## Positioning
|
||||||
|
|
||||||
```
|
```
|
||||||
@CHARACTER to position
|
@CHARACTER to position
|
||||||
|
|
||||||
PAN to position
|
PAN position
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Conditions
|
||||||
|
A condition works works like this:
|
||||||
|
```
|
||||||
|
$x == "hello" // evaluates true only if x is "hello"
|
||||||
|
$x > 1 // evaulates true if x is an integer and is more than 1
|
||||||
|
$x < 1 // evaluates true if x is an integer and is less than 1
|
||||||
|
$x >= 1 // evaluates true if x is an integer and is more than or equal to 1
|
||||||
|
$x <= 1 // evaluates true if x is an integer and is less than or equal to 1
|
||||||
|
|
||||||
|
```
|
||||||
|
> [!NOTE]
|
||||||
|
> == can be used for integers or strings whereas the rest can only be used with integers
|
||||||
|
|
||||||
|
The order (variable operator value) is currently fixed and so must be layed out like this.
|
||||||
|
|
||||||
## Other
|
## Other
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -89,3 +146,4 @@ GOTO label
|
|||||||
## Ending
|
## Ending
|
||||||
|
|
||||||
`END` to exit out of the story
|
`END` to exit out of the story
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"title": "Once upon a Test",
|
||||||
|
"description": "This story is for testing purposes"
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"tim": {
|
||||||
|
"name": "Timothy Sharpshooter",
|
||||||
|
"gender": "Male",
|
||||||
|
"skin_color": [0,0,0],
|
||||||
|
"eye_color": [0,0,0],
|
||||||
|
"hair_color": [0,0,0],
|
||||||
|
"pronoun_subject": "He",
|
||||||
|
"pronoun_object": "Him",
|
||||||
|
"pronoun_deppos": "His",
|
||||||
|
"pronoun_indpos": "His",
|
||||||
|
"pronoun_reflex": "Himself",
|
||||||
|
"head_shape": "normal-male",
|
||||||
|
"hair_style": "",
|
||||||
|
"torso_shape": "",
|
||||||
|
"arm_shape": "",
|
||||||
|
"leg_shape": "",
|
||||||
|
"clothing": {
|
||||||
|
"top": "",
|
||||||
|
"bottom": "",
|
||||||
|
"shoes": "",
|
||||||
|
"hat": "",
|
||||||
|
"gloves": "",
|
||||||
|
"neck": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
$name = input
|
||||||
|
@tim says "hello"
|
||||||
|
@tim says $name
|
||||||
|
$x = 3
|
||||||
|
$x + 1
|
||||||
|
if $x == 4 {
|
||||||
|
@tim says "5"
|
||||||
|
}
|
||||||
|
elif $x < 5 {
|
||||||
|
|
||||||
|
@tim says "<5"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
@tim says "whar"
|
||||||
|
}
|
||||||
|
label:
|
||||||
|
$choice_string = choice "choice numero uno" {
|
||||||
|
@tim says "super sad"
|
||||||
|
}
|
||||||
|
or "choice numero duo" {
|
||||||
|
@tim says "super unsad"
|
||||||
|
}
|
||||||
|
or "choice numero tres" {
|
||||||
|
@tim says "hola mi amigos"
|
||||||
|
goto label
|
||||||
|
}
|
||||||
|
END
|
||||||
Reference in New Issue
Block a user