[UOSteam] Lumber Harvesting System

If you make a Client-side script you can publish it here for other players to use
Post Reply
Ghurdo
Apprentice Scribe
Posts: 10
Joined: Fri Aug 03, 2018 10:36 pm

[UOSteam] Lumber Harvesting System

Post by Ghurdo »

This is a collection of three macros that I wrote to automate harvesting and storing lumber into Wood Worker's Keys.

The "Lumber" macro is designed to be an attended macro, but it is automated so that one can watch a movie while harvesting lumber. Simply walk around clicking on trees when the targeting cursor comes up. This macro handles chopping logs into boards and storing those boards into Wood Worker's Keys. It is intended to be a stand alone macro.

The "keys Wood" macro simply looks for and stores each appropriate item from your backpack into the Wood Worker's Keys.

The "Lumber Chop" helper macro simply chops all colors of logs into boards before calling the "keys Wood" macro to store them. It chops logs into boards and then calls macro "keys Wood" to store them.

These macros have been working well for me, but if you try them and have problems please let me know. I'll help.
- Ghurdo

MACRO: "Lumber"

Code: Select all

///////////////////////////////////////////////////////////////////
// Macro: Lumber
//
//  Written by: Ghurdo
//  Last Update: 3 August 2018
//
//  Automates the harvesting of trees. On use, you'll be given
//  a targetting cursor to select a tree to chop. Simply move to
//  and click on trees when you get a targetting cursor. Once chopping
//  the macro will continue chopping until the tree is depleted.
//  Simply target another tree to continue collecting resources.
//
//  When the backpack gets full, the macro will use a carpentry
//  saw to cut the various colored logs into boards and then
//  store those boards into the equipped wood worker's keys.
//  It recommended to equip a high use hatchet (1000+ uses) and
//  also have a high use carpentry saw.
//
//  Requires:
//     Wood Worker's Keys
//     Hatchet (high use or stack)
//     Carpentry 'Saw' (1000+ uses)
//
///////////////////////////////////////////////////////////////////
//
// Create an anti-spam message timer
if not timerexists 'timerMsg'
  createtimer 'timerMsg'
endif
settimer 'timerMsg' 9999
// Create a timer since last chop
if not timerexists 'timerLastChop'
  createtimer 'timerLastChop'
endif
settimer 'timerLastChop' 0
//
if @findtype 0xf43
  headmsg 'equipping a hatchet'
  pause 500
  @setalias 'choppingAxe' 'found'
  clearhands 'both'
  while dressing
  endwhile
  equipitem 'found' 2
  while dressing
  endwhile
elseif not @findobject 'choppingAxe'
  headmsg 'Target your hatchet.'
  promptalias 'choppingAxe'
