Live with what you have...

itamaram

Member
Is there any command for ash scripting which eats/drinks whatever you have in your inventory? Eating alphabetically or by any other order is fine. Just wondering about possible functions...
 

Nightmist

Member
[quote author=itamaram link=topic=311.msg1659#msg1659 date=1153727556]
Is there any command for ash scripting which eats/drinks whatever you have in your inventory? Eating alphabetically or by any other order is fine. Just wondering about possible functions...
[/quote]

Not a built in function but you can construct either a huge list of "if" and such commands or a ASH map that lists food and possibly the respective fullnesses (If you dont want to utterly waste the server and brute force your attempts) and then loop a function which runs down the map item by item.

If you want I can post my "Item Reference" ASH map for the booze//food in the redepository if you want me. Reference meaning if you throw in a int it throws back a item name, so having a looped script which increases that int it throws in by 1 each cycle will throw out a different item name each time until it runs out of items. (Or I can turn it into a mass of "If + return" commands if you dislike maps.)


[Semi-Unrelated Ramble]
I personally currently have a Eating//Drinking script which is in experimental stages which is "suppose to" eat//drink to "max" (Or just below max for booze) with the objective of maxing one of the stats or for the most adventures and will also factor in adventure's needed to create the items if needed (As in actually creating the items not like farming the items since it only uses items in your inv). 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. (Heh mainly private testing >>, the ASH maps I use are free for all if anyone requests them though, kind of out of date though...)
[/Semi-Unrelated Ramble]
 

Tirian

Member
[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]

:eek: 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. :p 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!" );
}
 

arrggg

Member
[quote author=Tirian link=topic=311.msg1662#msg1662 date=1153777021]
:eek: 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. :p 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.

[/quote]

fixed (I hope)

( that was rather long to put in the post, so I have attached it as a file... -Daychilde )
 

Attachments

  • script.ash
    9.2 KB · Views: 68

Veracity

Developer
Staff member
Is this a Crosby Stills Nash and Young script? :)

"If you can't have what you live, honey
Live with what you have!"
 
Top