EatDrink.ash: Optimize your daily diet (and see how your old diet stacks up).

dj_d

Member
Good question - deleting and re-downloading them is harmless, and a good idea.

I'm still stumped on why your session log is printing a variable name (foo) instead of the contents of the variable. Makes this virtually impossible to debug.
 

Spiny

Member
Did some messing around. Moved the 3 map files into someplace else altogether to see if the script would abort, and it didn't. It just kept trucking merrily along finding nothing to consume and then dumped empty data files into the data folder. In the instructions where you download this script, at least as of last night, you state to put the data files into the scripts folder. I could not get "foo" to print out no matter what level of verbosity I tried. So I could not duplicate Banana's "foo"ness. This was tested with EatDrink.ash version 2.3. Btw, is there a way to make it so the script can be ran regardless of what case the script is called? ie eatdrink.ash does not work, but EatDrink.ash does.

-Spiny
 
Last edited:

Spiny

Member
Hm. This is very odd. Spiny, BL, what OSs are you using?

Which part is odd? :) The fact that the script did not abort without data files or that calling the script required case sensitivity?

I'm running Gentoo Linux x86_64.

Just to be clear, the v2.3 script works fine for me, at least while simulating. I haven't run it for the purpose of non-simulation. I was just intentionally trying different things to see if the word "foo" would appear somehow as it did for BL. The word "foo" never appeared.

Testing without any data files:

Code:
> Loading food records.
> filtering food based on level & availability
> calculating food values
> Choosing food to consume.
> If there are any favorites still in consideration, they'll be listed here:
> No food available that's good enough for you. Moving on.
> Writing out new food file
> Loading drink records.
> Filtering remaining drinks for level and availability.
> Calculating drink values.
> Choosing drink to consume.
> If there are any favorites still in consideration, they'll be listed here:
> No booze available that's good enough for you. Moving on.
> Calculating values for final drink.
> Choosing final drink to consume.
> If there are any favorites still in consideration, they'll be listed here:
> No final drink available that's good enough for you. Moving on.
> Writing out new drink file
> Loading spleen records
> filtering spleenables based on level & availability
> Getting prices and calculating total spleen scores
> Choosing spleenable to consume.
> If there are any favorites still in consideration, they'll be listed here:
> No final spleen available that's good enough for you. Moving on.
> Writing out new spleen file

-Spiny
 

dj_d

Member
I've never tested on a linux OS. It doesn't surprise me that it'd be case sensitive (since the underlying filesystem is) where it's not on Windows, and unfortunately, I don't think there's anything that can be done about it.

BL, corrupt data files are a good possibility. There may be a version of it tucked in /scripts or /data or some otther subdirectory that's not obvious as well. Try deleting all the data files and re-downloading.

I'm still stumped about the "foo" though.
 

Banana Lord

Member
Well it's working again! I have no idea why, I haven't changed anything.

I can help you with "foo". There's an option for removing verbosity in your script, I took it. Sorry, I should have thought of this earlier.

Code:
// Uncomment the print statement for moderate verbosity
void verbose(string foo)
{
  print("foo");
}

// Uncomment the print statement for extreme verbosity
void verbose2(string foo)
{
//  print("foo");
}
They're uncommented by default.

EDIT: I checked to see if having "foo" in comments was what stuffed up the script. It's not. Works fine with or without the comments.

EDIT2: Is it still worth re-downloading those files? If so how do I go about it? Where do I download them from, and where do I put them?
 
Last edited:

Spiny

Member
Well it's working again! I have no idea why, I haven't changed anything.

I can help you with "foo". There's an option for removing verbosity in your script, I took it. Sorry, I should have thought of this earlier.

Code:
// Uncomment the print statement for moderate verbosity
void verbose(string foo)
{
  print("foo");
}

// Uncomment the print statement for extreme verbosity
void verbose2(string foo)
{
//  print("foo");
}
They're uncommented by default.

For me the script starts out as you have them here, when I was trying to duplicate being spammed by "foo" I ran tests with both uncommented and both commented and as is. I never saw foo... I'm foo-less lol.

As for the case sensitivity in names of scripts... I really think that's a new thing, but I was looking over my scripts file and there are only 3 scripts there that have caps in their names and I don't use them very much so I can't say for certain. I suspect renaming them to lower case should work just fine as I'm more inclined to type them that way. But not going out of my way to test that presently ;)

-Spiny
 

dj_d

Member
No clue, but if it works, don't mess with it!

I think we discovered the problem of the mysterious "foo", though. You added quotes to it. It should be (and is, in the version here)
Code:
print(foo)
not
Code:
print("foo")
they're two very different things. :)
 

