Razor: Lumberjacking

Z Endor Revived Wiki

This script pulls wood while you move your character while also trying to cut down a tree to the west of your character every 2 seconds. This script allows you to chop down trees with minimal effort, you can watch Netflix on a second monitor while chopping wood at the same time, just avoid wildlife. 😊

Requirements

  • Keep a hatchet in your hand and preferably a couple of spare ones in your backpack.
  • Run to a place with trees that can be cut.

Script

// Lumberjacking
// version 1.0

if listexists 'lumber-loghues'
    removelist 'lumber-loghues'
endif
createlist 'lumber-loghues'

### start of configuration ###

# logs that will be dropped on the ground 
# and dragged behind
pushlist 'lumber-loghues' "0"

### end of configuration ###

if not timerexists 'lumber - check'
    createtimer 'lumber - check'
endif

while 1 = 1
    // try lumbering tree north of character
    if timer 'lumber - check' > 2000
        sysmsg 'Checking for tree..'

        setvar! 'lumber-lumbering' 1
        while varexist! 'lumber-lumbering'
            clearsysmsg 
        
            if not lhandempty or not rhandempty
                hotkey 'use item in hand'
            elseif findtype 3907 'backpack' as 'tool' or findtype 3908 'backpack' as 'tool'
                dress 'tool'
                wait 500
                dclick 'tool'
            else
                sysmsg 'No tool found'
                stop
            endif
            waitfortarget 
            targetrelloc 0 -1

            setvar! 'lumber-wait' 1
            while varexist! 'lumber-wait'
                // invalid tile/use
                if insysmsg "What do you want to do" or insysmsg "That is too far away"
                    unsetvar! 'lumber-wait'
                    unsetvar! 'lumber-lumbering'
                endif
                // lubering done
                if insysmsg "There's not enough wood here to chop." or insysmsg "You stop chopping."
                    unsetvar! 'lumber-wait'
                    unsetvar! 'lumber-lumbering'
                endif
                // try again
                if insysmsg "Your tool broke"
                    unsetvar! 'lumber-wait'
                endif
                wait 50
            endwhile
            wait 250
        endwhile

        // drop all logs
        @clearignore
        foreach loghue in 'lumber-loghues'
            while findtype 7133 'backpack' loghue as 'backpackstack'
                @ignore 'backpackstack'
                while findtype 7133 'backpack' loghue as 'otherstack'
                    @ignore 'otherstack'
                endwhile
                
                lift 'backpackstack' 0
                if findtype 7133 true loghue as 'groundstack'
                    sysmsg 'Dropping {{loghue}} to ground stack'
                    drop 'groundstack'
                else
                    sysmsg 'Dropping {{loghue}} to ground location'
                    droprelloc 0 0
                endif
                wait 100
                
                @clearignore
            endwhile
        endfor
        @clearignore
        
        settimer 'lumber - check' 0
    endif

    // drag logs
    sysmsg 'Dragging logs..'
    @clearignore
    foreach loghue in 'lumber-loghues'
        while findtype 7133 'backpack' loghue as 'stack'
            @ignore 'stack'
        endwhile
        
        // first stack
        unsetvar! 'lumbervacuumgroundstack';
        while findtype 7133 true loghue as 'stack'
            lift 'stack' 0
            if varexist! 'lumbervacuumgroundstack'
                drop 'lumbervacuumgroundstack'
            else
                droprelloc 0 0
                setvar! 'lumbervacuumgroundstack' 'stack'
            endif
            wait 50
            @ignore 'stack'
        endwhile
    endfor
    @clearignore
endwhile