Author Topic: Open Container with GumpWait  (Read 5272 times)

0 Members and 1 Guest are viewing this topic.

Offline SuperslayerTopic starter

  • Elite
  • *
  • *
  • Posts: 1006
  • Activity:
    0%
  • Reputation Power: 14
  • Superslayer barely matters.Superslayer barely matters.
  • Gender: Male
  • Well what do you drink? Not tea.
  • Respect: +43
  • Referrals: 0
    • View Profile
Open Container with GumpWait
« on: October 19, 2010, 12:17:45 AM »
0
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.

Quote
Open_Container(UO.BackpackID,"container gump",100,100)

Code: [Select]
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

Tags: OEUO