ScriptUO

Official ScriptUO EasyUO Scripts => Script Snippets => Topic started by: camotbik on August 10, 2011, 03:47:44 PM

Title: open container, unload, get
Post by: camotbik on August 10, 2011, 03:47:44 PM
Code: [Select]
; Purpose: to open up a container
; usage: gosub open_container ID
; gosub open_container %storage
sub open_container
  set #lobjectid %1
  while #contID <> %1
  {
    event macro 17
    wait 20
  }
return

; Purpose: unload stuff from specific container to specific container
; usage: gosub unload Type ID ID
; gosub unload %loot #backpackid %storage
; gosub unload %loot %lootbag %storage
sub unload
  finditem %1 C_ , %2
    while #findcnt > 0
    {
      Exevent Drag #findid #findstack
      Exevent Dropc %3
      wait 20
      finditem %1 C_ , %2
    }
return


; Purpose: grab stuff from specific container
; usage: gosub get type ID ammount
; gosub get %pickaxe %storage 10
; gosub get %bandages %storage 100
sub get
  for %i 1 %3
  {
    finditem %1 C_ , %2
    if #findcnt > 0
    {
      if #findstack > 1
      {
        Exevent Drag #findid %3
        Exevent Dropc #backpackid
        wait 20
        return
      }
      else
      {
        Exevent Drag #findid #findstack
        Exevent Dropc #backpackid
        wait 20
      }
    }
  }
return
Title: Re: open container, unload, get
Post by: camotbik on August 11, 2011, 04:09:40 AM
A little addition. You could use unload as a primitive looter as well. for example
Code: [Select]
set %loot POF

_loop:
while ( #weight < ( #maxweight - 100 ) ) && #charghost = no
{
repeat
 wait 10
until #contname = container_gump && #conttype = YFM
set %body #contid
wait 10
gosub unload %loot %body #backpackid
}
goto _loop

sub unload
  finditem %1 C_ , %2
    while #findcnt > 0
    {
      Exevent Drag #findid #findstack
      Exevent Dropc %3
      wait 20
      finditem %1 C_ , %2
    }
return