Forest Fire Dancing Issues


#1

I’m trying to beat the Forest Fire Dancing level (level 13 of Backwoods Forest if you include the arena). With just the starting code, it says for line 2 (just “loop”): “ReferenceError: pos is not defined”

This is the code without anything added (which brings up the error regardless):

loop
    local evilstone = self:findNearest(self:findItems())
    if evilstone then
        pos = evilstone.pos
        if pos.x == 34 then
            -- If the evilstone is on the left, go to the right side.
            
        else
            -- If the evilstone is on the right, go to the left side.
            
        end
    else
        -- If there's no evilstone, go to the middle.
        
    end
end

How would I be able to get this to go away? Tharin doesn’t do anything because of this. Thanks.


#2

Everything in Lua needs to be scoped.

Add local in front of pos.


#3

This error is gone, but now on line three it says:

“TypeError: Can’t read protected property: findNearestItem”

so there’s that


#4

You need to upgrade/downgrade your glasses.

If your glasses are too ‘good’, you need to use self:findNearest(self:findItems())

If your glasses aren’t good enough, you won’t have self:findNearestItem() or self:findNearest() or self:findItems()