endif
//
pause 500
//
while @findobject 'choppingAxe'
  @clearjournal
  @useobject 'choppingAxe'
  waitingfortarget 9999999
  while @findobject 'choppingAxe'
    //
    if timer 'timerMsg' > 4000
      if not targetexists
        headmsg '*chopping*'
        settimer 'timerMsg' 0
      endif
    endif
    //
    if timer 'timerLastChop' > 8000
      //headmsg '(macro stopped)' 48
      settimer 'timerLastChop' 0
      @canceltarget
      @clearusequeue
      replay
      //break
      //stop
    endif
    //
    if @injournal "You can't use an axe on that."
      settimer 'timerLastChop' 0
      //settimer 'timerMsg' 0
      break
    endif
    if @injournal "put some" or @injournal "found"
      settimer 'timerLastChop' 0
    endif
    if @injournal "There's not enough wood here to harvest."
      headmsg 'Out of wood! (move)' 48
      settimer 'timerLastChop' 0
      //settimer 'timerMsg' 0
      break
    endif
    if @injournal "That is too far away."
      @canceltarget
      @clearusequeue
      settimer 'timerLastChop' 0
      settimer 'timerMsg' 0
      break
    endif
    if @injournal "You broke your axe."
      //settimer 'timerMsg' 0
      headmsg "Axe Broke!" 48
      stop
    endif
    if @injournal "You hack at the tree for a while"
      settimer 'timerLastChop' 0
      //settimer 'timerMsg' 0
      pause 1000
      @clearjournal
      @useobject 'choppingAxe'
      waitfortarget 1500
      //targettilerelative 'self' 1 'false'
      targettile 'last'
    endif
    if weight > 400 or diffweight <= 25
      @canceltarget
      @clearusequeue
      pause 2500
      // saw?
      if not @findtype 0x1034 'any' 'backpack'
        headmsg 'no carpentry saw'
        sysmsg 'no carpentry saw'
        stop
      endif
      if @findtype 0x1034 'any' 'backpack'
        headmsg '*cutting boards*'
        @setalias 'carpentrySaw' 'found'
        @useobject 'carpentrySaw'
        //
        @removelist 'woodType'
        @createlist 'woodType'
        pushlist 'woodType' 'Plain'
        pushlist 'woodType' 'Pine'
        pushlist 'woodType' 'Ash'
        pushlist 'woodType' 'Mohogany'
        pushlist 'woodType' 'Yew'
        pushlist 'woodType' 'Oak'
        pushlist 'woodType' 'Zircote'
        pushlist 'woodType' 'Ebony'
        pushlist 'woodType' 'Bamboo'
        pushlist 'woodType' 'Purple Heart'
        pushlist 'woodType' 'Redwood'
        pushlist 'woodType' 'Petrified'
        pushlist 'woodType' 'Grade A'
        //
        @removelist 'woodColor'
        @createlist 'woodColor'
        pushlist 'woodColor' 0      //Log  (color: 0)
        pushlist 'woodColor' 1262   //Pine (color: 1262)
        pushlist 'woodColor' 961    //Ash (color: 961)
        pushlist 'woodColor' 355    //Mohogany (color: 355)
        pushlist 'woodColor' 1281   //Yew
        pushlist 'woodColor' 488    //Oak  (color: 488)
        pushlist 'woodColor' 1271   //Zircote (color: 1271)
        pushlist 'woodColor' 43     //Ebony (color: 43)
        pushlist 'woodColor' 1152   //Bamboo
        pushlist 'woodColor' 114    //Purple Heart
        pushlist 'woodColor' 37     //Redwood
        pushlist 'woodColor' 1153   //Petrified
        pushlist 'woodColor' 2494   //Grade A
        //
        @removelist 'woodButton'
        @createlist 'woodButton'
        pushlist 'woodButton' 6    // Log
        pushlist 'woodButton' 13   // Pine
        pushlist 'woodButton' 20    // Ash
        pushlist 'woodButton' 27    // Mohogany
        pushlist 'woodButton' 34    // Yew
        pushlist 'woodButton' 41    // Oak
        pushlist 'woodButton' 48    // Zircote
        pushlist 'woodButton' 55    // Ebony
        pushlist 'woodButton' 62    // Bamboo
        pushlist 'woodButton' 69    // Purple Heart
        pushlist 'woodButton' 76    // Redwood  (Next Page)
        pushlist 'woodButton' 83    // Petrified (Next Page)
        pushlist 'woodButton' 6    // Grade A
        //
        // start on the page with the 'boards'
        waitforgump 949095101 1000
        @replygump 0x38920abd 1
        //        waitforgump 949095101 1000
        //        @replygump 0x38920abd 2
        //
        for 0 in woodType
          if @findtype 0x1bdd woodColor[0] 'backpack'
            //sysmsg woodType[]
            waitforgump 949095101 1000
            @replygump 0x38920abd 7
            waitforgump 949095101 1000
            @replygump 0x38920abd woodButton[0]
            waitforgump 949095101 1000
            @replygump 0x38920abd 2
            waitforgump 949095101 1000
            //pause 1000
          endif
          poplist 'woodColor' 'front'
          poplist 'woodButton' 'front'
        endfor
        waitforgump 949095101 1000
        @replygump 0x38920abd 0
        //stop
        @removelist 'woodType'
        @removelist 'woodColor'
        @removelist 'woodButton'
      endif
      // store boards on the key
      @removelist 'woodNameList'
      @removelist 'woodGfxList'
      @removelist 'woodClrList'
      @createlist 'woodNameList'
      @createlist 'woodGfxList'
      @createlist 'woodClrList'
      //
      @pushlist 'woodNameList' 'Plain'
      @pushlist 'woodGfxList' 0x1bd7    //Plain
      @pushlist 'woodClrList' 0         //Plain
      //
      @pushlist 'woodNameList' 'Pine'
      @pushlist 'woodGfxList' 0x1bd7    //Pine
      @pushlist 'woodClrList' 1262      //Pine
      //
      @pushlist 'woodNameList' 'Ash'
      @pushlist 'woodGfxList' 0x1bd7    //Ash
      @pushlist 'woodClrList' 961       //Ash
      //
      @pushlist 'woodNameList' 'Mohogany'
      @pushlist 'woodGfxList' 0x1bd7    //Mohogany
      @pushlist 'woodClrList' 355       //Mohogany
      //
      @pushlist 'woodNameList' 'Yew'
      @pushlist 'woodGfxList' 0x1bd7    //Yew
      @pushlist 'woodClrList' 1281      //Yew
      //
      @pushlist 'woodNameList' 'Oak'
      @pushlist 'woodGfxList' 0x1bd7    //Oak
      @pushlist 'woodClrList' 488       //Oak
      //
      @pushlist 'woodNameList' 'Zircote'
      @pushlist 'woodGfxList' 0x1bd7    //Zircote
      @pushlist 'woodClrList' 1271      //Zircote
      //
      @pushlist 'woodNameList' 'Ebony'
      @pushlist 'woodGfxList' 0x1bd7    //Ebony
      @pushlist 'woodClrList' 43        //Ebony
      //
      @pushlist 'woodNameList' 'Bamboo'
      @pushlist 'woodGfxList' 0x1bd7    //Bamboo
      @pushlist 'woodClrList' 1152      //Bamboo
      //
      @pushlist 'woodNameList' 'Purple Heart'
      @pushlist 'woodGfxList' 0x1bd7    //Purple Heart
      @pushlist 'woodClrList' 114       //Purple Heart
      //
      @pushlist 'woodNameList' 'Redwood'
      @pushlist 'woodGfxList' 0x1bd7    //Redwood
      @pushlist 'woodClrList' 37        //Redwood
      //
      @pushlist 'woodNameList' 'Petrified'
      @pushlist 'woodGfxList' 0x1bd7    //Petrified
      @pushlist 'woodClrList' 1153      //Petrified
      //
      @pushlist 'woodNameList' 'Grade A'
      @pushlist 'woodGfxList' 0x1bd7    //Grade A
      @pushlist 'woodClrList' 2494      //Grade A
      //
      @pushlist 'woodNameList' 'Arrow'
      @pushlist 'woodGfxList' 0xf3f    //Arrow
      @pushlist 'woodClrList' 0        //Arrow
      //
      @pushlist 'woodNameList' 'Bolt'
      @pushlist 'woodGfxList' 0x1bfb   //Bolt
      @pushlist 'woodClrList' 0        //Bolt
      //
      @pushlist 'woodNameList' 'Feather'
      @pushlist 'woodGfxList' 0x1bd1   //Feather
      @pushlist 'woodClrList' 0        //Feather
      //
      @pushlist 'woodNameList' 'Shaft'
      @pushlist 'woodGfxList' 0x1bd4   //Shaft
      @pushlist 'woodClrList' 0        //Shaft
      //
      @pushlist 'woodNameList' 'Bark Fragment'
      @pushlist 'woodGfxList' 0x318f   //Bark Fragment
      @pushlist 'woodClrList' 0        //Bark Fragment
      //
      @pushlist 'woodNameList' 'Luminescent Fungi'
      @pushlist 'woodGfxList' 0x3191   //Luminescent Fungi
      @pushlist 'woodClrList' 0        //Luminescent Fungi
      //
      @pushlist 'woodNameList' 'Switch'
      @pushlist 'woodGfxList' 0x2f5f   //Switch
      @pushlist 'woodClrList' 0        //Switch
      //
      @pushlist 'woodNameList' 'Parasitic Plant'
      @pushlist 'woodGfxList' 0x3190   //Parasitic Plant
      @pushlist 'woodClrList' 0        //Parasitic Plant
      //
      // Add Items to the Keys
      if @findtype 0x176b 88 'backpack'
        @useobject 'found'
        waitforgump 173511501 1000
        @replygump 0xa57934d 60022
        waitforgump 173511501 1000
        //
        for 0 to 'woodNameList'
          while @findtype woodGfxList[0] woodClrList[0] 'backpack'
            @target 'found'
            //headmsg woodNameList[] 62
            sysmsg woodNameList[] 62
            waitforgump 173511501 1000
            // pause 150
          endwhile
          @poplist 'woodGfxList' 'front'
          @poplist 'woodClrList' 'front'
        endfor
        waitforgump 173511501 250
        @replygump 0xa57934d 0
        @canceltarget
      endif
      // cleanup
      @removelist 'woodNameList'
      @removelist 'woodGfxList'
      @removelist 'woodClrList'
      // resume chopping
      pause 2000
      settimer 'timerLastChop' 0
      @clearjournal
      @useobject 'choppingAxe'
      waitfortarget 1500
      targettile 'last'
    endif
    if @injournal "You put some"
      pause 1000
      settimer 'timerLastChop' 0
      @clearjournal
      @useobject 'choppingAxe'
      waitfortarget 1500
      targettile 'last'
    endif
  endwhile
