The script is going into an infinite loop
I even bought some bottles and sent them to this character trying to break the loop but the script did not recognize the increase in owned amount. The script seemed to not use the new effective price; I am not sure how the new effective price is used.my session log said:> drink: At 0, consuming to 19.
> Loading drink map from Mafia's datafiles
> Filtering by type
> Filtering by level
> Finding prices
> Setting values
> Choosing drink to consume.
> <b>dusty bottle of Muscat</b> lev:1 gain:2.0 adv:6.0 musc:12.5 myst:12.5 mox:12.5 meat:200 own:0 value:1904
> Waiting to consume...
> Shopping for a dusty bottle of Muscat in 1 seconds
> budgeting 250 for 1 additional dusty bottle of Muscat. You have 7644843 meat. You have 0 in inventory already.
> Purchased 0 dusty bottle of Muscat for 0 meat.
> Tried to get 1 dusty bottle of Muscat but got 0. Pricing error.
> Setting new effective price to the greater of 250 and 251
> Failed to get dusty bottle of Muscat for a max price of 1.25*200=250.0
> FAIL: <b>dusty bottle of Muscat</b> lev:1 gain:2.0 adv:6.0 musc:12.5 myst:12.5 mox:12.5 meat:200 own:0 value:1904
> Choosing drink to consume.
...
> Choosing drink to consume.
> <b>dusty bottle of Muscat</b> lev:1 gain:2.0 adv:6.0 musc:12.5 myst:12.5 mox:12.5 meat:200 own:0 value:1904
> Waiting to consume...
> Shopping for a dusty bottle of Muscat in 1 seconds
> budgeting 250 for 1 additional dusty bottle of Muscat. You have 7644843 meat. You have 0 in inventory already.
> Purchased 0 dusty bottle of Muscat for 0 meat.
> Tried to get 1 dusty bottle of Muscat but got 0. Pricing error.
> Seen a problem with this one before at a price of 1066.
> Setting new effective price to the greater of 250 and 1068
> Failed to get dusty bottle of Muscat for a max price of 1.25*200=250.0
> FAIL: <b>dusty bottle of Muscat</b> lev:1 gain:2.0 adv:6.0 musc:12.5 myst:12.5 mox:12.5 meat:200 own:0 value:1904
> Choosing drink to consume.
> <b>dusty bottle of Muscat</b> lev:1 gain:2.0 adv:6.0 musc:12.5 myst:12.5 mox:12.5 meat:200 own:0 value:1904
> Waiting to consume...
> Shopping for a dusty bottle of Muscat in 1 seconds
> budgeting 250 for 1 additional dusty bottle of Muscat. You have 7644843 meat. You have 0 in inventory already.
2) Is because you are running an old version of mafia. The newest versions have this fixed in the mafia data file. The new script doesn't use the old data files, it uses mafia internals - so get the latest release!
I just ascended so don't have the skills available to test this case, but before I did it was giving me sensible results. I am running kolmafia version 7759 - Greenrider, are you using the .exe, which is out of date now?
// Minimal definitions of data for this example to work:
record con_rec
{
string name;
float value;
};
con_rec[int] bestByFullness;
// Some dummy data to work with:
bestByFullness[1] = new con_rec("nice cold beer (1)", 1000.0);
bestByFullness[2] = new con_rec("dusty bottle of dust (2)", 6000.0);
bestByFullness[3] = new con_rec("bottle of paint thinner (3)", 9000.0);
bestByFullness[4] = new con_rec("garnished varnish (4)", 13000.0);
//bestByFullness[6] = new con_rec("tiny plastic corpsedrink (6)", 18000.0);
// Solve a general integer knapsack problem:
// Find the combination of items from bestByFullness,
// that have the greatest total value,
// with no more than the specified total fullness.
// Return value is an int[int] map:
// keys are the NEGATIVE of fullness (so that bigger items iterate first),
// values are the number of items of that fullness to consume.
int[int] knapsack(int remainingFullness)
{
float[int] values;
int[int] fulls;
values[0] = 0.0;
fulls[0] = 0;
// For each level of fullness, find the best final item to achieve it.
// The value achievable by an item is the value of the item,
// plus the (previously calculated) best value achievable at a
// lesser fullness level: the considered fullness minus the item's fullness.
for full from 1 upto remainingFullness {
float bestValue = 0.0;
int bestFull = 0;
foreach itemFull, itemRec in bestByFullness {
if (itemFull <= 0 || itemFull > full) continue;
float value = itemRec.value;
float prev = values[full - itemFull];
if (value + prev > bestValue) {
bestValue = value + prev;
bestFull = itemFull;
}
}
values[full] = bestValue;
fulls[full] = bestFull;
}
// Now that we know the best final items at each fullness level,
// backtrack through them to determine the entire set of items.
int[int] result;
while (remainingFullness > 0) {
int full = -fulls[remainingFullness];
if (full == 0) break;
result[full] = result[full] + 1;
remainingFullness = remainingFullness + full;
}
return result;
}
// Testing code.
// Note that with the sample values, a 3-full plus a 2-full item
// give a greater value than 4-full plus 1-full; the greedy
// algorithm of always choosing the largest item would therefore
// produce suboptimal results in some cases.
for i from 1 to 20 {
print("");
print("To achieve " + i + " fullness:");
int[int] result = knapsack(i);
if (count(result) == 0 ) {
print("(nothing suitable)");
continue;
}
foreach fullness, qty in result {
print("...consume " + qty + " " + bestByFullness[-fullness].name);
}
// In actual use, the first item in the map would be acquired
// (in the indicated quantity), whatever quantity was actually
// acquired would be consumed, and then the whole calculation
// would start over with whatever state that left you in.
}
Greenrider: "7757 - fix consumption stats for elven moonshine. RSS Bot"
12: twinkly wad lev:6 gain:1.0 adv:1.0 musc:9.0 myst:9.0 mox:9.0 meat:229 own:100 value:71
Choosing spleen to consume.
Waiting to consume...
twinkly wad lev:6 gain:1.0 adv:1.0 musc:9.0 myst:9.0 mox:9.0 meat:229 own:100 value:71
Countdown: 1 second...
Waiting completed.
You have at least one twinkly wad in inventory.
Countdown: 1 second...
Waiting completed.
Using 1 twinkly wad...
You gain 1 Adventure
You gain 8 Beefiness
You gain 11 Wizardliness
You gain 9 Cheek
You acquire an effect: Aspect of the Twinklefairy (duration: 10 Adventures)
Finished using 1 twinkly wad.
13: twinkly wad lev:6 gain:1.0 adv:1.0 musc:9.0 myst:9.0 mox:9.0 meat:229 own:100 value:71
Equipment changed.
(usable quantity of rockin' wagon is limited to 0 by inebriety)
Putting on General Sage's Lonely Diamonds Club Jacket...
Equipment changed.
FAIL: [B]rockin' wagon[/B] lev:4 gain:4.0 adv:12.0 musc:0.0 myst:0.0 mox:35.0 meat:1700 own:0
value:7335
Internal checkpoint created.
Putting on tuxedo shirt...
Equipment changed.
(usable quantity of rockin' wagon is limited to 0 by inebriety)
Putting on General Sage's Lonely Diamonds Club Jacket...
Equipment changed.
FAIL: [B]rockin' wagon[/B] lev:4 gain:4.0 adv:12.0 musc:0.0 myst:0.0 mox:35.0 meat:1700 own:0
value:7335
Internal checkpoint created.
Putting on tuxedo shirt...
Equipment changed.
1) That's because it hasn't included the effects of milk of magnesium properly at that stage so doesn't eat the first chow mein until it's reassessed its value. There should probably be a different message to FAIL in this case!
eatdrink.ash still plays well with an older version..> call scripts\Ascend.ash
Undefined reference to function 'eatdrink' (Ascend.ash, line 61)
So I'm still a bit confused by why the script buys a chow mein every day and then decides not to consume it, giving me that FAIL message. Is this a bug, or am I doing something wrong?
This is pretty much what's happening to me but instead of a chow mein it buys me a rockin' wagon and gives me the fail message as per my previous post.
I'm now on build 7772 if that makes a difference.
I just checked this - the version in the first post doesn't include the fix to that issue that I posted last. Not sure how that happened! Sorry. My fix was here:
http://kolmafia.us/showpost.php?p=19230&postcount=259
Choosing drink to consume.
Shopping for a rockin' wagon in 0 seconds
budgeting 1500 for 1 additional rockin' wagon. You have 35584389 meat. You have 0 in inventory already.
Using cached search results for rockin' wagon...
[COLOR=red]Stopped purchasing rockin' wagon @ 1,700.[/COLOR]
Purchased 0 rockin' wagon for 0 meat.
Tried to get 1 rockin' wagon but got 0. Pricing error.
Seen a problem with this one before at a price of 1844.
Setting new effective price to the greater of 1500 and 1846
Failed to get rockin' wagon for a max price of 1.25*1200=1500.0
FAIL: [B]rockin' wagon[/B] lev:4 gain:4.0 adv:12.0 musc:0.0 myst:0.0 mox:35.0 meat:1200 own:0
value:7735
Choosing drink to consume.
Shopping for a rockin' wagon in 0 seconds
budgeting 1500 for 1 additional rockin' wagon. You have 35584389 meat. You have 0 in inventory already.
Using cached search results for rockin' wagon...
[COLOR=red]Stopped purchasing rockin' wagon @ 1,700.[/COLOR]
Purchased 0 rockin' wagon for 0 meat.
Tried to get 1 rockin' wagon but got 0. Pricing error.
Seen a problem with this one before at a price of 1845.
Setting new effective price to the greater of 1500 and 1847
Failed to get rockin' wagon for a max price of 1.25*1200=1500.0
FAIL: [B]rockin' wagon[/B] lev:4 gain:4.0 adv:12.0 musc:0.0 myst:0.0 mox:35.0 meat:1200 own:0
value:7735
Choosing drink to consume.