I think letter or word is supposed to be in there
yeah because you did I<
put in word or letter there i think
For both of them this error occurs
dude for your loop put something like this
for(var i=0; i<word; i++)
I fixed it already before that, but There are so many ERRORS AAAAAHHHH. its okay. on line 28 I have a moveXY problem, even tho it wa already there when the level generated.
hero.moveXY(16 + chestIndex * 8, 36);
ok I now need to think
This was just an example from Deadpool198 not the actual code!
oooh. okay, give me a second to fix that up
@JoPro_8000 in your for loop it should be
i<word.length;
change your letter from letter= letterIndex[i]
to something like var currentIndex= letterIndex[i]
then in your if loop you should do
instead of word[i++]==letter
it should be this
if(currentIndex==letter){
return i
}
What is your current code?
Sorry guys I was offline for a while, but I fixed what @Falcons118 told me to do and here is my code now:
// You must to find the treasure.
// This function should return the index of a letter:
function letterIndex(word, letter) {
// Step through each letter as an index of the word.
for(var i=0; i<word.length; 1){
// Store a character from the word with the current index.
var currentIndex= letterIndex[i];
// If it is the required letter:
if (currentIndex==letter){
return i
}
// Then return the current index (number).
return index;
// If nothing, return a default value
return -1;
}
}
var ogreLetter = "z";
var shaman = hero.findByType("thoktar")[0];
// Find the index and use it for finding the treasure.
var chestIndex = letterIndex(shaman.id, ogreLetter);
hero.moveXY(16 + chestIndex * 8, 36);
Why are there 2 returns?
Change letter to orgeLetter
no dont change that to ogreLetter
Oh sorry, I have not done this level yet.
its ok I appreciate you trying to help
Hi, im still there
so did you try what I said?