Difference between revisions of "GameObj"
(→Tips) |
|||
Line 18: | Line 18: | ||
* Obj variables should only contain data you are intending to persist to disk, especially since reading from an ObjVar immediately after setting it will not always return the new value. | * Obj variables should only contain data you are intending to persist to disk, especially since reading from an ObjVar immediately after setting it will not always return the new value. | ||
* GameObj can communicate between each other using [[SendMessage]] just like Modules. | * GameObj can communicate between each other using [[SendMessage]] just like Modules. | ||
+ | [[[[Category:Architecture]]]] |
Revision as of 21:55, 29 October 2016
Game Object (GameObj) is a Dynamic object within the game that can occupy a position of the world, including a container. Game Objects are the most common of all Objects and can have Variables and/or Modules attached to them.
A potion, a monster, a door, and a sword are all examples of GameObjs.
Object Variables
Object Variables are saved when a backup is performed. This means that after a full restart of the server, the GameObj will return to the state it was in during the backup.
gameObj:SetObjVar("Name", "Larry") name = gameObj:GetObjVar("Name")
gameObj:SetObjVar("SomeObjVarNameIChose", 53.2) aUserNum = gameObj:GetObjVar("SomeObjVarNameIChose")
You can save Numbers, Strings, Bools, and Tables in an ObjVar and can specify any String name of your choice.
Tips
- Obj variables should only contain data you are intending to persist to disk, especially since reading from an ObjVar immediately after setting it will not always return the new value.
- GameObj can communicate between each other using SendMessage just like Modules.
[[]]