Swords™ World Editor

© 2019 - Sleepless Inc. - All Rights Reserved

__name__

Module ID: __module__
Version: __version__

You are editing version __version__ of the world named "__name__".

Published? 
Checking "Published" will make the world appear in the "New Game" menu on the play page, "https://swords.sleepless.com/play".
Play
The "Play" password will be required to play the world.
Edit
The "Edit" password is required to load and edit the world.

Places


Place: __name__

Name: The name of this place. On Look: Presented when the "look" command is used. Should be a direct answer to the question "what do I see?" Example: "You see trees and mountains." Optional custom function. On Where: Commands "location", and "go" will show this. Should be a direct answer to the question "what is my current location?" Example: "In your cabin." On Leave: If not set, "go" command will show "You go ___.", otherwise it will show this string. Example: "You hear the birds fade into the distance." Optional custom function. On Arrive: If set, "go" command will show this after player arrives in this place. Example: "You feel a sense of dread." Optional custom function.


Things









Exits

__name__  →  __dest__


Worlds ============ A **world** has a name and contains **places**. Each time you save a world, it gets a new version number. Places ============ Places have a name, and contain **exits** and **things**. Places also have these attributes: - { on_look } --- Text that is shown when you use the **look** command. - { on_where } --- Text that is used by the game to let you know where you are. - { on_leave } --- Text that is shown just as you are leaving a place. - { on_arrive } --- Text that is shown just as you arrive at a new place. Exits ============ Exits are how the player moves from place to place. They have a direction, a description, and a destination. Exits can only take the player in directions that correspond to north, south, east, west, up, and down. When you create a new exit, you specify the direction, then you can edit the destination place (where it leads the player) and a description. Things ============ Name --------------- Things have a name which is always comprised of two parts - a general "type" and a "specific" description. For example, a "Rusty Sword" has a general type of "sword" and a specific description of "rusty". All things should be named this way. Neither of the two parts is optional, and there can only be one of each part. Furthermore, the general type should come second. For example, "Deadly Agent" is okay, but "Agent Smith" is not (agent is the type). In general, you can think of general and specific as noun and adjective respectively and you should be fine. Attributes --------------- Things have definable **key / value pairs**. For example: - name = "Rusty Sword" - on_look" = "The cave is damp and creepy" - hitpoints = 100 You can freely add keys to a {Thing}, but only certain keys are recognized and used directly by the game engine: - { on_look } --- - { on_take } --- - { on_drop } --- - { on_wear } --- - { on_wield } --- - { on_stash } --- - { on_study } --- - { on_read } --- - { on_query } --- - { on_open } --- - { on_die } --- - { hitpoints } --- - { strength } --- - { agility } --- - { armor } --- - { civil } --- Set to 0 or 1 in combination with on_fight In general, those attributes that start with "on_" correspond to game commands. For example, if you want to take something, the thing must have an **on_take** attribute. It can be empty, but it must be present or you can't take it. A thing is an enemy if it has an { on_fight } attribute and the { civil } attribute is 0 or non-existent. Setting {civil} to 1 causes the thing to only attack you if you attack it first. Code Blocks ------------------- Those keys that start with "on_" generally all can optionally contain a **code block** so that you can program special behavior when that even occurs. A code block is defined as a string value that starts with "{{}" and ends with "}". If that is found, the code in between is executed as javascript. There are some variables that will be available in the context of the running code: - { thing } - the thing that the code block belons to. - { player } - the player object. - { inventory } - the player's inventory. - { place } - the current place - { things } - the things in the current place. There are also some useful functions available: - { summon_thing( thing_id, place_id ) } - Move a thing {thing_id} from a place {place_id}to the current place. - { summon_exit( exit_id, place_id ) } - Move an exit {exit_id} from a place {place_id}to the current place. Code blocks should return one of these things: - The {null} value - A {string} - An object with {stop} and {str} keys, like { { stop: true, str: "you can't do it" } } Returning a string (empty or otherwise) is the same as { { stop: false, str: the_string } }. When a code block is run, if the stop value is { true } then the default behavior for that event handler will be skipped and the string returned. Otherwise, the default behavior will continue and {str} will be included in the response.

Load World

Password?

Edit Init Code

Edit Thing

__key__ __val__


Edit Exit

Direction: Destination: Description:

Edit Value