SOLVED Problem with Runebook Lumberjacking macro

Discussion about the technical aspects of scripting. Ask about all issues involving your freelance projects here.
Locked
Trithebest
Apprentice Scribe
Posts: 12
Joined: Fri Jun 03, 2016 6:12 pm

SOLVED Problem with Runebook Lumberjacking macro

Post by Trithebest »

Hi everyone,

I tried building a macro that teleports me from tree to tree while gathering the wood and putting it into a key when my weight is too high.

I took the body of a script someone else made that uses runebooks to mine from place to place, reference below;

http://www.uogamers.com/community/index ... ds/564098/

I also took a macro that I found that puts regs into a key, so I switched some stuff and now it puts wood into a key, reference below;

http://www.uoex.net/forum/viewtopic.php ... uos#p61117

and made a brand new for lumberjacking with a runebook, I've encountered a couple problems in the making as I am new to macros and all that stuff.

Here are my two problems;

1- When there is no more wood left in the tree, it seems as if the macro skips a rune from time to time and goes to the second one, rather than the next. It gives me the error known as '' replygump : gump id not found''

2- It only seems as if the macro uses the first of the three books I selected in the beginning rather than using all of them.

For the runes that this script uses, I marked runes 1 block East from each tree.

Here is the macro that I made, using UOSteam;

Code: Select all


if not @findobject 'OreBookOne'
  promptalias 'OreBookOne'
endif
if not @findobject 'OreBookTwo'
  promptalias 'OreBookTwo'
endif
if not @findobject 'OreBookThree'
  promptalias 'OreBookThree'
endif
if not listexists 'OreBook'
  createlist 'OreBook'
  pushlist 'OreBook' 'OreBookOne'
  pushlist 'OreBook' 'OreBookTwo'
  pushlist 'OreBook' 'OreBookThree'
endif
if not listexists 'Runes'
  createlist 'Runes'
  pushlist 'Runes' 7
  pushlist 'Runes' 17
  pushlist 'Runes' 27
  pushlist 'Runes' 37
  pushlist 'Runes' 47
  pushlist 'Runes' 57
  pushlist 'Runes' 67
  pushlist 'Runes' 77
  pushlist 'Runes' 87
  pushlist 'Runes' 97
  pushlist 'Runes' 107
  pushlist 'Runes' 117
  pushlist 'Runes' 127
  pushlist 'Runes' 137
  pushlist 'Runes' 147
  pushlist 'Runes' 157
endif
For 0 to 'OreBook'
For 0 to 'Runes'
useobject OreBook[]
waitforgump 0x554b87f3 5000
replygump 0x554b87f3 Runes[]
//tells you which rune you are on, see runelist above
sysmsg 'Rune' 33
sysmsg Runes[] 33
if @injournal 'This book needs time'
  pause 3000
