-
Notifications
You must be signed in to change notification settings - Fork 17
How to do anything
QuestJS gives you access to everything, so there is no limit to what can happen in your game as long as it can happen inside a browser. For the purposes of this article, I am thinking more specifically about what is happening in the game world. How do you go about coding that bizarre, complex and wonderful feature of your game?
The first step is to define exactly how it will play out. Write out some transcripts that show what the user will type and how the game will respond. I would suggest at least three, one being a perfect run through, and a couple when the user gets it wrong in different ways.
This is vital because it will tell you if your feature can be translated into interactive fiction. If you cannot think what the user might type, or how the game might respond, then your feature is not going to work - in any IF system.
Once you have a transcript, you can build the environment - create the relevant location and items. You might want to create a CHEAT command so you can quickly get to the location to try it out.
Presumably something will change - or several things. Think about how that information will be stored and where. If items are moving, you can just use the "loc" attribute, if opening and closing, use the "closed" attribute, if switched, use "switchedon". However it is likely there will be other changes. The new attribute should go on the object that changes apart from anything else, this just makes it easier to find later. If it is an either/or thing, use a Boolean. If there are more than two states, and they form a natural progression you are probably best with an integer, but otherwise you might use a string. In either case, it is worth noting what values are allowed - I would suggest doing so as a comment above the code that creates the object.
Now create the custom commands. For the script, whether on the command itself, or the verb on the item, go through all the conditions that mean the command fails. You might want to do one command at a time.
At this stage you can go into the game, and test it out. Have the console open so you can see error messages. You can also test the state of an object by typing it in. To see if the big box is open or closed:
w.big_box.closed
Once the commands are working, you can fine-tune. Think about synonyms for commands and items. Look at the descriptions - items and locations - and see if they still make sense after things have changed.
What happens if the player does it twice? Or tries to do it before she should be able to? Or tries to do it in a different way, or tries the same thing with something else in your game?
A couple of links to external web sites about puzzles:
Tutorial
- First steps
- Rooms and Exits
- Items
- Templates
- Items and rooms again
- More items
- Locks
- Commands
- Complex mechanisms
- Uploading
QuestJS Basics
- General
- Settings
- Attributes for items
- Attributes for rooms
- Attributes for exits
- Naming Items and Rooms
- Restrictions, Messages and Reactions
- Creating objects on the fly
- String Functions
- Random Functions
- Array/List Functions
- The
respondfunction - Other Functions
The Text Processor
Commands
- Introduction
- Basic commands (from the tutorial)
- Complex commands
- Example of creating a command (implementing SHOOT GUN AT HENRY)
- More on commands
- Shortcut for commands
- Modifying existing commands
- Custom parser types
- Note on command results
- Meta-Commands
- Neutral language (including alternatives to "you")
- The parser
- Command matching
- Vari-verbs (for verbs that are almost synonyms)
Templates for Items
- Introduction
- Takeable
- Openable
- Container and surface
- Locks and keys
- Wearable
- Furniture
- Button and Switch
- Readable
- Edible
- Vessel (handling liquids)
- Components
- Countable
- Consultable
- Rope
- Construction
- Backscene (walls, etc.)
- Merchandise (including how to create a shop)
- Shiftable (can be pushed from one room to another)
See also:
- Custom templates (and alternatives)
Handing NPCs
- Introduction
- Attributes
- Allowing the player to give commands
- Conversations
- Simple TALK TO
- SAY
- ASK and TELL
- Dynamic conversations with TALK TO
- TALK and DISCUSS
- Following an agenda
- Reactions
- Giving
- Followers
- Visibility
- Changing the player point-of-view
The User Experience (UI)
The main screen
- Basics
- Printing Text Functions
- Special Text Effects
- Output effects (including pausing)
- Hyperlinks
- User Input
The Side Panes
Multi-media (sounds, images, maps, etc.)
- Images
- Sounds
- Youtube Video (Contribution by KV)
- Adding a map
- Node-based maps
- Image-based maps
- Hex maps
- Adding a playing board
- Roulette!... in a grid
Dialogue boxes
- Character Creation
- Other example dialogs [See also "User Input"]
Other Elements
- Toolbar (status bar across the top)
- Custom UI Elements
Role-playing Games
- Introduction
- Getting started
- Items
- Characters (and Monsters!)
- Spawning Monsters and Items)
- Systema Naturae
- Who, When and How NPCs Attack
- Attributes for characters
- Attacking and guarding
- Communicating monsters
- Skills and Spells
- Limiting Magic
- Effects
- The Attack Object
- [Extra utility functions](https://github.com/ThePix/QuestJS/wiki/RPG-Library-%E2%80%90-Extra Functions)
- Randomly Generated Dungeon
- Quests for Quest
- User Interface
Web Basics
- HTML (the basic elements of a web page)
- CSS (how to style web pages)
- SVG (scalable vector graphics)
- Colours
- JavaScript
- Regular Expressions
How-to
Time
- Events (and Turnscripts)
- Date and Time (including custom calendars)
- Timed Events (i.e., real time, not game time)
Items
- Phone a Friend
- Using the USE verb
- Display Verbs
- Change Listeners
- Ensembles (grouping items)
- How to spit
Locations
- Large, open areas
- Region,s with sky, walls, etc.
- Dynamic Room Descriptions
- Transit system (lifts/elevators, buses, trains, simple vehicles)
- Rooms split into multiple locations
- Create rooms on the fly
- Handling weather
Exits
- Alternative Directions (eg, port and starboard)
- Destinations, Not Directions
Meta
- Customise Help
- Provide hints
- Include Achievements
- Add comments to your code
-
End The Game (
io.finish)
Meta: About The Whole Game
- Translate from Quest 5
- Authoring Several Games at Once
- Chaining Several Games Together
- Competition Entry
- Walk-throughs
- Unit testing
- Debugging (trouble-shooting)
Releasing Your Game
Reference
- The Language File
- List of settings
- Scope
- The Output Queue
- Security
- Implementation notes (initialisation order, data structures)
- Files
- Code guidelines
- Save/load
- UNDO
- The editor
- The Cloak of Darkness
- Versions
- Quest 6 or QuestJS
- The other Folders
- Choose your own adventure