does any body know how to pass blind distance on javascript it annoys me. this is what i type in .
// Tell the wizard the distance to the coming ogres.
// This function finds the nearest enemy and returns the distance to it.
function nearestEnemyDistance() {
var enemy = hero.findNearestEnemy();
// If there is no enemy, the function returns 0.
var result = 0;
if (enemy) {
result = hero.distanceTo(enemy);
}
return result;
}
while (true) {
var enemyDistance = nearestEnemyDistance();
if (distance > 0)
hero.say(distance);
}
// Tell the wizard the distance to the coming ogres.
// This function finds the nearest enemy and returns the distance to it.
function nearestEnemyDistance() {
var enemy = hero.findNearestEnemy();
// If there is no enemy, the function returns 0.
var result = 0;
if (enemy) {
result = hero.distanceTo(enemy);
}
return result;
}
while (true) {
// Call nearestEnemyDistance() and
// save the result in the variable enemyDistance.
var enemyDistance = nearestEnemyDistance();
// If the enemyDistance is greater than 0:
var enemyDistance = nearestEnemyDistance();
if (hero.distanceTo > 0)
// Say the value of enemyDistance variable.
hero.say(distance);
}
// This function finds the nearest enemy and returns the distance to it.
function nearestEnemyDistance() {
var enemy = hero.findNearestEnemy();
// If there is no enemy, the function returns 0.
var result = 0;
if (enemy) {
result = hero.distanceTo(enemy);
}
return result;
}
while (true)
// Call nearestEnemyDistance() and
// save the result in the variable enemyDistance.
var enemyDistance = nearestEnemyDistance();
// If the enemyDistance is greater than 0:
if (enemyDistance > 0) {
// Say the value of enemyDistance variable.
hero.say(distance);
}
Is it a question? I don’t know what do you do on line 21 because the code has 20 lines.
No. Do you think I watch the forum all time and all post? If you want to ask me something, it’s better to use mentions and I’ll get a notification.