The set of single-word function names (GetObjectLevel, NoticeSend, InventoryGetItemTable...) that point to Player / Item / Message... group functions; differences in return values.
What short function names are
Besides calling by group (Player.GetLevel(aIndex), Message.Send(...)...), the file Data\LuaAPI\System\Modules.lua defines an additional set of single-word names, for example GetObjectLevel(aIndex) or NoticeSend(...). These are global functions that only call back GameServer's functions, so either way works; the short names are convenient for writing quickly or porting old scripts.
The tables below are the commonly used names, cross-checked against Modules.lua. The full list is in that file itself (section "2. Short function names"); this file is managed by the system and should not be edited.
Differences to remember
- Many yes / no style functions in the short-name set return the number
1 / 0 instead of true / false (for example EffectCheck, InventoryDelItemIndex, MapCheckAttr). The corresponding group functions return true / false.
- The item table obtained with
InventoryGetItemTable has both sets of field names: GameServer's names (Skill, Luck, Option, Exc, Ancient, Harmony, Option380, SocketBonus, ExpireDate, Sockets) and the old names (Option1, Option2, Option3, NewOption, SetOption, JoHOption, 380Option, SocketOption1..5, SocketOptionBonus, DurationTime). An empty slot returns nil.
- Indexes start from 0 in some old names:
PartyGetMemberIndex(party, slot) takes slot from 0 (the group function Party.GetMember counts from 1).
- Gens system: the short names use
1 = Vanert, 2 = Duprian, the opposite of the values stored in GameServer (1 = Duprian, 2 = Vanert); the function GetObjectGensFamily converts back to match.
LogColor(color, text): color = 1 writes a red (error) log, other values write a normal log. RandomGetNumber(max) returns an integer from 0 to max - 1.
Table of commonly used names
Object / server
| Short name | Equivalent |
GetGameServerCode() | Server.GetCode() |
GetGameServerCurUser(), GetGameServerMaxUser() | Server.GetOnlineCount(), Server.GetMaxUser() |
GetGameServerVersion() | Server.GetVersion() |
GetMinUserIndex(), GetMaxUserIndex() | the 2 values of Object.GetUserRange() |
GetMinMonsterIndex(), GetMaxMonsterIndex() | the 2 values of Object.GetMonsterRange() |
GetObjectConnected, GetObjectType, GetObjectName, GetObjectClass | Object.GetConnectStatus, GetType, GetName, GetClass |
GetObjectMap, GetObjectMapX, GetObjectMapY | Object.GetMap, GetX, GetY |
GetObjectLife, GetObjectMaxLife, GetObjectMana, GetObjectMaxMana, GetObjectBP, GetObjectShield... | Object.GetPower / Object.GetMaxPower with POWER_LIFE, POWER_MANA, POWER_STAMINA, POWER_SHIELD |
SetObjectLife, SetObjectMaxLife, SetObjectMana... | Object.SetPower / Object.SetMaxPower |
GetObjectIndexByName(name) | Player.GetIndexByName |
GetMapName(map) | Map.GetName |
MapCheckAttr(map, x, y, attr) | Map.CheckAttr (returns 1 / 0) |
Character: read
| Short name | Equivalent |
GetObjectAccount, GetObjectAccountID, GetObjectPlayerID | Player.GetAccount, GetAccountID, GetCharacterID |
GetObjectLevel, GetObjectMasterLevel, GetObjectMajesticLevel, GetObjectToTalLevel | Player.GetLevel, GetMasterLevel, GetMajesticLevel, GetTotalLevel |
GetObjectLevelUpPoint, GetObjectMasterPoint, GetObjectMajesticPoint | Player.GetLevelUpPoint, GetMasterPoint, GetMajesticPoint |
GetObjectMoney, GetObjectReset, GetObjectRuud | Player.GetMoney, GetReset, GetRuud |
GetObjectPKCount, GetObjectPKLevel, GetObjectPKTimer | Player.GetPKCount, GetPKLevel, GetPKTimer |
GetObjectStrength, Dexterity, Vitality, Energy, Leadership | Player.GetStat(aIndex, STAT_*) |
GetObjectTotal*, GetObjectExtra*, GetObjectDefault* (the same 5 stats) | Player.GetTotalStat, GetAddStat, GetDefaultStat |
GetObjectAccountLevel, GetObjectAccountExpireDate | Player.GetVIP, Player.GetVIPExpire |
GetObjectIpAddress, GetObjectHardwareId, GetPlayerMac, GetPlayerSerial | Player.GetIP, GetHardwareId, GetMac, GetDiskSerial (the serial is returned as a string) |
GetObjectPartyNumber, GetObjectGuildNumber, GetObjectGuildName... | Player.GetPartyNumber, GetGuildNumber, GetGuildName... |
GetObjectDeathMap, GetObjectDeathMapX, GetObjectDeathMapY | The most recent death location (Player.GetDeathLocation), -1 if none yet |
GetObjectMasterReset, GetObjectLang | Always return 0 (the server has no Master Reset and only one language) |
Character: write and actions
| Short name | Equivalent |
SetObjectLevel, SetObjectMasterLevel, SetObjectMajesticLevel | Player.SetLevel, SetMasterLevel, SetMajesticLevel |
SetObjectMoney, ChangeObjectReset / SetObjectReset, SetObjectRuud | Player.SetMoney, SetReset, SetRuud |
SetObjectStrength... SetObjectLeadership | Player.SetStat(aIndex, STAT_*, value) |
UserCalcAttribute / CalculateCharacter, UserInfoSend, LevelUpSend | Player.ReCalc, Player.SendInfo, Player.SendLevelUp |
UserDisconnect, UserGameLogout | Player.Disconnect, Player.Logout |
MoveUser, MoveUserEx | Player.MoveGate, Player.MoveTo |
UserWarehouseOpen | Player.OpenWarehouse |
SetWindowText | Player.SetWindowText |
UserGetOptionTable, UserSetOptionTable | Player.GetOptionTable, Player.SetOptionTable |
PermissionCheck / Insert / Remove(aIndex, perm) | Temporary permissions (not saved): 1 move item, 2 sell, 3 buy, 4 use item, 5 drop, 6 pick up, 7 trade, 8 open personal store, 10 Cash Shop, 11 chat, 12 teleport; other numbers are invalid |
Messages, currency, log
| Short name | Equivalent |
NoticeSend, NoticeSendToAll, NoticeGlobalSend | Message.Send, Message.SendAll, Message.SendGlobal |
MessageSend, MessageSendToAll, ChatTargetSend | Message.Box, Message.BoxAll, Message.NpcSay |
CashShopGetPoint, CashShopAddPoint, CashShopSubPoint | Coin.Get, Coin.Add, Coin.Sub |
LogPrint(text), LogColor(color, text) | Log.Add, Log.AddC (when color = 1) |
CommandGetArgNumber, CommandGetArgString | Util.ArgNumber, Util.ArgString |
SQLAsyncQuery | DB.Query |
ConfigReadNumber(section, key, path), ConfigReadString, ConfigSaveString | Config.ReadNumber (default 0), Config.ReadString (default empty string), Config.SaveString |
Inventory and items
| Short name | Equivalent |
InventoryGetItemTable(aIndex, slot) | Player.GetItem + adds the old field names |
InventoryGetItemIndex, InventoryGetItemCount(aIndex, item, level) | The item code of the slot (-1 if empty) / Inventory.CountItem (default level -1 = any level) |
InventoryDelItemIndex, InventoryDelItemCount | Inventory.DeleteSlot, Inventory.DeleteItems (returns 1 / 0) |
InventoryGetFreeSlotCount, InventoryCheckSpaceByItem, InventoryCheckSpaceBySize | Inventory.FreeSlots, Inventory.HasSpaceForItem, Inventory.HasSpace |
InventoryGetWearSize, InventoryGetMainSize, InventoryGetFullSize | The values of Inventory.GetSizes() |
InventorySetItemTable(aIndex, slot, t) | Inventory.SetItem (also accepts the old field names) |
EventInventory*, MuunInventory* | Event inventory / Muun inventory: read and count items |
ItemGive, ItemDrop | Item.GiveBag, Item.DropBag (give / drop by item bag) |
ItemGiveEx, ItemDropEx, CreateItem, InsertItem_GremoryCase, InsertItem_GremoryCaseEx | Create an item with all attributes (long parameter list, see the comments in Modules.lua); converted to Item.Give / Item.GremoryAdd |
IsItem, IsSocketItem, IsElementalItem, IsPentagramItem, GetItemKindA | Item.IsValid, IsSocket, IsElemental, IsPentagram, GetKindA |
GetBagItemLevel, GetAncientOpt, GetRandomValue(max) | Item.RandomLevel, Item.RandomAncientOption, a random number 0..max-1 |
Monsters, effects, party
| Short name | Equivalent |
MonsterCreate(class, map, x, y, dir), MonsterCreateEx, MonsterDelete | Monster.Create (dir defaults to -1), Monster.CreateEx, Monster.Delete |
MonsterSummonCreate, MonsterSummonDelete | Player.SummonMonster, Player.KillSummon |
EffectAdd(aIndex, mode, effect, seconds) | Buff.Add; when mode = 1, seconds is the expiry timestamp (a point in time), not a number of seconds |
EffectDel, EffectCheck, EffectClear | Buff.Remove, Buff.Has (returns 1 / 0), Buff.Clear |
PartyGetMemberCount, PartyGetMemberIndex | Party.GetCount, Party.GetMember |
Unsupported placeholder names
The following names exist in Modules.lua but are not supported. Calling them raises the error name() is not supported by LuaAPI (it only stops the calling function, without affecting other modules):
GetObjectMaxNormalPoints, GetObjectPassword, GetObjectPersonalCode, EventInventorySetItemTable, EventInventoryDelItemIndex, EventInventoryDelItemCount, MuunInventorySetItemTable, MuunInventoryDelItemCount, AddItemBag, PartyCreate, PartyDelete, PartyAddMember, PartyDelMember, SendRgbChat.