Velvet
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Documentation ============= *(syntax name : ZorkDown ?)* is a lightweight single file game engine to play [Zork]-like interactive game on a Discord server. There are two things: the parser on the one hand (a single light .js file), and a your text content on the other hand, i.e. the content of the textual game. Its syntax is meant to be closer to writing logic than pure programing logic. (Blablabla logic-less syntaxe based on markdown.) Here is a simple example. ``` ! look + Detecting your presence, the lights turn on by themselves. ``` As you can see, anyone can fairly easily understand what these two lines are about : when I look (action), there's a description (response). This syntax is about being easily writtable, even by people who are not confortable with code. It is rather simple and yet robust and powerful. [Zork]: https://en.wikipedia.org/wiki/Zork ### Main functionalities ### *(syntax name)* is inspired by [Zork]. (explain how Zork works) #### – Actions #### Each possible action is described through paragraphs, and each paragraph is composed by lines. The first line of a paragraph must be an action, described by a `!` at the beginning of the line. ``` ! take lamp ``` The paragraph beginning with `! take lamp` is the one played when the players writes `!take lamp`. It is possible, of course, to have multiple ways to write an action, each way being seperated by ` / `. ``` ! take lamp / grab lamp / take lantern / grab lantern ``` > Note that, as long as the action written by the player includes `take lamp`, anything works. That means it is not necesary to write `take the damn lamp` in your game file, because `take the damn lamp` has `take lamp` in it. Note that it is also case-insensitive. Therefore: > ~~`! Take Lamp / take the lamp / take the magical lamp`~~ :-1: > `! take lamp` :thumbsup: #### – Responses #### Each paragraph has at least an action and an response. A response is what the game answers to an action. A response is described with a `+` sign at the beginning of the line. ``` + You have taken the lamp. ``` Put together, you have a paragraph: ``` ! take lamp + You have taken the lamp. ``` It is also possible to have multiple reponses: ``` ! take lamp + You have taken the lamp + You have the lamp, great! + The lamp is yours. + My prrrrrecioussss! ``` In such a case, a random reponse will be picked by the game engine, among the different possibilities. #### – Variables #### The game engine offers the possibility to declare booleans. Basically, booleans are on / off buttons for code. Their values are `true` (on) or `false` (off), nothing else. A boolean can describe a state (are my hands washed? Is the dog here?), or an item (do I have the key?), or whatever you want that could be answered by yes or no. A boolean is set into curly brackets, inside of a response. ``` + You have taken the lamp {+magical lamp} ``` A `+` sign in front of the boolean name means an "on" or `true` state, while `-` means an "off" or `false` state. ``` ! drop lamp + You have dropped the magical lamp. {-magical lamp} ``` > Note: unlike many programing langages, you don't need to declare your variables at the beginning of your file, like `public bool magicalLamp = false;`. Variables are set to `false` by default, and automatically declared by the parser. Every variables are global. Also, the name of your boolean can contain spaces. You can change as many booleans as you can in a single response. ``` + You have taken the lamp and that fills you with determination {+magical lamp} {+determination} {-fear} ``` #### – Items Every states and changes are possible through booleans, including items. During the game, items collected by the player are stored in his inventory and accessible through the `! inventory` command, like Zork. Here is the way to attach a description to a boolean and to make it an item. ``` ! take lamp + You have taken it {+magical lamp -> A magical lamp offered by grandma} ``` By doing so, the boolean `magical lamp` is going to be considered as an item by the program. When recieving the command `! inventory`, the game will output: ``` You have: — A magical lamp offered by grandma ``` If you want anything to be displayed in the `inventory`, you just have to write its description *once*. ``` ! clean hands + Your hands are now clean {+clean hands -> A pair a sparkling clean hands} ``` In the `inventory`, when having the lamp and your hands clean: ``` You have: — A magical lamp offered by grandma — A pair a sparkling clean hands ``` > Note: As mentioned above, you only need to write a description once. Plus, **that description mustn't be done** inside of a condition, like `? lamp -> A magical lamp`. It must be done inside of **a positive response**, with the boolean setting. Therefore: > ~~`? lamp -> A magical lamp`~~ :thumbsdown: > ~~`?{-lamp -> A magical lamp}`~~ :thumbsdown: > `{+lamp -> A magical lamp}` :thumbsup: #### – Conditions #### Booleans are used through conditions. Conditions are useful for making different kind of interactions in your game. Conditions are written with a `?` sign at the beginning of the line. ``` ? magical lamp ``` That line above literally means “Do I have the magical lamp?”. If `magical lamp` is set to `true` (or `+` or "on", that's the same), then the condition is `true`. When the condition is true, the game engine replies the positive response (`+` response): ``` ! take lamp ? magical lamp + … But you already have taken the lamp! ``` Otherwise, if the condition is `false`, the game engine replies the negative response, written with a `-` sign. It is the equivalent of an `if / else` statement in programing language. ``` ! take lamp ? magical lamp + You already have taken the lamp! - You have taken the lamp. {+magical lamp} ``` It is also possible to reverse a condition with the `!` sign. In this case, `? !magical lamp` means "Do I have **not** the magical lamp?". This condition is `true` if the player do **not** have the magical lamp. ``` ! take lamp ? !magical lamp + You have taken the lamp. {+magical lamp} - You already have the lamp! ``` Note that you can check multiple booleans in a single condition, with ` & `. ``` ! take lamp ? !magical lamp & !blind + Thankfully, you're not blind yet. You have taken the lamp. {+magical lamp} - It is not possible to take the lamp. ``` #### – Multiple conditions #### Checking multiple booleans in a single condition sure is useful, but can be rather limited. Know that there is the possibility of having multiple conditions. ``` ! take lamp ? !troll here + You reach for the lamp… - The troll prevents you from reaching the lamp! ? magical lamp + But you already have the lamp, dummy! - And successfuly take it! {+magical lamp} ``` The conditions are checked from up to down. If the first condition is `true`, the game engine outputs its `+` response and then checks the next condition, and so on. However, as soon as a negative response is reached, the multiple conditions take end. The rest is not checked. That would be the equivalent of a `return` in programing langages. In the example above, if the troll is *not* not here (i.e the troll is here), then the condition `!troll here` is `false`. The negative response is output (`The troll prevents you from reaching the lamp!`), and the rest is not checked because of the negative answer. This possibility is useful for changing environment description depending on different conditions: ``` ! look + The room is rather dark. ? troll here + A tall and menacing figure is staring at you. ``` Of course, multiple responses work with multiple conditions. ``` ! take lamp ? !troll here + You reach for the lamp… - The troll prevents you from reaching the lamp! - The troll roars to intimidate you. - The troll hits you violently with its club. {=DEATH} ? magical lamp + But you already have the lamp, dummy! - And successfuly take it! {+magical lamp} ``` #### Others #### It is possible to add comments to your file: words that are going to be ignored by the parser. To do so, type `>` at the beginning of your comment line. ``` > This is a comment. This is not read by the parser. ``` To make a default response for actions that are not understandable by the game engine, write `! *`, as below: ``` > This is output by default, if nothing else is to be ouput. ! * + I don't understand this command. ``` To trigger the end of the game, just add `{=DEATH}` to a response, just as below: ``` ! take lamp + … But the lamp was a lie! You die in the process. {=DEATH} ``` ### Salons ### This part is more specific to Discord. If you want your game to run as a bot on a discord server, you might want to read the "Parser" part down below. #### Local actions This game engine offers the possibility to run through different salons, with specific content for each salon, like a character going from a room to another. The character can be only at one salon at a time. To write content for a salon, write its name as following: ``` # 🗺o10-c > This is the main salon of the game. ``` Every actions following this line will be only doable in the #🗺010-c salon. ``` # 🗺o10-c ! look + Welcome to O10-C! # 🏡villa > This no longer belongs to 🗺010-c. It belongs to 🏡villa. ! look + Welcome to the villa! ``` Note that the first salon in your game file will be the default salon: this is where the game is going to start. In our example, that would be #🗺010-c. #### Global actions For global actions, i.e actions that are possible everywhere, just write those in `# everywhere`: ``` # everywhere > The following paragraphs are global ! say + You said that. + You said something. + You said it. ``` #### Going from one salon to another You can go from the current salon to another with a command into curly brackets, like a boolean: `{@(name of salon)}` ``` # 🗺010-c ! go to #🌈général / go to general + Let's go! Join me in #🌈général channel. {@🌈général} ``` > Note: do not type `#` for that command. Just type the correct salon name without the `#` sign. When the game goes to another salon, it automatically triggers the `! look` action. The `! look` action is what contains the description of the place. Every salon of your game should have at least a `! look` action and a `! leave / go back` action (without the possibility to leave, you would be trapped forever!). ``` # 🌈général ! look / observe + You are in the school entrance hall. ! leave / go back + Have you forgotten your lamp? You decide to leave. {@🗺010-c} ``` ### Examples ### #### Taking and droping an item: ``` ! take lamp ? magical lamp + You already have taken the lamp! - You have taken the lamp. {+magical lamp} ! drop lamp / put lamp ? magical lamp + You have droped the lamp. {-magical lamp} - You don't have a lamp. ``` A very basic item interaction: taking and droping. You can't drop something you don't have, or take something you already have, can you? #### A default response for an action: ``` # everywhere ! take + You can't take that. ! take lamp / take lantern + You have taken the lamp. {+lamp} ``` In this example, when the player tries to `take` something, the response `You can't take that.` is output by default, because there is `take` in the action. However, if the player types `!take lamp` instead of something else, the `! take lamp` action takes priority over the `! take` action, because it is closer to what the player typed. Default responses are very useful for the player to understand what actions are possible, even though they're trying to take / see / use the wrong thing. #### Entering a code: ``` ! enter 6666 / code 6666 ? padlock + The padlock has already been unlocked! - The padlock is unlocked, the closet is now open. {+padlock} ! enter / code ? padlock + The padlock has already been unlocked! - … But the padlock remains locked. ``` This example is very similar to the previous one, but applied in a different context. If the player tries entering a different code from the correct one, it won't work. #### A random death machine: ``` ! russian roulette + *click* ! + *click* ! + *click* ! + *click* ! + *click* ! + BANG! {=DEATH} ``` In this example, there's a 1/6 chance for the `+ BANG!` response to be triggered. If so, the player dies. This can be useful for a situation in which the player has to do the same thing all over again, until it works. #### A changing description ``` ! look ? light on + An armor stands still before you. - You can't see anything right now. ? !sword + It holds a great steel sword. - The sword it was holding has been taken. ``` In this example, the description will change depending on two things. The light on the one hand, and the sword as an item on the other hand. If there's no light, nothing can be seen, thus the description ends with `You can't see anything right now` regardless of having the sword or not. If the light is on, then the description begins with `An armor stands still before you`. It is then followed by one of the next responses: `It holds a great steel sword` or `The sword it was holding has been taken`, depending on `? !sword`. This is very useful when some actions have impacts on the environment. ### Quick syntax reference #### Single action ``` ! action ``` #### Alternatives for a single action ``` ! action / action / action ``` #### Wildcard action ``` ! * ``` #### Single condition ``` ? boolean ``` #### Reversed condition ``` ? !boolean ``` #### Multiple conditions ``` ? boolean1 & boolean2 ``` #### Positive response ``` + You did it. ``` #### Negative response ``` - You didn't do it. ``` #### Random positive responses ``` + 1/3 chances to be output. + 1/3 chances too. + And, 1/3 chances again. ``` #### Random negative responses ``` - 1/3 chances to be output. - 1/3 chances too. - And, 1/3 chances again. ``` #### Setting boolean to true ``` {+boolean} ``` #### Setting boolean to false ``` {-boolean} ``` #### Setting boolean with a description ``` {+boolean -> Description content} ``` #### Salon specifying ``` # salonName ``` #### Salon changing ``` {@salonName} ``` #### Game Over ``` {=DEATH} ``` #### Comment ``` > This is a comment ``` ### Parser ### #### What is a parser? #### How to make it run on Discord ### Other ###

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully