Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Salet character ====== The character object is available as ''salet.character''. It controls the character's inventory. On loading the game, Salet creates a new ''Character'' object automatically and erases the old values. On saving the game, Salet saves every value in ''salet.character'' that can be serialized (turned into text). ===== CoffeeScript properties ===== ==== inventory ==== An array of [[en:api:units|units]] - character inventory. Better not call it directly, there are methods for that. ===== CoffeeScript methods ===== ==== take ==== Adds a new [[en:api:units|unit]] to the character inventory (at the end) **Argument:** a unit, ''SaletUnit'' class ==== drop ==== Removes from the inventory a unit with given name. Returns ''true'' if the deletion was successfull; ''false'' if the unit is not found. **Argument:** name of the unit (''<unit>.name''), string. Mandatory argument. ==== has ==== Returns ''true'' if the character inventory has a unit with this name; ''false'' if it's not found. **Argument:** name of the unit (''<unit>.name''), string. Mandatory argument. ==== inv ==== Calls an ''inv'' action of the given unit. An action can be a function or a string. **Argument:** name of the unit (''<unit>.name''), string. Mandatory argument. ==== listinv ==== Returns a link in the form of ''<a href="{unit.name}">{unit.display}</a>''. The link text is a ''display'' property. When clicked on it, Salet will call the ''inv'' action of this unit. **Argument:** name of the unit (''<unit>.name''), string. Mandatory argument. {{tag>api}} en/api/character.txt Last modified: 2021/01/24 10:42by 127.0.0.1