StendhalScripting/LuaAPI: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
imported>AntumDeluge
quests.simple: add methods for SimpleQuest class
imported>AntumDeluge
entities: add descriptions
Line 170: Line 170:


Methods:
Methods:

* ''<span style="color:green">entities:getPlayer</span>(name)''
* ''<span style="color:green">entities:getNPC</span>(name)''
; ''<span style="color:green">entities:getPlayer</span>(name)''
: Retrieves a logged in Player.
* ''<span style="color:green">entities:getItem</span>(name)''
: '''''name:''''' (<code>String</code>) Name of player.
* ''<span style="color:green">entities:getStackableItem</span>(name)''
: ''returns:'' Logged in {{StendhalFile|master|src/games/stendhal/server/entity/player/Player.java|Player}} or <code>null</code>.
* ''<span style="color:green">entities:createSpeakerNPC</span>(name)''

* ''<span style="color:green">entities:createSilentNPC</span>()''
* ''<span style="color:green">entities:setPath</span>(entity, table, loop)''
; ''<span style="color:green">entities:getNPC</span>(name)''
: Retrieves an existing SpeakerNPC.
* ''<span style="color:green">entities:setPathAndPosition</span>(entity, table, loop)''
: '''''name:''''' (<code>String</code>) Name of NPC.
* ''<span style="color:green">entities:createSign</span>(visible)''
: ''returns:'' {{StendhalFile|master|src/games/stendhal/server/entity/npc/SpeakerNPC.java|SpeakerNPC}} instance or <code>null</code>.
* ''<span style="color:green">entities:createShopSign</span>(name, title, caption, seller)''

; ''<span style="color:green">entities:getItem</span>(name)''
: Retrieves a registered Item.
: '''''name:''''' (<code>String</code>) Name of the item.
: ''returns:'' {{StendhalFile|master|src/games/stendhal/server/entity/item/Item.java|Item}} instance or <code>null</code> if not a registered item.

; ''<span style="color:green">entities:getStackableItem</span>(name)''
: Retrieves a registered StackableItem.
: '''''name:''''' (<code>String</code>) Name of the item.
: ''returns:'' {{StendhalFile|master|src/games/stendhal/server/entity/item/StackableItem.java|StackableItem}} instance or <code>null</code> if not a registered stackable item.

; ''<span style="color:green">entities:createSpeakerNPC</span>(name)''
: Creates an interactive NPC.
: '''''name:''''' (<code>String</code>) Name of new NPC.
: ''returns:'' New {{StendhalFile|master|src/games/stendhal/server/entity/npc/SpeakerNPC.java|SpeakerNPC}} instance.

; ''<span style="color:green">entities:createSilentNPC</span>()''
: Creates a non-interactive NPC.
: ''returns:'' New {{StendhalFile|master|src/games/stendhal/server/entity/npc/SilentNPC.java|SilentNPC}} instance.

; ''<span style="color:green">entities:setPath</span>(entity, table, loop)''
: Helper method for setting an NPC's path.
: '''''entity:''''' (<code>RPEntity</code>) Then entity whose path is being set.
: '''''table:''''' (<code>LuaTable</code>) Table with list of coordinates representing nodes.
: '''''loop:''''' (<code>boolean</code>) If <code>true</code>, the entity's path should loop.

; ''<span style="color:green">entities:setPathAndPosition</span>(entity, table, loop)''
: Helper function for setting an NPC's path & starting position.
: '''''entity:''''' (<code>RPEntity</code>) Then entity whose path is being set.
: '''''table:''''' (<code>LuaTable</code>) Table with list of coordinates representing nodes.
: '''''loop:''''' (<code>boolean</code>) If <code>true</code>, the entity's path should loop.

; ''<span style="color:green">entities:createSign</span>(visible)''
: Creates a new {{StendhalFile|master|src/games/stendhal/server/entity/sign/Sign.java|Sign}} entity.
: '''''visible:''''' (<code>boolean</code>) (optional) If <code>false</code>, the sign will not have a visual representation.
: ''returns:'' New <code>Sign</code> instance.

; ''<span style="color:green">entities:createShopSign</span>(name, title, caption, seller)''
: Creates a new {{StendhalFile|master|src/games/stendhal/server/entity/sign/ShopSign.java|ShopSign}} entity.
: '''''name:''''' (<code>String</code>) The shop name.
: '''''title:''''' (<code>String</code>) The sign title.
: '''''caption:''''' (<code>String</code>) The caption above the table.
: '''''seller:''''' (<code>boolean</code>) <code>true</code>, if this sign is for items sold by an NPC (defaults to <code>true</code> if <code>null</code>).
: ''returns:'' New <code>ShopSign</code> instance.


== quests ==
== quests ==