[quote author=Nightmist link=topic=311.msg1660#msg1660 date=1153728991]
Haha im currently in a string of HCO runs so ill have to scrap the project until I finish the runs and can actually test the script. [/quote]
I couldn't imagine writing these scripts with only one character. I've got five.
My opinion is that if you don't like maps, then you should learn to like them.
It makes KoLmafia run more efficiently than large blocks of if-then-return statements. Plus, design-wise, it decouples your data from your implementation. This makes your code easier to follow and it increases reusability among the user community. For instance, if I write a function that manages my eating, you could say "I like the idea but I eat different things", and you could use the functionality but write your own data. Or you might say "Ooh! A map that associates food to fullness! I can use that in these six other scripts of mine!" in which case you're using the data but not the functionality. Maps. Love them.
Code:
int [item] food_fullness;
food_fullness[ $item[ grue egg omelette ]] = 4;
food_fullness[ $item[ hell ramen ]] = 6;
food_fullness[ $item[ hot wing ]] = 1;
# yadda yadda yadda
void all_you_can_eat()
{
boolean nearly_full = false;
foreach food in food_fullness
while ( !nearly_full && food_fullness[food] > 1 && item_amount( food ) > 0)
if ( !eat( 1, food ))
nearly_full = true;
foreach food in food_fullness
while ( food_fullness[food] == 1 && item_amount( food ) > 0)
if ( !eat( 1, food ))
return;
print( "You ran out of food and might not be full yet!" );
}