Items.name Shared function

From Gothic 2 Online: Wiki
Jump to navigation Jump to search

This function was added in version: 0.0.0.0

Function gets item name (instance) by it's id. Items must be registered in items.xml file, in order to be able to, for example: give item for specifc player.

NOTE! After server restart, every item does have different id. The id is the same on both sides. You should only use item id in functions, not in save eq, etc.

Syntax

string or null Items.name(int id)

Required Arguments

  • id: The item id.

Returns

  • string or null: string if item is registered in items.xml, otherwise null.

Example

addEventHandler("onInit",function(pid)
{
	local itemId = Items.id("ITMI_GOLD"))
        local itemName = Items.name(itemId) // dummy example
	print(itemName); // it will print ITMI_GOLD
};

Related functions