endif
pause 500
clearjournal
pause 2500
while not @injournal 'enough wood here'
  //use pickaxe to northern tile until specified weight is reached
  pause 300
  useobject 'LeftHand'
  waitfortarget 1000
  targettileoffset -1 0 0
  // once weight is reached go home, if getting overweight, lower it
  if 'weight' > 400
    pause 1500
    //============================================================
    //=------------------Opens Woodworker's Keys----------------=
    //============================================================
    if not @findtype! '0x176b' '88' 'backpack'
      sysmsg '*****No Keys*****' '88'
      stop
    else
      @usetype! '0x176b' '88' 'backpack'
      waitforgump 173511501 15000
      replygump 0xa57934d 17
      waitfortarget '5000'
      pause 600
    endif
    //==============================================================
    //=------------Checks for Normal Logs and Puts in Keys---------=
    //==============================================================
    if not @targettype! '0x1bdd' '0'
    else
      @targettype! '0x1bdd' '0'
      waitfortarget '5000'
      pause 600
    endif
    //==============================================================
    //=------------Checks for Pine Logs and Puts in Keys----------=
    //==============================================================
    if not @targettype! '0x1bdd' '1262'
    else
      @targettype! '0x1bdd' '1262'
      waitfortarget '5000'
      pause 600
    endif
    //==============================================================
    //=------------Checks for Ash Logs and Puts in Keys----------=
    //==============================================================
    if not @targettype! '0x1bdd' '961'
    else
      @targettype! '0x1bdd' '961'
      waitfortarget '5000'
      pause 600
    endif
    //==============================================================
    //=------------Checks for Mahogany Logs and Puts in Keys----------=
    //==============================================================
    if not @targettype! '0x1bdd' '355'
    else
      @targettype! '0x1bdd' '355'
      waitfortarget '5000'
      pause 600
    endif
    //==============================================================
    //=------------Checks for Yew Logs and Puts in Keys----------=
    //==============================================================
    if not @targettype! '0x1bdd' '1281'
    else
      @targettype! '0x1bdd' '1281'
      waitfortarget '5000'
      pause 600
    endif
    //==============================================================
    //=------------Checks for Oak Logs and Puts in Keys----------=
    //==============================================================
    if not @targettype! '0x1bdd' '488'
    else
      @targettype! '0x1bdd' '488'
      waitfortarget '5000'
      pause 600
    endif
    //==============================================================
    //=------------Checks for Zircote Logs and Puts in Keys----------=
    //==============================================================
    if not @targettype! '0x1bdd' '1271'
    else
      @targettype! '0x1bdd' '1271'
      waitfortarget '5000'
      pause 600
    endif
    //==============================================================
    //=------------Checks for Ebony Logs and Puts in Keys----------=
    //==============================================================
    if not @targettype! '0x1bdd' '43'
    else
      @targettype! '0x1bdd' '43'
      waitfortarget '5000'
      pause 600
    endif
    //==============================================================
    //=------Checks for Purple Heart Logs and Puts in Keys---------=
    //==============================================================
    if not @targettype! '0x1bdd' '114'
      replygump 0x68557d42 0
      sysmsg '*****No Logs*****' '88'
      @canceltarget
    else
      @targettype! '0x1bdd' '114'
      waitfortarget '5000'
      pause 600
    endif
  endif
endwhile
pause 1500
endfor
UPDATE : Here is the macro you can use to test on a certain area to determine if it will target the trees correctly. As in some places the macro can't target the trees for a reason that I ignore.

Code: Select all

useobject 'LeftHand'
  waitfortarget 1000
  targettileoffset -1 0 0
Thanks,

Trithebest
Last edited by Trithebest on Sun Jul 31, 2016 1:42 pm, edited 2 times in total.
Kaddbar
Passer by
Posts: 2
Joined: Sat May 14, 2016 3:58 pm

Re: Problem with Runebook Lumberjacking macro

Post by Kaddbar »

Hi Trithebest,

Looks like a pretty good macro for a first try. I've made some improvements below with lots of notes to help teach, and put a clean version down below too. I went through two runebooks without missing one.. so it appears that's fixed.

Code: Select all

//Recalling LJ Script by Trithebeast
//Modifications and notes by Kaddbar
//Kadd: Reminder: The ANTI-AFK GUMP NOW ONLY HAS A ****ONE**** MINUTE DELAY. DO NOT AFK MACRO!
//Kadd: If you want to use more than three books, add additional alias prompts, and do not forget to pushlist them.
//Kadd: Clickable targeting of axe/hatchet and runebooks being used
if not @findobject 'hatchet'
  promptalias 'hatchet'
endif
if not @findobject 'BookOne'
  promptalias 'BookOne'
endif
if not @findobject 'BookTwo'
  promptalias 'BookTwo'
endif
if not @findobject 'BookThree'
  promptalias 'BookThree'
