rabdill / bishop

An engine for writing browser-based text adventures using only client-side JavaScript.
Other
1 stars 0 forks source link

Add game-authoring tips #155

Open rabdill opened 9 years ago

rabdill commented 9 years ago

Use the JS console in your browser to find the errors: "Unexpected string" = missing comma

Only having changes happen once: Make the last change modify the current room's changes to "[]".

rabdill commented 9 years ago

How to implement a light switch:

"kitchen" : {
        "type" : "room",
        "name" : "the kitchen",
        "exits": {
            "west" : "dining room"
        },
        "entrance text" : "You're in the kitchen. The window is boarded up, so it's quite dark. You can make out the outline of a stove and a refrigerator in the darkness - neither have their doors.",
        "alt text" : "You're in the kitchen. The window is boarded up, but a dim yellow light provides enough light to see. A stove and a fridge are pretty much the only appliances around - neither have their doors.",
        "title" : "@home base@",
        "items" : {
            "switch" : {
                "name" : "switch",
                "id" : "kitchen light switch",
                "status" : "default",
                "messages" : {
                    "examine" : "A regular old light switch, in the 'off' position. You can't tell if it's connected to anything.",
                    "take" : "That's not how light switches work."
                },
                "states" : {
                    "default" : {
                        "descriptor" : "You see a light switch hanging from an electrical box near the door."
                    },
                    "flip" : {
                        "descriptor" : "You see a light switch hanging from an electrical box near the door.",
                        "from" : {
                            "default" : "You gingerly flip the switch to the 'on' position. A sad, yellowing light in the ceiling flickers on weakly, but it helps.",
                            "flip" : "You gingerly flip the switch to the 'on' position. A sad, yellowing light in the ceiling flickers on weakly, but it helps.",
                            "other-flip" : "You flip the switch back into the 'off' position. The room goes dark."
                        },
                        "changes" : [
                            ["rooms","kitchen","buffer",{"reference" : ["rooms","kitchen","entrance text"]}],
                            ["rooms","kitchen","entrance text",{"reference" : ["rooms","kitchen","alt text"]}],
                            ["rooms","kitchen","alt text",{"reference" : ["rooms","kitchen","buffer"]}],

                            ["rooms","kitchen","buffer",{"reference" : ["rooms","kitchen","items","switch","states","flip","from","flip"]}],
                            ["rooms","kitchen","items","switch","states","flip","from","flip",{"reference" : ["rooms","kitchen","items","switch","states","flip","from","other-flip"]}],
                            ["rooms","kitchen","items","switch","states","flip","from","other-flip",{"reference" : ["rooms","kitchen","buffer"]}],
                        ]
                    }
                }
            },