Lua functions

SetAccessToEntityCommandByCharID

Registered in this checkout as EQ2Emu_lua_SetAccessToEntityCommandByCharID; implementation found at WorldServer/Lua/LuaFunctions.cpp:13101.

Historical signature: SetAccessToEntityCommandByCharID(Spawn, CharID, CommandString, Allowed)

Parameter and behavior details in the historical explanation are under review against the current implementation.

Function: SetAccessToEntityCommandByCharID(Spawn, CharID, CommandString, Allowed)

Description: Sets a character's permission entry on a spawn's primary entity command, using its character ID rather than a live Player actor. The entry is used when listing the spawn's right-click commands for that character.

Parameters:

  • Spawn (Spawn) - Spawn owning the primary command.
  • CharID (uint32) - Nonzero character ID receiving the permission entry.
  • CommandString (string) - Exact primary command text to match.
  • Allowed (uint8) - 1 allows the command; other values store a denial.

Returns: true when the primary command was found and updated; false when it was absent. An invalid spawn or zero character ID produces no result.

Command lifetime: Lookup and permission publication are one mutation operation. A removed command cannot receive a detached descriptor write. Existing packet readers retain their immutable command version; later readers see the updated permission entry. See Lua actor lifetime.

Checked example

Active call in a local runtime Lua script. Argument count matches current fixed C++ readers. This is a contextual call pattern, not a tested standalone script.

SetAccessToEntityCommandByCharID(NPC, charID, "recovershard", true)

Evidence: server/SpawnScripts/Generic/SpiritShard.lua:16; binding EQ2Emu_lua_SetAccessToEntityCommandByCharID.

Current registration: WorldServer/Lua/LuaInterface.cpp. Historical explanation: EQ2Emu Lua documentation.