endwhile
stop
MACRO: "keys Wood"

Code: Select all

///////////////////////////////////////////////////////////////////
// Macro: keys Wood
//
//  Written by: Ghurdo
//  Last Update: 10 July 2018
//
//  Automatically stocks the Wood Worker's Keys
//  from carried inventory.
//
//  Requires:
//     Wood Worker's Keys
//
///////////////////////////////////////////////////////////////////
//
if not @findtype 0x176b 88 'backpack'
  headmsg "Wood Worker's Keys" 44
  headmsg "not found" 44
  stop
endif
//
headmsg '(sorting wood)' 100
//
// establish the item lists
@removelist 'woodNameList'
@removelist 'woodGfxList'
@removelist 'woodClrList'
@createlist 'woodNameList'
@createlist 'woodGfxList'
@createlist 'woodClrList'
//
@pushlist 'woodNameList' 'Plain'
@pushlist 'woodGfxList' 0x1bd7    //Plain
@pushlist 'woodClrList' 0         //Plain
//
@pushlist 'woodNameList' 'Pine'
@pushlist 'woodGfxList' 0x1bd7    //Pine
@pushlist 'woodClrList' 1262      //Pine
//
@pushlist 'woodNameList' 'Ash'
@pushlist 'woodGfxList' 0x1bd7    //Ash
@pushlist 'woodClrList' 961       //Ash
//
@pushlist 'woodNameList' 'Mohogany'
@pushlist 'woodGfxList' 0x1bd7    //Mohogany
@pushlist 'woodClrList' 355       //Mohogany
//
@pushlist 'woodNameList' 'Yew'
@pushlist 'woodGfxList' 0x1bd7    //Yew
@pushlist 'woodClrList' 1281      //Yew
//
@pushlist 'woodNameList' 'Oak'
@pushlist 'woodGfxList' 0x1bd7    //Oak
@pushlist 'woodClrList' 488       //Oak
//
@pushlist 'woodNameList' 'Zircote'
@pushlist 'woodGfxList' 0x1bd7    //Zircote
@pushlist 'woodClrList' 1271      //Zircote
//
@pushlist 'woodNameList' 'Ebony'
@pushlist 'woodGfxList' 0x1bd7    //Ebony
@pushlist 'woodClrList' 43        //Ebony
//
@pushlist 'woodNameList' 'Bamboo'
@pushlist 'woodGfxList' 0x1bd7    //Bamboo
@pushlist 'woodClrList' 1152      //Bamboo
//
@pushlist 'woodNameList' 'Purple Heart'
@pushlist 'woodGfxList' 0x1bd7    //Purple Heart
@pushlist 'woodClrList' 114       //Purple Heart
//
@pushlist 'woodNameList' 'Redwood'
@pushlist 'woodGfxList' 0x1bd7    //Redwood
@pushlist 'woodClrList' 37        //Redwood
//
@pushlist 'woodNameList' 'Petrified'
@pushlist 'woodGfxList' 0x1bd7    //Petrified
@pushlist 'woodClrList' 1153      //Petrified
//
@pushlist 'woodNameList' 'Grade A'
@pushlist 'woodGfxList' 0x1bd7    //Grade A
@pushlist 'woodClrList' 2494      //Grade A
//
@pushlist 'woodNameList' 'Arrow'
@pushlist 'woodGfxList' 0xf3f    //Arrow
@pushlist 'woodClrList' 0        //Arrow
//
@pushlist 'woodNameList' 'Bolt'
@pushlist 'woodGfxList' 0x1bfb   //Bolt
@pushlist 'woodClrList' 0        //Bolt
//
@pushlist 'woodNameList' 'Feather'
@pushlist 'woodGfxList' 0x1bd1   //Feather
@pushlist 'woodClrList' 0        //Feather
//
@pushlist 'woodNameList' 'Shaft'
@pushlist 'woodGfxList' 0x1bd4   //Shaft
@pushlist 'woodClrList' 0        //Shaft
//
@pushlist 'woodNameList' 'Bark Fragment'
@pushlist 'woodGfxList' 0x318f   //Bark Fragment
@pushlist 'woodClrList' 0        //Bark Fragment
//
@pushlist 'woodNameList' 'Luminescent Fungi'
@pushlist 'woodGfxList' 0x3191   //Luminescent Fungi
@pushlist 'woodClrList' 0        //Luminescent Fungi
//
@pushlist 'woodNameList' 'Switch'
@pushlist 'woodGfxList' 0x2f5f   //Switch
@pushlist 'woodClrList' 0        //Switch
//
@pushlist 'woodNameList' 'Parasitic Plant'
@pushlist 'woodGfxList' 0x3190   //Parasitic Plant
@pushlist 'woodClrList' 0        //Parasitic Plant
//
// Add Items to the Keys
if @findtype 0x176b 88 'backpack'
  @useobject 'found'
  waitforgump 173511501 1000
  @replygump 0xa57934d 60022
  waitforgump 173511501 1000
  //
  for 0 to 'woodNameList'
    while @findtype woodGfxList[0] woodClrList[0] 'backpack'
      @target 'found'
      headmsg woodNameList[] 62
      waitforgump 173511501 1000
    endwhile
    @poplist 'woodGfxList' 'front'
    @poplist 'woodClrList' 'front'
  endfor
  //
  // check if 'Yumi' bow type is equipped
  if @findlayer 'self' 2
    if graphic 'found' == 0x27a5
      // withdraw some arrows to use
      @replygump 0xa57934d 60013
      waitforgump 173511501 1500
      //
    endif
  endif
  //
  //
  waitforgump 173511501 250
  @replygump 0xa57934d 0
  @canceltarget
