Home Wiki Codex Forum Donations Portal

Steam Lumberjacking

Discussion about the technical aspects of scripting. Ask about all issues involving your freelance projects here.

Steam Lumberjacking

Postby Blarog on Sat Jan 13, 2018 6:50 pm

EDIT : Managed an ugly workaround (eww) but if anyone got a better idea im down for it lol. (Ugly workaround in the code section below)

I am trying to make a lumberjacking macro for steam (so far it looks like this)
Code: Select all
if not findalias 'chopper'
  headmsg 'Select your chopping axe (must be equipped)'
  promptalias 'chopper'
endif
if not findalias 'shovelin'
  headmsg 'Select a shovel... yes, a shovel... ugly workaround'
  promptalias 'shovelin'
endif
if not listexists 'trees'
  createlist 'trees'
  pushlist 'trees' 0xce0 //walnut
  pushlist 'trees' 0xcd0 // pine
  pushlist 'trees' 0xcd3 //ash
  pushlist 'trees' 0xcd9 //cedar needle
  pushlist 'trees' 0xce6 //willow
  pushlist 'trees' 0xccd //tree
  pushlist 'trees' 0xcd0 //tree
  pushlist 'trees' 0xcd6 //cedar
  pushlist 'trees' 0xcd8 //cedar 2
  pushlist 'trees' 0xcdd //oak
  pushlist 'trees' 0xce3 //tree
endif
@clearjournal
for 0 to 'trees'
  useobject 'shovelin'
  waitfortarget 15000
  if direction == 0
    targettileoffset 0 -1 0 trees[]
  elseif direction == 1
    targettileoffset 1 -1 0 trees[]
  elseif direction == 2
    targettileoffset 1 0 0 trees[]
  elseif direction == 3
    targettileoffset 1 1 0 trees[]
  elseif direction == 4
    targettileoffset 0 1 0 trees[]
  elseif direction == 5
    targettileoffset -1 1 0 trees[]
  elseif direction == 6
    targettileoffset -1 0 0 trees[]
  elseif direction == 7
    targettileoffset -1 -1 0 trees[]
  endif
  pause 100
  while @injournal "can't mine that"
    pause 2000
    useobject 'chopper'
    waitfortarget 15000
    if direction == 0
      targettileoffset 0 -1 0 trees[]
    elseif direction == 1
      targettileoffset 1 -1 0 trees[]
    elseif direction == 2
      targettileoffset 1 0 0 trees[]
    elseif direction == 3
      targettileoffset 1 1 0 trees[]
    elseif direction == 4
      targettileoffset 0 1 0 trees[]
    elseif direction == 5
      targettileoffset -1 1 0 trees[]
    elseif direction == 6
      targettileoffset -1 0 0 trees[]
    elseif direction == 7
      targettileoffset -1 -1 0 trees[]
    endif
    if @injournal 'not enough wood'
      break
    endif
  endwhile
endfor


.. which KIND OF works, but every macro loop, it tries to target all the tree types. (which is why I put a pause at 75 instead of like 3000) My question is, would there be a way to make it so once it finds that its the "right" kind of tree in front of me, it stops cycling through the lists? I tried findtype but it doesn't find the trees since they are static objects. Tried about everything I thought of, but maybe someone will have a sudden insight when seeing this (its been a long week at work so maybe I am overlooking a tiny detail).

Would it be possible to "detect" when I start swinging my axe, so that would mean its targetting the right tree? My issue is that when it targets a tree from the list that isn't the tree in front of me, I get no journal error or anything, so I can't do a simple if @injournal 'whatever'...

I want to do it with steam because its kind of easy to tweak afterward (once I add the checks for weight then chopping all logs into boards > sending them into the wood keys), and welp, because I am a total newbie with EasyUO and I am not sure I want to spend dozens of hours delving into documentation to write something simple (but complex for a newb at that language).

If someone has an idea, I am all ears.
Blarog
Passer by
 
Posts: 3
Joined: Wed Dec 27, 2017 3:49 am

Return to Coding talk

Who is online

Users browsing this forum: No registered users and 0 guests