Zoo Keeper: bug/level help? [Solved]

This is my code:

points = []
points[0] = {"x": 33, "y": 42}
points[1] = {"x": 47, "y": 42}
points[2] = {"x": 33, "y": 26}
points[3] = {"x": 47, "y": 26}
while hero.gold < 80:
    item = hero.findNearestItem()
    hero.move(item.pos)
for i in range(4):
    hero.summon("soldier")
while True:
    friends = hero.findFriends()
    for j in range(len(friends)):
        point = points[j]
        friend = friends[j]
        enemy = friend.findNearestEnemy()
        if enemy and enemy.team == "ogres" and friend.distanceTo(enemy) < 5:
            hero.command(friend, "attack", enemy)
            pass
        elif friend:
            hero.command(friend, "move", {"x" : point.pos.x, "y" : point.pos.y})
            pass

it says point.pos.x is undefined, right here:

        elif friend:
            hero.command(friend, "move", {"x" : point.pos.x, "y" : point.pos.y})

even though it is defined, here:

    for j in range(len(friends)):
        point = points[j]

and i have tried defining it again and also using point.pos (which says target an x : number y : number position). nothing works even though it should.

        elif friend:
            point = points[j]
            hero.command(friend, "move", {"x" : point.pos.x, "y" : point.pos.y})
        elif friend:
            hero.command(friend, "move", point.pos)

This probably won’t work but what if you try point.x and point.y.

i will try it, but i know without trying it in the first place point.x will be seen as an error because you arent telling the game that you want ‘x’ from point’s position.

NEVERMIND. apparently because point is a position point.x does work my logic is flawed

Thank you. @Shlomo 20 chars

@R_Ross You can see here that you don’t actually specify "pos" anywhere.
To say point.pos.x you would have to do this.

points[0] = {"pos": "x": 33, "y": 42}
points[1] = {"pos": "x": 47, "y": 42}
points[2] = {"pos": "x": 33, "y": 26}
points[3] = {"pos"": x": 47, "y": 26}

thanks 20 characters

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.