

This is a global built in package that provides global interfaces to token specific activities.
Only tokens which are placed into token containers are handled by these functions. Imagecontrols are currently the only valid token container objects.
Interface

getToken

function getToken(
containernodename, containerid
)
Gets the tokeninstance object referred to by the container node name and ID parameters.
Parameters
containernodename (string)
The database path identifier for the container node
containerid (number)
The ID of the token within the container node
Return values
(tokeninstance)
A
tokeninstance object representing the requested token, or
nil if the container does not exist or the ID is not valid.
onAdd

handler
function onAdd(
target
)
This handler is called when a token is added to a token container.
Parameters
target (tokeninstance)
onClickDown

handler
function onClickDown(
target, button
)
This handler is called when a mouse button is pressed down on a token.
Parameters
target (tokeninstance)
button (number)
Returns a numerical value indicating the button pressed (1 = left, 2 = middle, 4 = button 4, 5 = button 5). Right button is used for radial menus.
onClickRelease

handler
function onClickRelease(
target, button
)
This handler is called when a mouse button is released on a token.
Parameters
target (tokeninstance)
button (number)
Returns a numerical value indicating the button released (1 = left, 2 = middle, 4 = button 4, 5 = button 5). Right button is used for radial menus.
onContainerChanged

handler
function onContainerChanged(
target, oldcontainernode, oldcontainerid
)
This handler is called after a token is dragged from one container to another.
Parameters
target (tokeninstance)
oldcontainernode (databasenode)
A
databasenode object representing the underlying database node of the old container, or
nil if the no previous container found.
oldcontainerid (number)
The old ID of the token within the old container.
onDelete

handler
function onDelete(
target
)
This handler is called just before a token is deleted.
Parameters
target (tokeninstance)
onDoubleClick

handler
function onDoubleClick(
target
)
This handler is called when the left mouse button is double-clicked on a token.
Parameters
target (tokeninstance)
onDrop

handler
function onDrop(
target, dragdata
)
This handler is called when a drag and drop operation finishes on a token. The dragdata parameter should be used to access the dragged information.
To transfer information back to the object where the drag originated, the same dragdata object is passed to the onDragEnd function in that object.
Parameters
target (tokeninstance)
dragdata (dragdata)
A
dragdata object containing the state of values connected to the mouse cursor as part of a drag and drop operation.
onHover

handler
function onHover(
target, state
)
This handler is called when the hover state of a token changes.
Parameters
target (tokeninstance)
state (boolean)
true if the mouse is entering the area, false if leaving
onHoverUpdate

handler
function onHoverUpdate(
target, x, y
)
This handler is called when the mouse cursor is moved while over a token.
Parameters
target (tokeninstance)
x (number)
The X coordinate of the mouse pointer in pixels relative to the top left corner of the token
y (number)
The Y coordinate of the mouse pointer in pixels relative to the top left corner of the token
onScaleChanged

handler
function onScaleChanged(
target
)
This handler is called after a token's individual scale is changed.
Parameters
target (tokeninstance)
onTargetUpdate

handler
function onTargetUpdate(
target
)
This handler is called when the targeting information for a token is changed.
Parameters
target (tokeninstance)
onWheel

handler
function onWheel(
target, notches
)
This handler is called when the mouse wheel is spun over a token.
Parameters
target (tokeninstance)
notches (number)
This number specifies the number of notches the wheel was spun. Typically one notch corresponds to one adjustment step on the wheel.