Chosen

From OpenEUO
Jump to: navigation, search

Calling Convention

Call

local a, b, c, r1..r4 = sl.chosen([timeout])

Args

timeout (optional) is the number of milliseconds to wait for UO.TargCurs to return to false

Results

a is the current state of UO.TargCurs
b is the amount of time transpired, in milliseconds
c is the current state of UO.LTargetKind, or 4 if UO.TargCurs is still true
r1 is UO.LTargetID iff UO.LTargetKind is 1
otherwise
r1 is UO.LTargetTile
r2 is UO.LTargetX
r3 is UO.LTargetY
r4 is UO.LTargetZ

Usage Example

local targ, time = sl.target(1500)
print(tostring(targ)..' '..tostring(time))
local a,b,c,d, = sl.chosen(5000)
print(a,b,c,d)
--> true 20
    false 630 1 2541

Description

Chosen compliments the target method; waiting for UO.TargCurs to toggle to false or timing out. Override timeout values are specified in milliseconds. The default timeout is 3 seconds. Chosen returns the current value of UO.TargCurs, the time elapsed (in ms) during the call, as well as the current value of UO.LTargetKind or the pseudo value 4 if the function timed out. IF UO.LTargetKind was 1, the UO.LTargetID is also returned, otherwise UO.LTargetTile, UO.LTargetX, UO.LTargetY, and UO.LTargetZ round out the return values.

Upon Error

A timeout argument which cannot be converted to a number is silently converted into the default timeout duration.

See Also