Cant win on signal corpse level

so i played the signal corpse last week,i have
type the code correctly but when i play it i cant win at all, it so hard
to beat the goblin, i always died…there’s mah script (javascript)

loop {
var green = this.findFlag(“green”);
var black = this.findFlag(“black”);
var enemy = this.findNearestEnemy();

if (green) {
} else if (black) {
} else if (enemy && this.distanceTo(enemy) < 10) {


and really, i cant beat dis level!! i always die and die…i play for 1 weeks but no wins…
when the all goblin is dead and 1 big goblin left, i always out of time when i almost win
can you gimme the strategy how to win dis level?? or the script is wrong? but no errors…

else if ((black) && hero.isReady("cleave")) {

make sure to use the black flag for groups of enemies and the green flag for single big enemies.

walk to the healer if needed, maybe you need better sword/armor?