UO.LObjectID
From OpenEUO
UO.LObjectID
⇔ Returns the ID of the last used object. You can also write to this variable and use it in conjunction with UO.Macro(17) (LastObject), which will use the object as if it was double-clicked with the mouse.
Note: This variable is UO client dependent. Setting UO.LObjectID in one script will affect the variable as it is seen by all other scripts bound to that client. It is recommended to sanitize the variable by saving the existing value before overwriting it, then restoring the original value when the function is complete so as not to interfere with other potentially running scripts.