kaansoral/adventureland

Function to search a item in inventory by name

Yuji-Tako opened this issue · 1 comments

function searchInv(name)
{
for(var i = 0; i <= 41; i++)
if(character.items[i].name == name){
return i;
}
}

the problem I found was when character.items[] == null the function broke, I think the solution is to set that null as undefined

Hi @Yuji-Tako

Sorry for the very late reply

There's a locate_item function https://github.com/kaansoral/adventureland/blob/master/runner_functions.js#L198 - It returns -1 when the item is not found