Widget API

From WarCraft3

Jump to: navigation, search

This API allow you to read from and manipulate widgets.

The three types of widgets are units, items, and destructables.

Code

common.j

//============================================================================
// Widget API
native  GetWidgetLife   takes widget whichWidget returns real
native  SetWidgetLife   takes widget whichWidget, real newLife returns nothing
native  GetWidgetX      takes widget whichWidget returns real
native  GetWidgetY      takes widget whichWidget returns real
constant native GetTriggerWidget takes nothing returns widget
Confused? Jass help forum!

Using these natives when possible is faster than using a unit/item/destructable specific native.

Downcasting

The only way to downcast a widget (as this is needed in many cases when the only available event response is GetTriggerWidget) since patch 1.24b is to store it in a hashtable and retrieve it as a unit, item, or destructable.

Personal tools