I do not know what “end expected (to close at 3:5) at 13:1” means. I am using Lua.
My code is:
loop
local enemy = self:findNearestEnemy()
if enemy then
-- If it comes closer than 10 meters, cleave it!
local distance = self:distanceTo(enemy)
if distance > 10 then
self:attack(enemy)
-- Else, attack the "Chest" by name.
else
attack("Chest")
end