Public Functions:Player Getter Functions
Player getter functions provide shortcuts to get useful information about the player.
-
MyGame.player().hasKey("asset")
{String}
asset a name or ID representing an
asset
Boolean
This method checks whether the player is carrying a key for the
specified asset. Returns
falseif specified asset is invalid or can't be unlocked or has not key, etc. This method only works with Tangible assets. -
MyGame.player().getKey("asset")
Object|Null
If the player is holding any keys that unlock the specified asset, this
method returns an asset object for the first key found. Returns
nullif player is not carrying any keys for the specified asset. This method only works with Tangible assets. - MyGame.player().getKeys("asset") Array Since it's always possible that player may be holding multiple valid keys, this method returns an array of key asset objects, if player is holding them. Returns an empty array if player is not carrying any keys for the specified asset. This method only works with Tangible assets.
- MyGame.player().getNest() Returns the player's nest parent, if player is nested. Nesting is a distinct form of parent / child relationship that only applies to members of the Character class tree. Characters may be simultaneously nested in an asset while still being in a room.
- MyGame.player().hasSeen("asset") {String} asset a name or ID representing an asset Boolean This method checks whether the player has seen the specified asset.
- MyGame.player().inventory() This method returns the player's inventory. This gets a deep list that includes nested assets, so long as they are known.
- MyGame.player().isNested() Boolean Returns whether the player is currently nested.
- MyGame.player().knowsAbout("asset") {String} asset a name or ID representing an asset Boolean This method checks whether the player knows about the specified asset.
-
MyGame.player().sees("asset")
{String}
asset a name or ID representing an
asset
Boolean
This method checks whether the player can see the specified asset.
Returns
falseif specified asset can't be seen for any reason, including room is dark, asset is not in room, asset is hidden inside another closed asset, etc. This method only works with Tangible assets.