Quote:
Lovely post, I'd do my selling of the fish differently though
PHP Code:
temp.fish = {
"Salmon", 10,
"Trout", 15,
"Yada", 5
};
temp.saleamount = temp.fish.index( (selling fish name here, sent from the triggeraction) ) + 1;
|
The code you posted is wrong, actually. You'd need to do this (you forgot to take that index out of the array):
PHP Code:
temp.saleamount = temp.fish[temp.fish.index(fish) + 1];
My way is probably more efficient, however, since the engine isn't having to check through the array once to find the index, add one to the index, then loop through the array again to find the other index. However, it'd be such a miniscule difference it would work fine either way.