Banana Lord

Member
No clue, but if it works, don't mess with it!

I think we discovered the problem of the mysterious "foo", though. You added quotes to it. It should be (and is, in the version here)
Code:
print(foo)
not
Code:
print("foo")
they're two very different things. :)

Well, I certainly won't mess with it. I know they're different, I thought the point of that section was for control over verbosity? I quoted them, in line with the instructions, to reduce the amount of text the script threw up. Mainly because I was debugging some of my scripts.

But anyway, thanks for all your help. Even though you didn't technically fix it, you wrote the script that fixed itself, which is good enough for me!
 

dj_d

Member
I think there was some confusion between uncomment and quote. Commenting it out gives you terseness. Uncommenting (the default) gives you verbosity. Quoting gives you "foo" repeatedly, which is Less Useful. Glad it's working for you now, though, and with the "foo!" problem solved, the next round of debugging will be much easier. :)
 

Banana Lord

Member
I think there was some confusion between uncomment and quote. Commenting it out gives you terseness. Uncommenting (the default) gives you verbosity. Quoting gives you "foo" repeatedly, which is Less Useful. Glad it's working for you now, though, and with the "foo!" problem solved, the next round of debugging will be much easier. :)

Yeah, I did wonder about the "foo" thing. I thought it was odd since the rest of your script is so polished... OK, so how would the lines in question look "commented out"?
 

Heffed

Member
OK, I finally got my brain around giving this script a try again. (Real life intrudes...)

It's totally my fault for not watching the script more closely, but I think this statement is a bit misleading.

[*]Ready to turn over your daily diet? Fool! Run it again, choosing "false" for sim_only, and unleash havoc on your belly (and liver, and spleen).

Unless there is a purpose I'm unaware of for eating all your food and drinking yourself into a stupor so you can't actually use your newly gained adventures? (Perhaps that is the mentioned havoc?) ;)

I was a little bit concerned that it didn't mention to set overdrink to false as well as simulation, but I figured I did tell it I only wanted a drunkeness of 19, so I'll go with what the script author said to do. Unfortunately I was distracted when I told the script to run and didn't notice I had also drank my nightcap until I was consuming my spleen items.

Which brings me to another point. Why does the script make each purchase and consumption singly? Wouldn't it be easier on the server to make bulk purchases and consumption where applicable?

Nice script by the way! :D
 

dj_d

Member
Which part was misleading? The warning to use the script with caution? The explanation of what all the settings were? The variable called "overdrink" that made you overdrink? That it was set to "false" by default? The "sim" mode that let you see what it would do before you do it? The "sim" mode set to true by default to prevent exactly this sort of thing from happening?

I'm not sure I could have done much more to help you. :)

There are complex restrictions of kolmafia pricing and purchasing that make it optimal to calculate, buy, and consume one at a time. There's more of an explanation earlier in the thread.
 

Heffed

Member
Which part was misleading? The warning to use the script with caution? The explanation of what all the settings were? The variable called "overdrink" that made you overdrink? That it was set to "false" by default? The "sim" mode that let you see what it would do before you do it? The "sim" mode set to true by default to prevent exactly this sort of thing from happening?

I'm not sure I could have done much more to help you. :)

You know, I'm really not an idiot. :rolleyes:

The misleading part was exactly what I quoted. You say nothing about setting overdrink to false. The default state for overdrink is not false.

Even if I set eatdrink_suppressOverdrink to false in my vars file, the boolean selection dropdown defaults to true. (see attached screenshot)

As I said, the mistake was mine. I take full responsibility for my actions. I was unsure on some of the scripts operation so I decided when in doubt, follow the instructions to the letter, which turned out to have unexpected results.

I assumed the simulation was showing the nightcap as part of the total package budget, (meat cost, adventures, etc...) not that it would actually drink it as I had only set my drunkeness at 19.

Since your instructions didn't say anything about the overdrink setting in step four, I assumed it was irrelevant. We didn't tell the script to overdrink, so why should we care if the alert is suppressed?

I guess I'm unsure why the nightcap is even calculated when setting my drunkeness at 19? That should render the whole overdrink issue moot to begin with. Now if I had entered 25 drunkeness, that would be another story and I would expect the overdrink selection to come into play.

So yes, again it is my fault. Yes, you did make your disclaimers. Yes I should have paid more attention to what the script was doing, but quite frankly I was only following the instructions. Perhaps you could change step four to include setting overdrink to false as well as sim_only?

Hopefully this doesn't come across as angry, because I'm not.
 

Attachments

  • Default.png
    Default.png
    6.4 KB · Views: 55
Top