Simple functions to open a container, wait for it to open, and then place it where you tell it to. The gump wait timer is set to 3 seconds and returns false if the container does not need to be reopened.
4 parameters to pass to the function, 2 are optional. Will default to 0,0 if no position is given. There's no hardcore checks for proper variable types passed, but probably won't work if it's not correctly placed. Example below on how it's used.
Open_Container(UO.BackpackID,"container gump",100,100)
function Open_Container(C1,C2,x1,y1)
-- Arg1 = Container id
-- Arg2 = Container name
-- Arg3 = contposX
-- Arg4 = contposY
if x1 == nil and y1 == nil then do end
x1,y1 = 0,0
end
ContDelay = math.abs(getticks() + 3000)
ContOpen = true
while ContOpen == true do
UO.LObjectID = C1
UO.Macro(17,0)
Gump_Wait(C2)
end
UO.ContPosX,UO.ContPosY = x1,y1
end
function Gump_Wait(C2)
-- Arg1 = Gumpname
repeat
wait(50)
until UO.ContName == C2 or getticks() > ContDelay
if UO.ContName == C2 then do
ContOpen = false
wait(250)
return true
end
else do end
return false
end
end