Code problem on Agrippa level - CoffeeScript

Hi guys, lately i started having fun with CodeCombat but it kicks me off with a code problem i can’t seem to solve

loop:
enemy = @findNearestEnemy()
if enemy
null # Replace this with your own code.
# Find the distance to the enemy with distanceTo.
distance = @distanceTo enemy
# If the distance is less than 5 meters…
if distance < 2
# … if “cleave” is ready, cleave!
if @isReady “cleave”
@cleave enemy
# … else, just attack.
else @attack

else
    @say "nice day"

it lights “# … if “cleave” is ready, cleave!” line and says:
Syntax error on line 5, column 9: unexpected ‘i’ (\u0069)
2 :
3 : loop:
4 : enemy = @findNearestEnemy()
5 : if enemy
^ : ^
6 : null # Replace this with your own code.
7 : # Find the distance to the enemy with distanceTo.
8 : distance = @distanceTo enemy

Could you help me pls? I’ve been stuck on this level for too long

1 Like

@Beny_Osu What programming language are you working with?

The first thing that comes to mind is to replace all of the “@” with “hero.” And that is the word “hero” followed by the dot “.”

@findNearestEnemy() then becomes hero.findNearestEnemy()

1 Like

Still nothing changes i think, code lights line “# … if “cleave” is ready, cleave!” and that’s all…

1 Like

@Beny_Osu which coding language are you playing in ?

Python?
LUA?

1 Like

Im using CoffeScript, also sometimes it shouts that i have unclosed ‘’’’’ at EOF and i don’t know what that means.

1 Like

@Beny_Osu I just loaded it in CoffeeScript, I see the issue.

Start with the following code instead

loop
    enemy = hero.findNearestEnemy()
    if enemy
        # Find the distance to the enemy with distanceTo.
        
        # If the distance is less than 5 meters...
        
            # ... if "cleave" is ready, cleave!
            
            # ... else, just attack.
            
        hero.say("Remove this line once your loop is finite.")
    else
        hero.say("So peaceful.")

Unfortunately you will most likely experience more issues with the code going forward. If you want, you can continue to post them here and I can work with you to start patching the levels. I believe the Coffeescript functionality is still in development. As it was not working for me about a month ago. But that doesn’t mean we can work on fixing things.

1 Like

Thanks! Worked this time :slight_smile:

1 Like