endif
//if not @findobject 'OreBookFour'
//  promptalias 'OreBookFour'
//endif
//Kadd: Creates a list of runes books for sequential use later
if not listexists 'TreeBook'
  createlist 'TreeBook'
  pushlist 'TreeBook' 'BookOne'
  pushlist 'TreeBook' 'BookTwo'
  pushlist 'TreeBook' 'BookThree'
  //pushlist 'TreeBook' 'BookFour'
endif
//Kadd: Creates a list of runes within the books using the Chivarly traveling spell. 5, 10, 15, 20, etc. can be used for Magery traveling
if not listexists 'Runes'
  createlist 'Runes'
  pushlist 'Runes' 7
  pushlist 'Runes' 17
  pushlist 'Runes' 27
  pushlist 'Runes' 37
  pushlist 'Runes' 47
  pushlist 'Runes' 57
  pushlist 'Runes' 67
  pushlist 'Runes' 77
  pushlist 'Runes' 87
  pushlist 'Runes' 97
  pushlist 'Runes' 107
  pushlist 'Runes' 117
  pushlist 'Runes' 127
  pushlist 'Runes' 137
  pushlist 'Runes' 147
  pushlist 'Runes' 157
endif
For 0 to 'TreeBook'
For 0 to 'Runes'
//Kadd: I think your rune skipping is most likely due to the rune book needing more time as I made it all the way through one book without issues. I added a timer function here to prevent recalling faster than every 6 seconds (book recharge time). Unfortunately to make this work, it requires a 10 second pause every time you start the script.
if not timerexists 'Bookrecharge'
  createtimer 'Bookrecharge'
  pause 10000
endif
if timer 'Bookrecharge' > 10000
  useobject 'TreeBook[]'
  waitforgump 0x554b87f3 5000
  replygump 0x554b87f3 Runes[]
  pause 1200
else
  pause 4000
  useobject 'TreeBook[]'
  waitforgump 0x554b87f3 5000
  replygump 0x554b87f3 Runes[]
endif
//tells you which rune you are on, see runelist above, 33 = red text color
//
//Kadd:Turns out this is why you're skipping runes, the sysmsg advances the runes list rather than just displaying what rune its on.
//
//sysmsg 'Book Number' 33
//sysmsg Treebook[] 33
//sysmsg 'Rune Number' 33
//sysmsg Runes[] 33
//
@clearjournal
//Kadd: Resets timer to 0
settimer 'Bookrecharge' 0
//Kadd: Added check to ensure axe/hatchet is equipped, if it's not equipped it would otherwise cause macro failure
@unsetalias 'found'
@findlayer 'self' 2
//Kadd: Removes anything in the left hand that isn't an axe/hatchet
if @serial 'found' != serial 'hatchet'
  @togglehands 'left'
  pause 300
endif
//Kadd: Equips axe/hatchet when nothing is equipped (empty hands), extra useful if Recall spell is used
if not @findlayer 'self' 2
  @equipitem 'hatchet' 2
  pause 600
endif
while not @injournal 'enough wood here'
  //use axe* to western* tile until specified weight is reached
  useobject 'LeftHand'
  waitfortarget 500
  //Kadd: Taergettileoffset does not work on all trees (not sure if this is facet based and/ore map section based, there is something wrong with the tile targeting system in both UOSteam and Razor, so make sure all your runes work for targeting by tile.
  targettileoffset -1 0 0
  //Kadd: Moved pause to delay using hatchet again down so it only activates after first attempt.
  pause 300
  //Kadd: Your key adding macro works all split up like that but it makes it unecessarily long. Here is a more efficient version, with notes. Note that weight > 400 can be adjusted, but 400 keeps you safe from overweight if you LJ in dangerous areas.
  if weight > 400
    //Kadd: Looks for logs by item type (all color logs are same item type) until no more of item type is found
    while @findtype 0x1bdd 'any' 'backpack'
      //Kadd: Uses Cyan keys
      usetype 0x176b 88 'backpack'
      waitforgump 173511501 2000
      //Kadd: Selects add resource
      replygump 0xa57934d 17
      waitforgump 173511501 2000
      waitfortarget 15000
      //Kadd: targets all log types
      @targettype! 0x1bdd 'any'
      pause 350
    endwhile
    //Kadd: closes key gump
    replygump 0xa57934d 0
    pause 350
    @canceltarget
  endif
