-
Notifications
You must be signed in to change notification settings - Fork 14
Template: CONSULTABLE
A consultable is an item the player can consult, that is, she can ASK the item ABOUT various topics.
The most common type of consultable is an NPC, and this template is included in the NPC template. The documentation for that goes though how to set up a CONSULTABLE, and will not be repeated here - I would strongly suggest reading that.
Here is a simple example, with one entry plus a default.
createItem("computer", CONSULTABLE(), {
loc:'office',
examine:'A recent Dell desktop, with a 24" screen.',
askOptions:[
{
regex:/house/,
msg:'You look "house" in Wiki, and find it is a type of building people live in. Who knew?',
},
{
msg:"You find nothing on the computer about that.",
failed:true,
}
],
})
The second example is more complicated.
- The console will be in any room that has "console" set to
true
- The player needs a password (more specifically needs "hasPassword" to be true)
- It will describe the player logging on and getting automatically logged off.
- The text will be displayed using the "console" CSS class (set up in style.css)
createItem("computer", CONSULTABLE(), {
isAtLoc:function(loc) { return typeof loc === 'string' ? w[loc].console : loc.console },
examine:'A standard Yero console; anyone can consult it.',
loggedOn:0,
eventPeriod:1,
eventActive:true,
eventScript:function() {
this.loggedOn--
if (this.loggedOn === 0) msg("You are automatically logged off the console.")
},
testTalk:function() {
if (!player.hasPassword) return falsemsg("You need a password to use the console")
if (this.loggedOn < 1) msg("You log into the console.")
this.loggedOn = 2
return true
},
msg:function(s) {
msg(s, {}, 'console')
},
askOptions:[
{
regex:/house/,
msg:'House: A type of building people live in.',
},
{
msg:"No data.",
failed:true,
}
],
})
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
respond
function - 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
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
- 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
- Following an agenda
- Reactions
- Giving
- Followers
- 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!)
- Attributes for characters
- Attacking and guarding
- Skills and Spells
- Limiting Magic
- Effects
- The Attack Object
- 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)
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
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