GameText: Difference between revisions

From SkyCorp Global
Jump to navigation Jump to search
(Created page with "== Public Static Methods == === static Map getMap(string mapName) === Gets map object from map name (string). Returns null if map with that name can not be found. == Publi...")
 
No edit summary
Line 1: Line 1:
== Public Static Methods ==
Game Text is a key-value dictionary that stores much of the game's text.  Keys are all uppercase, containing no spaces, but do contain underscores. 


=== static Map getMap(string mapName) ===
There can be multiple dictionaries loaded, but it is expected that text keys are unique across all dictionaries, so multiple dictionaries are essentially one big dictionary.  Currently there is one for private builds, one for public+privates builds, and an "override" dictionary which code can use to override dictionary values at run-time.  In this way, AS3 or LUA code can change just about any string in the gameHowever, it is not recommended to change shared text in this way as multiple mods accessing the same text may conflict with each other, leading to unexpected results
Gets map object from map name (string)Returns null if map with that name can not be found.


== Public Methods ==
== Public Static Methods ==
 
=== boolean addItem([[Entity]] entity, int roomID) ===
Attempt adding entity to roomID.
 
More performant to use entity's
 
Called during drop item, could also be used to drop new items/loot/etc
 
=== boolean deleteItem([[Entity]] entity) ===
Attempt removing an item from anywhere in the map
 
Called from pickup.  Could also be used to destroy an item in a room.
 
=== string getRoomName(int roomID) ===
Gets name of room.  If no such room, returns "INVALID ROOM"
 
=== [[Entity]] getNamedEntityInRoom(string entityName, int roomID) ===
If the map has the named entity in the given roomID, return it.  Else null.
 
=== [[Entity]] getEntityInRoomByType(class entityClass, int roomID) ===
TODO - not yet hooked up, need to figure out how to best pass class information between AS3/LUA.
 
=== void setTagBoolean(int roomID, string tag, boolean enabled) ===
Sets a tag for a room which can be useful for classifying rooms or applying special properties.


This version will set the tag to be either True or False (this system could be expanded in future to allow for string or other object storage inside tags)
=== static boolean hasText(string textKey) ===
Returns


Tags are used in a number of game locations to keep track of types of places.  For instance, in the strip club, it is used to tag rooms where the patrons can see the player.
=== static void printText(string textKey ===


Parameters:
=== static string getText(string textKey ===
* roomID: room to change
* tag: tag name to change
* enabled: what to set tag state to (true/false)  (false is same as unset)


=== boolean getTagBoolean(int roomID, string tag) ===
=== static string getTextRaw(string textKey ===
Gets a boolean tag for a certain room.  False if room or tag does not exist, or is set to false.  True if it exists and is set to true.


=== int getRoomIDOfEntity([[Entity]] entity) ===
=== static void setTextOverride(string textKey ===  
Which room is a particular entity in?  If not found, then 0


=== string getName() ===
Name of the map
[[Category:LUA Class Reference]]
[[Category:LUA Class Reference]]

Revision as of 21:19, 29 December 2017

Game Text is a key-value dictionary that stores much of the game's text. Keys are all uppercase, containing no spaces, but do contain underscores.

There can be multiple dictionaries loaded, but it is expected that text keys are unique across all dictionaries, so multiple dictionaries are essentially one big dictionary. Currently there is one for private builds, one for public+privates builds, and an "override" dictionary which code can use to override dictionary values at run-time. In this way, AS3 or LUA code can change just about any string in the game. However, it is not recommended to change shared text in this way as multiple mods accessing the same text may conflict with each other, leading to unexpected results

Public Static Methods

static boolean hasText(string textKey)

Returns

static void printText(string textKey

static string getText(string textKey

static string getTextRaw(string textKey

static void setTextOverride(string textKey