StendhalScripting/LuaAPI: Difference between revisions
Content deleted Content added
imported>AntumDeluge →game: added "game:getZone(string)" method |
imported>AntumDeluge →game: add descriptions |
||
Line 66:
Methods:
* ''<span style="color:green">game:add</span>(npc)''▼
* ''<span style="color:green">game:add</span>(object)'' - Adds an object to the current zone.▼
* ''<span style="color:green">game:add</span>(creature, x, y)''▼
* ''<span style="color:green">game:remove</span>(npc)''▼
* ''<span style="color:green">game:remove</span>(object)''▼
* ''<span style="color:green">game:addGameEvent</span>(source, event, params)''▼
* ''<span style="color:green">game:setZone</span>(name)'' - Sets the current zone.▼
* ''<span style="color:green">game:setZone</span>(zone)''▼
* ''<span style="color:green">game:getZone</span>(rpobject)''▼
; ''<span style="color:green">game:
: Adds an {{MarauroaFile|master|src/marauroa/common/game/RPObject.java|RPObject}} instance to the current zone.
: '''''object:''''' Object to add.
: Adds an {{StendhalFile|master|src/games/stendhal/server/entity/npc/NPC.java|NPC}} instance to the current zone.
: '''''npc:''''' NPC to add.
: Adds a {{StendhalFile|master|src/games/stendhal/server/entity/creature/Creature.java|Creature}} instance to the current zone.
: '''''creature:''''' Creature to add.
: '''''x:''''' Horizontal position of where to add creature.
: '''''y:''''' Vertical position of where to add creature.
▲
:
: '''''object:'''''
:
: '''''npc:'''''
: Adds a new {{StendhalFile|master|src/games/stendhal/server/core/engine/GameEvent.java|GameEvent}}.
: '''''source:'''''
: '''''event:'''''
: '''''params:'''''
: Sets the current zone.
: '''''name:''''' String identifier for zone to be set as current zone.
: ''returns:'' <code>true</code> if zone was successfully set.
: Sets the current zone.
: '''''zone:''''' {{StendhalFile|master|src/games/stendhal/server/core/engine/StendhalRPZone.java|StendhalRPZone}} instance to set as current zone.
: ''returns:'' <code>true</code> if zone was successfully set.
: Retrieves the zone where <code>object</code> is located.
: '''''object:''''' The {{MarauroaFile|master|src/marauroa/common/game/RPObject.java|RPObject}} from which the zone should be retrieved.
: ''returns:'' {{StendhalFile|master|src/games/stendhal/server/core/engine/StendhalRPZone.java|StendhalRPZone}} or <code>null</code> if it doesn't exists
: Retrieves a zone by string ID.
: '''''zoneName:''''' Name of zone to retrieve.
: ''returns:'' {{StendhalFile|master|src/games/stendhal/server/core/engine/StendhalRPZone.java|StendhalRPZone}}
; ''<span style="color:green">game:setMusic</span>(filename, args)''
Line 93 ⟶ 127:
::: <span style="color:darkblue; font-style:italic;">radius:</span> The radius from which the music can be heard (default: 10000).
:
* ''<span style="color:green">game:getCreatures</span>()''▼
: '''''player:'''''
* ''<span style="color:green">game:getCreature</span>(clazz)''▼
: '''''zoneName:'''''
* ''<span style="color:green">game:getItems</span>()''▼
: ''returns:'' <code>boolean</code>
* ''<span style="color:green">game:getItem</span>(name)''▼
* ''<span style="color:green">game:modify</span>(entity)''▼
:
* ''<span style="color:green">game:getMessage</span>()''▼
: ''returns:'' An array of all available creatures.
: Retrieves a {{StendhalFile|master|src/games/stendhal/server/entity/creature/Creature.java|Creature}} instance.
: '''''clazz:''''' String name of the creature.
: ''returns:'' Creature or <code>null</code> if doesn't exist.
:
: ''returns:'' Array list of available items.
:
: '''name:'''
: ''returns:'' Item instance or <code>null</code> if doesn't exist.
:
: '''''entity:'''''
: Sends a private text to a player.
: '''''player:''''' Player to receive the message.
: '''''text:''''' Message text to send to player.
:
: ''returns:'' <code>String</code>
== entities ==
| |||