endwhile
//Kadd: Removed unecessary pause
//  pause 1500
endfor
endfor

Code: Select all

//Recalling LJ Script initiated by Trithebeast
//Modifications by Kaddbar
//Reminder: The ANTI-AFK GUMP NOW ONLY HAS A ****ONE**** MINUTE DELAY.
//
//DO NOT AFK MACRO!
//
//Enjoy =)
//
if not @findobject 'hatchet'
  promptalias 'hatchet'
endif
if not @findobject 'BookOne'
  promptalias 'BookOne'
endif
if not @findobject 'BookTwo'
  promptalias 'BookTwo'
endif
if not @findobject 'BookThree'
  promptalias 'BookThree'
endif
//Remove "//" for additional book(s)
//if not @findobject 'OreBookFour'
//  promptalias 'OreBookFour'
//endif
if not listexists 'TreeBook'
  createlist 'TreeBook'
  pushlist 'TreeBook' 'BookOne'
  pushlist 'TreeBook' 'BookTwo'
  pushlist 'TreeBook' 'BookThree'
  //Remove "//" for additional book(s)
  //pushlist 'TreeBook' 'BookFour'
endif
//Rune numbers 5, 10, 15, 20, etc. can be used for Magery traveling
if not listexists 'Runes'
  createlist 'Runes'
  pushlist 'Runes' 7
  pushlist 'Runes' 17
  pushlist 'Runes' 27
  pushlist 'Runes' 37
  pushlist 'Runes' 47
  pushlist 'Runes' 57
  pushlist 'Runes' 67
  pushlist 'Runes' 77
  pushlist 'Runes' 87
  pushlist 'Runes' 97
  pushlist 'Runes' 107
  pushlist 'Runes' 117
  pushlist 'Runes' 127
  pushlist 'Runes' 137
  pushlist 'Runes' 147
  pushlist 'Runes' 157
endif
For 0 to 'TreeBook'
For 0 to 'Runes'
if not timerexists 'Bookrecharge'
  createtimer 'Bookrecharge'
  pause 10000
endif
if timer 'Bookrecharge' > 10000
  useobject TreeBook[]
  waitforgump 0x554b87f3 5000
  replygump 0x554b87f3 Runes[]
else
  pause 4000
  useobject TreeBook[]
  waitforgump 0x554b87f3 5000
  replygump 0x554b87f3 Runes[]
endif
pause 1200
@clearjournal
settimer 'Bookrecharge' 0
@unsetalias 'found'
@findlayer 'self' 2
if @serial 'found' != serial 'hatchet'
  @togglehands 'left'
  pause 300
endif
if not @findlayer 'self' 2
  @equipitem 'hatchet' 2
  pause 600
endif
while not @injournal 'enough wood here'
  useobject 'LeftHand'
  waitfortarget 500
  targettileoffset -1 0 0
  pause 300
  if weight > 400
    while @findtype 0x1bdd 'any' 'backpack'
      usetype 0x176b 88 'backpack'
      waitforgump 173511501 2000
      replygump 0xa57934d 17
      waitforgump 173511501 2000
      waitfortarget 15000
      @targettype! 0x1bdd 'any'
      pause 350
    endwhile
    replygump 0xa57934d 0
    pause 350
    @canceltarget
  endif
endwhile
endfor
endfor
Last edited by Kaddbar on Mon Jun 06, 2016 12:10 am, edited 1 time in total.
Trithebest
Apprentice Scribe
Posts: 12
Joined: Fri Jun 03, 2016 6:12 pm

Re: Problem with Runebook Lumberjacking macro

Post by Trithebest »

Thank you very much! I will check this out when I come back from work tonight :) I will send you a message.

Have a good day.
Locked