Lua functions

CreateWidgetRegion

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

Historical signature: CreateWidgetRegion(zone, version, region_name, env_name, grid_id, widget_id, dist)

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

Function: CreateWidgetRegion(zone, version, region_name, env_name, grid_id, widget_id, dist)

Description: Creates a scripted grid/widget region in the map selected for the supplied zone and client version. The call retains that original zone and region map while inserting the region. The widget's coordinates are read only from a fully loaded collision map; if that map or widget is unavailable, the region starts at coordinates (0, 0, 0).

Parameters:

  • zone (Zone) - Zone whose loaded region map receives the region.
  • version (uint32) - Client version used to select an inclusive version range, with the default map as fallback.
  • region_name (string) - Name of the new region and first script-name candidate.
  • env_name (string) - Environment name used as the next script-name candidate.
  • grid_id (uint32) - Grid to track.
  • widget_id (uint32) - Widget whose trigger and loaded position identify the region.
  • dist (float) - Distance threshold. Zero uses widget/grid tracking without a distance threshold.

Returns: true after insertion. An invalid zone or unavailable region map logs an error and returns no values (nil in an assignment).

The script search tries the region name, environment name, then default under RegionScripts/<zone>/. This function does not load a missing region map.

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.

CreateWidgetRegion(Zone, 0, "TestRegion", "", 924281492, 4117633379, 2.0)

Evidence: server/ZoneScripts/IsleRefuge1.lua:32; binding EQ2Emu_lua_CreateWidgetRegion.

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