endif
headmsg '(finished sorting)' 100
// cleanup
@removelist 'woodNameList'
@removelist 'woodGfxList'
@removelist 'woodClrList'
stop
// END
MACRO: "Lumber Chop"

Code: Select all

/////////////////////////////////////////////////////
// Lumber Chop
//
//     Written by: Ghurdo
//     Last Update: 10 July 2018
//
// Called By Macro:  Lumber
//
//  Chops all colors of boads in backpack and
//  stores the boards into the wood keys.
//
/////////////////////////////////////////////////////
//
// saw?
if @findtype 0x1034 'any' 'backpack'
  @setalias 'carpentrySaw' 'found'
  @useobject 'carpentrySaw'
  //
  @removelist 'woodType'
  @createlist 'woodType'
  pushlist 'woodType' 'Plain'
  pushlist 'woodType' 'Pine'
  pushlist 'woodType' 'Ash'
  pushlist 'woodType' 'Mohogany'
  pushlist 'woodType' 'Yew'
  pushlist 'woodType' 'Oak'
  pushlist 'woodType' 'Zircote'
  pushlist 'woodType' 'Ebony'
  pushlist 'woodType' 'Bamboo'
  pushlist 'woodType' 'Purple Heart'
  pushlist 'woodType' 'Redwood'
  pushlist 'woodType' 'Petrified'
  pushlist 'woodType' 'Grade A'
  //
  @removelist 'woodColor'
  @createlist 'woodColor'
  pushlist 'woodColor' 0      //Log  (color: 0)
  pushlist 'woodColor' 1262   //Pine (color: 1262)
  pushlist 'woodColor' 961    //Ash (color: 961)
  pushlist 'woodColor' 355    //Mohogany (color: 355)
  pushlist 'woodColor' 1281   //Yew
  pushlist 'woodColor' 488    //Oak  (color: 488)
  pushlist 'woodColor' 1271   //Zircote (color: 1271)
  pushlist 'woodColor' 43     //Ebony (color: 43)
  pushlist 'woodColor' 1152   //Bamboo
  pushlist 'woodColor' 114    //Purple Heart
  pushlist 'woodColor' 0x000 //Redwood
  pushlist 'woodColor' 0x000 //Petrified
  pushlist 'woodColor' 0x000 //Grade A
  //
  @removelist 'woodButton'
  @createlist 'woodButton'
  pushlist 'woodButton' 6    // Log
  pushlist 'woodButton' 13   // Pine
  pushlist 'woodButton' 20    // Ash
  pushlist 'woodButton' 27    // Mohogany
  pushlist 'woodButton' 34    // Yew
  pushlist 'woodButton' 41    // Oak
  pushlist 'woodButton' 48    // Zircote
  pushlist 'woodButton' 55    // Ebony
  pushlist 'woodButton' 62    // Bamboo
  pushlist 'woodButton' 69    // Purple Heart
  pushlist 'woodButton' 76    // Redwood  (Next Page)
  pushlist 'woodButton' 83    // Petrified (Next Page)
  pushlist 'woodButton' 6    // Grade A
  //
  for 0 in woodType
    if @findtype 0x1bdd woodColor[0] 'backpack'
      sysmsg woodType[]
      waitforgump 949095101 1000
      replygump 0x38920abd 1
      waitforgump 949095101 1000
      @replygump 0x38920abd 7
      waitforgump 949095101 1000
      @replygump 0x38920abd woodButton[0]
      waitforgump 949095101 1000
      @replygump 0x38920abd 2
      waitforgump 949095101 1000
      //pause 1000
    endif
    poplist 'woodColor' 'front'
    poplist 'woodButton' 'front'
  endfor
  waitforgump 949095101 1000
  @replygump 0x38920abd 0
  //
  @removelist 'woodType'
  @removelist 'woodColor'
  @removelist 'woodButton'
else
  sysmsg 'out of saws' 84
  sysmsg '(macro stopped)' 84
endif
//
playmacro 'keys Wood'
User avatar
Alamiester
Legendary Scribe
Posts: 279
Joined: Wed Jan 04, 2017 8:49 pm

Re: [UOSteam] Lumber Harvesting System

Post by Alamiester »

cool. ill havto try this out. see if it works better then mine, lol. you know you can call to other macros in the uosteam macro section? ive used it in several of mine and makes atonomous clicking much easier, like adding to keys, or just switching loops depending on the variables you define.
Post Reply