Class:Game
Defined in: adventure/Game.js, line 5
Constructor:
var MyGame = new adventurejs.Game( "MyGame", "MyGameDisplay" )
Description
Game is used to construct a new game instance. This instance contains the entire game and all of its methods. If you open the browser inspector window, go to the console, and type "MyGame" (or whatever game_name you have provided), you can see the properties scoped to the Game object. Every object in the game is given a reference back to the main Game object. This means that you can run multiple games in a single HTML page.
Example:
A minimal game defines at least one Room and one Player Character. If you don't provide either of these, one will be created automatically.
var MyGame = new adventurejs.Game( "MyGame", "MyGameDisplay" )
.set({
title: "Welcome Game",
author: "Ivan Cockrum",
description: "This is my great game! Thanks for playing!",
version: "0.0.1",
});
MyGame.createAsset({
class: "Room",
name: "Welcome Room",
descriptions:{ look: "You've entered the Welcome Room. " },
});
MyGame.createAsset({
class: "Player",
name: "Guest",
is: { active: true, },
place: { in: "Welcome Room" },
});
Private Constructor:
var foo = new adventurejs.Game(game_nameopt, displayElIdopt)
Parameters:
-
game_nameString <optional>
Default value: ""
A string that matches the name of the var used to store the new Game instance. Used to give the game a reference back to itself, relative to the browser window. If no name is provided, the instance name will default to "MyGame". The chief reason you might want to use a custom game_name is if you want to run multiple instance of adventure.js on a single page; give them distinct names to prevent them from colliding. You also may want to refer to your Game instance if you write any custom javascript. -
displayElIdString <optional>
Default value: ""
A string that matches the ID of an existing DOM element into which to insert the game Display. If no ID is provided, a DOM element will be created with an ID of "MyGameDisplay" and class of "ajs-display", and appended to .
- Index
- Methods
- Properties
Index
Methods:
- addAsset
- addPronouns
- addWordsToLookup
- addWordsToLookup
- appendOutput
- callIntervals
- callPostScripts
- callPreScripts
- capitalize
- clear
- clear
- clearInput
- clearPrompt
- combineVerbs
- constructAsset
- convertTemperature
- createAsset
- createClass
- createCompass
- createDeferredAssets
- createDock
- createGlobalCeilings
- createGlobalConcepts
- createGlobalExits
- createGlobalFloors
- createGlobalScenery
- createGlobalWalls
- createImageLookup
- createPostScript
- createPreScript
- createVerb
- debug
- decrypt
- decVar
- deobfuscate
- destroyAsset
- disableAllVerbsBut
- disableVerbs
- dispenseAsset
- doTravel
- enableVerbs
- endTurn
- findSubstanceBodyOrHeld
- findSubstanceContainers
- findViewModifiers
- getAreaScenery
- getAsset
- getAsset
- getDescription
- getDirections
- getExitFromDirection
- getExits
- getExtendedExitName
- getInput
- getLastTurn
- getLongestKey
- getModifiedDescription
- getPlayer
- getPrintableObjectList
- getRoom
- getRoomContents
- getRoomDescription
- getRoomExits
- getRoomFloor
- getStringLookup
- getSubject
- getVar
- getVar
- getVerb
- getVerifiedSentence
- getWordCount
- hasCommonWord
- hasVerb
- hideStatusbar
- idleNPCs
- incVar
- initializeAssets
- isCurrentRoom
- log
- midTurn
- modifyVerb
- move
- overrideOutput
- play
- prependOutput
- printAreaEvents
- printPlayerInventory
- printQueue
- printRoom
- printRoomExits
- printWithInput
- promptUser
- removeAssetFromLookup
- removePostScript
- removePreScript
- replaceVerb
- sendToInput
- sendToParser
- set
- setAreaScenery
- setPlayer
- setRoom
- setStyle
- setVar
- showStatusbar
- sortLookupValues
- startInterval
- stopInterval
- tryTravel
- tryTravelOld
- validateAssetPrecursor
- validateAssets
- vars
Properties:
- author
- baseline
- class_lookup
- deferred_assets
- dispensed_assets
- doStartGame
- game
- game_name
- game_states
- goalcard
- hintcard
- image_lookup
- input
- introcard
- last_turn
- longest_key
- outrocard
- platonic_classes
- platonic_dispensers
- player
- potential_lookup
- reactor
- room
- room_lookup
- score
- scorecard
- settings
- state_vars
- title
- version
- world
- world._vars
- world_lookup
Methods Collapse all |
addAsset
addAsset(asset) → {Object}
Defined in: adventure/game/addAsset.js, line 7
Parameters:
-
assetObject
A generic object with properties to copy into a new classed object.
MyGame.addAsset({ "class":"foo", "name":"bar", [...] })
addAsset() is a constructor function that can be used to dynamically create new Assets at runtime, which is to say, after the game has been initialized. This method encapsulates game.createAsset(), asset.validate() and asset.initialize(). The end result is equivalent to using createAsset() in your game file.
Returns:
Object
A new Asset of the class specified in asset.class.
addPronouns
addPronouns(oldVerb, newVerb) → {object}
Defined in: adventure/Game.js, line 674
Parameters:
-
oldVerbobject -
newVerbobject
Returns:
object
addWordsToLookup
addWordsToLookup(asset, words, type)
Defined in: adventure/game/addAssetToLookup.js, line 7
Parameters:
-
assetObject -
wordsArray -
typeString
Because we're not doing natural language processing and everything is indexed, we want to increase the chances that the parser understands player input that is partial or has words jumbled. We add a lookup entry for every combination of an object's adjectives with its noun(s). For example we have a "green colored pencil", and we want the parser to understand "green pencil" or "colored pencil". If there are other colored pencils, we want the parser to understand "colored pencils". If there are colored pencils in three shades of green, we want the parser to understand "green pencils". We store all of these combinations to the lookup.
addWordsToLookup
addWordsToLookup(asset, words, type)
Defined in: adventure/game/addWordsToLookup.js, line 7
Parameters:
-
assetObject -
wordsArray -
typeString
appendOutput
appendOutput(msg) → {boolean}
Defined in: adventure/Game.js, line 506
Parameters:
-
msgString
Returns:
boolean
callIntervals
callIntervals()
Defined in: adventure/game/callIntervals.js, line 7
callPostScripts
callPostScripts()
Defined in: adventure/Game.js, line 787
callPreScripts
callPreScripts()
Defined in: adventure/Game.js, line 768
capitalize
capitalize(string) → {String}
Defined in: adventure/utils/capitalize.js, line 4
Parameters:
-
stringString
Returns:
String
clear
clear() → {boolean}
Defined in: adventure/Game.js, line 711
Returns:
boolean
clear
clear() → {boolean}
Defined in: adventure/Game.js, line 722
Returns:
boolean
clearInput
clearInput()
Defined in: adventure/Game.js, line 434
clearPrompt
clearPrompt()
Defined in: adventure/game/clearPrompt.js, line 8
combineVerbs
combineVerbs(verbs, intoVerb) → {object}
Defined in: adventure/Game.js, line 649
Parameters:
-
verbsobject -
intoVerbobject
Returns:
object
constructAsset
constructAsset(source) → {Object}
Defined in: adventure/game/constructAsset.js, line 8
Parameters:
-
sourceObject
A generic object containing properties to copy to a game object.
Returns:
Object
Returns an instance of whatever class was defined.
convertTemperature
convertTemperature(temperature, context_id) → {Boolean}
Defined in: adventure/utils/convertTemperature.js, line 3
Todos: Finish writing this.
Parameters:
-
temperatureNumber | String
In Celsius. -
context_idString
The ID of the game object the temperature applies to.
Returns:
Boolean
createAsset
createAsset(asset) → {Object}
Defined in: adventure/game/createAsset.js, line 7
Parameters:
-
assetObject
A generic object with properties to copy into a new classed object.
MyGame.createAsset({ "class":"foo", "name":"bar", [...] })
createAsset() is a constructor function available to authors, for creating all instances of Asset and its subclasses, which includes most of the objects you'd put in a game world.
The function takes one parameter: a generic object containing properties to be passed into a class instance. For most asset classes, the only required properties are 'class' and 'name'. You'd likely also want to specify 'location', though that's not a required property. Otherwise, an author only needs to define the properties they wish to revise away from default settings.
For example, to create a simple brass key with default settings and put it in a particular location:
MyGame.createAsset({
"class":"Key",
"name":"brass key",
place: { in: "desk drawer" },
});
At runtime, createAsset() returns a new instance of the given class, uses the given name to create an id, validates the object properties, initializes the new object, and then adds it to the game world. Failure to pass any of these steps will throw an error to the console.
For more examples of how to use createAsset, see About Assets and other How To docs under Getting Started.
Returns:
Object
A new Asset of the class specified in asset.class.
createClass
createClass(data) → {Object}
Defined in: adventure/game/createClass.js, line 7
Parameters:
-
dataObject
A generic object with properties to copy into a new class definition.Properties
-
extendsString
The name of a parent class to subclass. -
classString
The name of the new subclass.
-
MyGame.createClass(
class Foo extends adventurejs.Bar {
constructor(name, game_name, context_id = "", id = "") {
super(name, game_name, context_id, id);
this.class = "Foo";
}
}
)
createClass() is a constructor function available to authors for creating whole new classes of Assets. The function takes one parameter: a class declaration function. For example, to create a special class of Yggdrasil tree:
MyGame.createClass({
extends: "Tree",
class: "Yggdrasil",
})
At runtime, createClass() plugs the new class constructor directly into AdventureJS, where it can be used to construct instances with the usual Game.createAsset({}) method. As of this writing, createClass is basically a passthrough without any internal error checking, so consider yourself going off road. It's recommended that you browse through the Asset Reference to see how classes are laid out.
You can also find more info under Custom Classes.
Returns:
Object
createCompass
createCompass(properties) → {Object}
Defined in: adventure/game/createCompass.js, line 7
Parameters:
-
propertiesObject
A generic object with properties used to construct a compass.
Returns:
Object
A new compass object.
createDeferredAssets
createDeferredAssets()
Defined in: adventure/game/createDeferredAssets.js, line 8
Assets created here also need to be validated, since they were added to the deferred list during the initial validation pass and therefore missed validation.
createDock
createDock(properties) → {Object}
Defined in: adventure/game/createDock.js, line 7
Parameters:
-
propertiesObject
A generic object with properties used to construct the verb dock.
Returns:
Object
A new verb dock object.
createGlobalCeilings
createGlobalCeilings()
Defined in: adventure/game/createGlobalCeilings.js, line 8
createGlobalConcepts
createGlobalConcepts()
Defined in: adventure/game/createGlobalConcepts.js, line 8
createGlobalExits
createGlobalExits()
Defined in: adventure/game/createGlobalExits.js, line 8
createGlobalFloors
createGlobalFloors()
Defined in: adventure/game/createGlobalFloors.js, line 8
createGlobalScenery
createGlobalScenery()
Defined in: adventure/game/createGlobalScenery.js, line 8
createGlobalWalls
createGlobalWalls()
Defined in: adventure/game/createGlobalWalls.js, line 8
createImageLookup
createImageLookup(asset) → {Object}
Defined in: adventure/game/createImageLookup.js, line 7
Parameters:
-
assetObject
A generic object with properties to copy into the image library.
MyGame.createImageLookup({
images: [
{ id: "desert", image: "images/backgrounds/desert.jpg" },
{ id: "sea", image: "images/backgrounds/sea.jpg" },
{ id: "mountains", image: "images/backgrounds/mountains.jpg" },
{ id: "dungeon", image: "images/backgrounds/dungeon.jpg" },
{ id: "throneroom", image: "images/backgrounds/throneroom.jpg" },
],
});
The image library is accessible at game.image_lookup.
Returns:
Object
A reference to the image lookup.
createPostScript
createPostScript(object) → {Object}
Defined in: adventure/game/createPostScript.js, line 7
Parameters:
-
objectObject
A generic object with properties to copy into a new classed object.
Returns:
Object
The object that was passed in.
createPreScript
createPreScript(object) → {Object}
Defined in: adventure/game/createPreScript.js, line 7
Parameters:
-
objectObject
A generic object with properties to copy into a new classed object.
Returns:
Object
The object that was passed in.
createVerb
createVerb(verb) → {object}
Defined in: adventure/Game.js, line 624
Parameters:
-
verbobject
Returns:
object
debug
debug(token)
Defined in: adventure/game/debug.js, line 7
Parameters:
-
tokenString
decrypt
decrypt(text) → {String}
Defined in: adventure/utils/decrypt.js, line 5
Parameters:
-
textString
Returns:
String
decVar
decVar()
Defined in: adventure/Game.js, line 915
deobfuscate
deobfuscate(text) → {String}
Defined in: adventure/utils/deobfuscate.js, line 5
Parameters:
-
textString
Returns:
String
destroyAsset
destroyAsset(asset)
Defined in: adventure/game/destroyAsset.js, line 5
Parameters:
-
assetObject
The asset to be removed.
disableAllVerbsBut
disableAllVerbsBut(verbs) → {object}
Defined in: adventure/Game.js, line 600
Parameters:
-
verbsobject
Returns:
object
disableVerbs
disableVerbs(verbs) → {object}
Defined in: adventure/Game.js, line 588
Parameters:
-
verbsobject
Returns:
object
dispenseAsset
dispenseAsset(Class, aspect) → {Object}
Defined in: adventure/game/dispenseAsset.js, line 7
Parameters:
-
ClassString
An asset class name. -
aspectString
The aspect to move the new asset to.
MyGame.dispenseAsset({ "class":"foo", "name":"bar", [...] })
dispenseAsset() is a constructor function that can be used to dynamically create new Assets at runtime, which is to say, after the game has been initialized. This method encapsulates game.createAsset(), asset.validate() and asset.initialize(). The end result is equivalent to using createAsset() in your game file.
Returns:
Object
target The asset to move the new asset to.
doTravel
doTravel(direction, params)
Defined in: adventure/game/doTravel.js, line 8
Parameters:
-
directionString -
paramsObject
enableVerbs
enableVerbs(verbs) → {object}
Defined in: adventure/Game.js, line 612
Parameters:
-
verbsobject
Returns:
object
endTurn
endTurn()
Defined in: adventure/Game.js, line 806
findSubstanceBodyOrHeld
findSubstanceBodyOrHeld(substance_id) → {Array}
Defined in: adventure/game/findSubstanceBodyOrHeld.js, line 8
Parameters:
-
substance_idString
Returns:
Array
findSubstanceContainers
findSubstanceContainers(substance_id, context, selects) → {Array}
Defined in: adventure/game/findSubstanceContainers.js, line 8
Parameters:
-
substance_idString -
contextObject -
selectsArray
Returns:
Array
findViewModifiers
findViewModifiers() → {Array}
Defined in: adventure/game/findViewModifiers.js, line 8
Returns:
Array
getAreaScenery
getAreaScenery(asset, identifier) → {String}
Defined in: adventure/game/getAreaScenery.js, line 8
Parameters:
-
assetObject | String -
identifierString
Global assets are a bit (perhaps overly) complicated. They exist as singular objects in the game world, and they can be enabled/disabled and have their descriptions overridden per room and per zone.
For example:
MyGame.world.global_air is an assetMyGame.world.room.area_scenery.global_air
is a simple object property that can be used to determine whether
a global asset is available in a given room. MyGame.world.zone.area_scenery.global_air
is a simple object property that can be used to determine whether
a global asset is available in a given zone. Returns:
String
A description of the specified asset id.
getAsset
getAsset(identifier, params) → {String}
Defined in: adventure/game/$.js, line 8
Parameters:
-
identifierString
Name or ID of a game object. -
paramsObject
Used to check for 'prefer_substance' in cases of looking for substances in containers.
Returns:
String
An object ID.
getAsset
getAsset(identifier, params) → {Object}
Defined in: adventure/game/getAsset.js, line 8
Parameters:
-
identifierString
Name or ID of a game object. -
paramsObject
Used to check for 'prefer_substance' in cases of looking for substances in containers.
Returns:
Object
A game asset.
getDescription
getDescription(identifier) → {String|Boolean}
Defined in: adventure/game/getDescription.js, line 6
Parameters:
-
identifierString
This is scoped to Game rather than Asset because there are cases that handle simple unclassed objects with description properties, notably: properties of area_scenery.
Returns:
String
|
Boolean
getDirections
getDirections() → {Object}
Defined in: adventure/game/getDirections.js, line 8
Returns:
Object
getExitFromDirection
getExitFromDirection(direction) → {Object}
Defined in: adventure/game/getExitFromDirection.js, line 8
Parameters:
-
directionString
Returns:
Object
An exit.
getExits
getExits() → {Object}
Defined in: adventure/game/getExits.js, line 8
Returns:
Object
getExtendedExitName
getExtendedExitName(exit, destination) → {String}
Defined in: adventure/game/getExtendedExitName.js, line 8
Parameters:
-
exitObject -
destinationObject
Returns:
String
getInput
getInput() → {Object}
Defined in: adventure/game/getInput.js, line 8
Returns:
Object
getLastTurn
getLastTurn() → {Object}
Defined in: adventure/game/getLastTurn.js, line 8
Returns:
Object
getLongestKey
getLongestKey()
Defined in: adventure/game/getLongestKey.js, line 8
getModifiedDescription
getModifiedDescription(options) → {String}
Defined in: adventure/game/getModifiedDescription.js, line 6
Parameters:
-
optionsObject
This is scoped to Game rather than Asset because there are cases that handle simple unclassed objects with description properties, notably: properties of area_scenery.
Returns:
String
getPlayer
getPlayer() → {Object}
Defined in: adventure/game/getPlayer.js, line 8
Returns:
Object
getPrintableObjectList
getPrintableObjectList(objects, exclusions) → {String}
Defined in: adventure/game/getPrintableObjectList.js, line 8
Parameters:
-
objectsObject
An array of object ID strings. -
exclusionsObject
An array of of object ID strings to exclude.
Returns:
String
A formatted string.
getRoom
getRoom() → {Object}
Defined in: adventure/game/getRoom.js, line 8
Returns:
Object
getRoomContents
getRoomContents(room)
Defined in: adventure/game/getRoomContents.js, line 8
Parameters:
-
roomObject
A room to be printed. Defaults to current room.
getRoomDescription
getRoomDescription(params)
Defined in: adventure/game/getRoomDescription.js, line 8
Todos: Formalize handling for description/brief/verbose descriptions
Parameters:
-
paramsObject
For example:
getRoomDescription( { verbose: true } )
getRoomExits
getRoomExits(room) → {String}
Defined in: adventure/game/getRoomExits.js, line 8
Parameters:
-
roomObject
A room to get exits of. Defaults to current room.
Returns:
String
A formatted list of exits.
getRoomFloor
getRoomFloor() → {Object}
Defined in: adventure/game/getRoomFloor.js, line 8
Returns:
Object
getStringLookup
getStringLookup(verbs) → {object}
Defined in: adventure/Game.js, line 550
Parameters:
-
verbsobject
Returns:
object
getSubject
getSubject() → {Object}
Defined in: adventure/game/getSubject.js, line 8
Returns:
Object
getVar
getVar()
Defined in: adventure/Game.js, line 866
getVar
getVar()
Defined in: adventure/Game.js, line 938
getVerb
getVerb(verb) → {object}
Defined in: adventure/Game.js, line 575
Parameters:
-
verbstring
Returns:
object
getVerifiedSentence
getVerifiedSentence() → {Object}
Defined in: adventure/game/getVerifiedSentence.js, line 8
Returns:
Object
getWordCount
getWordCount() → {Array}
Defined in: adventure/game/getWordCount.js, line 7
getWordCount() is a utility method to get a count of all the unique words the game "knows".
Returns:
Array
hasCommonWord
hasCommonWord(word) → {boolean}
Defined in: adventure/Game.js, line 562
Parameters:
-
wordstring
Returns:
boolean
hasVerb
hasVerb(verb) → {Boolean}
Defined in: adventure/game/hasVerb.js, line 8
Parameters:
-
verbString
Returns:
Boolean
hideStatusbar
hideStatusbar() → {boolean}
Defined in: adventure/Game.js, line 689
Returns:
boolean
idleNPCs
idleNPCs()
Defined in: adventure/Game.js, line 738
incVar
incVar()
Defined in: adventure/Game.js, line 892
initializeAssets
initializeAssets()
Defined in: adventure/game/initializeAssets.js, line 8
isCurrentRoom
isCurrentRoom() → {Object}
Defined in: adventure/game/isCurrentRoom.js, line 8
Returns:
Object
log
log(method, level, msg)
Defined in: adventure/game/log.js, line 7
Parameters:
-
methodString | Number
0=log, 1=warn, 2=error -
levelString | Number
0=critical, 1=high, 2=medium, 3=low -
msg*
Message for console.
midTurn
midTurn()
Defined in: adventure/Game.js, line 837
Todos: should this callPreScripts()? should this do everything that endTurn() does?
modifyVerb
modifyVerb(verb) → {object}
Defined in: adventure/Game.js, line 662
Parameters:
-
verbobject
Returns:
object
move
move(asset) → {Object}
Defined in: adventure/game/move.js, line 8
Parameters:
-
assetObject | String
Asset object or Name or ID of a game object.
Returns:
Object
A game asset.
overrideOutput
overrideOutput(msg) → {boolean}
Defined in: adventure/Game.js, line 520
Parameters:
-
msgString
Returns:
boolean
play
play()
Defined in: adventure/game/play.js, line 8
Returns:
adventurejs.GameprependOutput
prependOutput(msg) → {boolean}
Defined in: adventure/Game.js, line 534
Parameters:
-
msgString
Returns:
boolean
print
print(msg, classes)
Defined in: adventure/game/print.js, line 7
Parameters:
-
msgString -
classesString
print
print(msg, classes)
Defined in: adventure/game/printInferred.js, line 7
Parameters:
-
msgString -
classesString
printAreaEvents
printAreaEvents()
Defined in: adventure/game/printAreaEvents.js, line 8
printPlayerInventory
printPlayerInventory()
Defined in: adventure/game/printPlayerInventory.js, line 8
printQueue
printQueue()
Defined in: adventure/game/printQueue.js, line 7
printRoom
printRoom(params)
Defined in: adventure/game/printRoom.js, line 8
Todos: Formalize handling for description/brief/verbose descriptions
Parameters:
-
paramsObject
For example:
printRoom( { verbose: true } )
printRoomExits
printRoomExits(room)
Defined in: adventure/game/printRoomExits.js, line 8
Parameters:
-
roomObject
A room to be printed. Defaults to current room.
printWithInput
printWithInput(msg, classes)
Defined in: adventure/game/printWithInput.js, line 8
Parameters:
-
msgString -
classesString
promptUser
promptUser()
Defined in: adventure/game/promptUser.js, line 8
removeAssetFromLookup
removeAssetFromLookup(asset)
Defined in: adventure/game/removeAssetFromLookup.js, line 5
Parameters:
-
assetObject
The asset to be removed.
removePostScript
removePostScript(key)
Defined in: adventure/game/removePostScript.js, line 7
Parameters:
-
keyString
The key of a previously defined postScript.
removePreScript
removePreScript(key)
Defined in: adventure/game/removePreScript.js, line 7
Parameters:
-
keyString
The key of a previously defined prescript.
replaceVerb
replaceVerb(oldVerb, newVerb) → {object}
Defined in: adventure/Game.js, line 636
Parameters:
-
oldVerbobject -
newVerbobject
Returns:
object
sendToInput
sendToInput()
Defined in: adventure/Game.js, line 425
sendToParser
sendToParser()
Defined in: adventure/Game.js, line 413
set
set(props) → {adventurejs.Game}
Defined in: adventure/game/set.js, line 8
Parameters:
-
propsObject
A generic object containing properties to copy to the Game instance.
setAreaScenery
setAreaScenery(globals)
Defined in: adventure/game/setAreaScenery.js, line 8
Parameters:
-
globalsObject
A list of globle Scenery Assets.
setPlayer
setPlayer(new_player) → {Object}
Defined in: adventure/Game.js, line 948
Parameters:
-
new_player*
id or object representing new player
Returns:
Object
setRoom
setRoom(newRoom, params)
Defined in: adventure/game/setRoom.js, line 8
Parameters:
-
newRoomObject
A room object to which to move subject. -
paramsObject
setStyle
setStyle(style, params)
Defined in: adventure/game/setStyle.js, line 8
Parameters:
-
styleObject
A room object to which to move subject. -
paramsObject
setStyle offers a method to add custom
stylesheets via the game definition file, as opposed
to embedding styles in HTML or loading stylesheets.
setVar
setVar()
Defined in: adventure/Game.js, line 877
showStatusbar
showStatusbar() → {boolean}
Defined in: adventure/Game.js, line 700
Returns:
boolean
sortLookupValues
sortLookupValues()
Defined in: adventure/game/sortLookupValues.js, line 8
startInterval
startInterval(params)
Defined in: adventure/game/startInterval.js, line 7
Parameters:
-
paramsObject
The parameters for the interval.Properties
-
idstring
Default value:
The id of the Asset which owns the function. -
callbackfunction
Default value:
The function to call on each interval. -
timesnumber <optional>
Default value: null
The number of turns to repeat, or null for indefinite. -
frequencynumber <optional>
Default value: 1
How often to trigger, in turns.
-
stopInterval
stopInterval(params)
Defined in: adventure/game/stopInterval.js, line 7
Parameters:
-
paramsObject
The parameters for the interval.Properties
-
idstring
The id of the Asset which owns the function. -
callbackfunction
The function to stop.
-
tryTravel
tryTravel(direction, params)
Defined in: adventure/game/tryTravel.js, line 8
Parameters:
-
directionString -
paramsObject
tryTravelOld
tryTravelOld(direction, params)
Defined in: adventure/game/tryTravelOld.js, line 8
Parameters:
-
directionString -
paramsObject
validateAssetPrecursor
validateAssetPrecursor(child) → {Object}
Defined in: adventure/game/validateAssetPrecursor.js, line 8
Parameters:
-
childObject
A generic object.
Returns:
Object
A classed object.
validateAssets
validateAssets()
Defined in: adventure/game/validateAssets.js, line 8
vars
vars()
Defined in: adventure/Game.js, line 854
Properties |
author
author :String
Defined in: adventure/Settings.js, line 1226
Default value: ""
baseline
baseline
Defined in: adventure/Game.js, line 201
baseline stores a copy of the initial
game world, for comparison in save/restore and undo.
class_lookup
class_lookup
Defined in: adventure/Game.js, line 229
class_lookup stores a lookup table
containing the ids of all assets by class.
deferred_assets
deferred_assets :Object
Defined in: adventure/Game.js, line 338
dispensed_assets
dispensed_assets :Object
Defined in: adventure/Game.js, line 368
doStartGame
doStartGame :Object
Defined in: adventure/Game.js, line 397
doStartGame is set to a function,
it will be called when the game starts. Provided
to allow authors to call arbitrary code on game start.
game
game :Object
Defined in: adventure/Game.js, line 111
Default value: {}
game_name
game_name :String
Defined in: adventure/Game.js, line 120
game_states
game_states :Object
goalcard
goalcard :Object
Defined in: adventure/Game.js, line 314
goalcard is a singleton class
that stores all the game's goal data
and functions for managing goals.
hintcard
hintcard :Object
Defined in: adventure/Game.js, line 306
hintcard is a singleton class
that stores all the game's hint data
and functions for managing hints.
image_lookup
image_lookup
Defined in: adventure/Game.js, line 243
image_lookup stores a lookup table
for optional images supplied by author.
input
input :Object
Defined in: adventure/Game.js, line 476
- Use game.getInput() instead.
introcard
introcard :Object
Defined in: adventure/Game.js, line 322
introcard is a singleton class
used for printing the game's intro screen.
last_turn
last_turn :Object
Defined in: adventure/Game.js, line 485
- Use game.getLastTurn() instead.
longest_key
longest_key
Defined in: adventure/Game.js, line 220
longest_key stores the world_lookup
key with the highest word count, which is used
for iterating through world_lookup from longest
to shortest.
outrocard
outrocard :Object
Defined in: adventure/Game.js, line 329
outrocard is a singleton class
used for printing the game's outro screen.
platonic_classes
platonic_classes :Object
Defined in: adventure/Game.js, line 359
platonic_dispensers
platonic_dispensers :Object
Defined in: adventure/Game.js, line 350
player
player :Object
Defined in: adventure/Game.js, line 458
- Use game.getPlayer() instead.
potential_lookup
potential_lookup :Object
Defined in: adventure/Game.js, line 377
reactor
reactor :Object
Defined in: adventure/Game.js, line 139
Default value: {}
room
room :Object
Defined in: adventure/Game.js, line 467
- Use game.getRoom() instead.
room_lookup
room_lookup
Defined in: adventure/Game.js, line 236
room_lookup stores an array
containing the ids of all rooms.
score
score :String
scorecard
scorecard :Object
Defined in: adventure/Game.js, line 298
scorecard is a singleton class
that stores all the game's score events
and functions for managing score.
settings
settings :Object
Defined in: adventure/Game.js, line 151
settings is a singleton class
that stores all the game's global settings.
state_vars
state_vars :Object
Defined in: adventure/Game.js, line 98
Default value: {}
title
title :String
Defined in: adventure/Settings.js, line 1211
Default value: ""
version
version :String
Defined in: adventure/Settings.js, line 1240
Default value: ""
world
world
Defined in: adventure/Game.js, line 162
world stores all the game asset
objects. It also stores a handful of variables
such as _player and _room which are used
for convenience. It also stores any global vars
created by the game's author. This last is done
to give authors a place to store vars that can
be written out with saved games.
world._vars
world._vars
Defined in: adventure/Game.js, line 174
Nested property of World
world._vars is a namespace for
authors to store any custom vars that they
would like to be written out with saved games,
so that they can be restored along with other
saved game data in order to retain game state.
world_lookup
world_lookup
Defined in: adventure/Game.js, line 209
world_lookup stores a lookup table
containing indexed keywords for all game assets.