Drop the Flag Java issues

First of all, I don’t like the Ambassador tag on a post that is just “please help me” on a very first post.

I invite you to read FAQ, which invite you to be read before posting. It really helps for people who might want to help to read a well formated code. There :

loop{
    var flag = self.findFlag()
    if flag{
        this.buildXY("fire-trap",30, 46)
        this.buildXY("fire-trap",30, 30)
        this.buildXY("fire-trap",30, 16)
        this.pickUpFlag(flag)
    }
    else{
        var if item:
        var itemX = pos.x it says pos is not defined
        var itemY = pos.y
        self.moveXY(itemX, itemY)
    }
}

First of all, self doesn’t exist in JavaScript. You want to use this.findFlag() and this.moveXY()
2) All semi colons are missing at the end of every statements.
3) var if item: is a very weird statement in which I think you want to to define a variable named item, but fails to do so.

  1. pos can’t be used on its own as it is a method. It needs something to be applied to. In your case : item.

    var itemX = item.pos.x ;
    var itemY = item.pos.y ;

Hope this helps.