Closeting Meat command

GoldenRatio

New member
What's up everyone. Sorry if this has been answered before, but it's bugging the crap out of me. I am a programmer by trade, and it's a little embarrasing but seriously I've tried everything, searched KoL forums (in the KoLMafia thread), searched this site, thoroughly read all the help/manual files and even tried every random thing I could think of, all to no avail. I read in the Mafia thread that this functionality is supposed to be there, yet I can't get it to work.

I have a really nice script, however the script is fine so I will not post it unless asked, however at the end I want to check if my meat is over x amount, and if so, put x amount in the closet.

put_closet(10,$item[meat]); (ASH)
closet put 10 meat (CLI)

don't work. i've tried many variations of that CLI one to no avail, as well as plenty of random stuff in ASH. I feel like such a noob, especially because it's my first post, but I just have to figure this out.

Thanks

aL
 

Tirian

Member
Doesn't seem to be a feature.

You've got two choices. The first is to roll your own functions by building URLS like

closet.php?pwd&amt=10&action=addmeat&addmeat=Go+%3E%3E
closet.php?pwd&amt=10&action=takemeat&addmeat=Go+%3E%3E

The easier but less flexible solution would be to create meat pastes, stacks, or dense stacks and put those in and out of the closet with the functions that do exist.
 

Nightmist

Member
This is a OLD function I wrote before the "set" command and such came out so yeah... It will either put meat or take meat out of the closet to meet a exact amount.

You may want to remove the section:
Code:
if( NewCounter > my_meat())
{
 Get_Meat( NewCounter);
}
Yeah I have another function that farms for meat at the "Best Stat Giving Location" >> (So unless you have one too then just remove that code section)
 

Attachments

  • Clos.ash
    605 bytes · Views: 90

GoldenRatio

New member
I was gonna say the same thing...

But anyways how do I execute a raw url like that? is 'pwd' a KoLMafia global variable, or do I need to get my hash somehow? Sorry I am just not finding the sort of info I need anywhere... nobody's really documented all this fully.. at least not that I've found.
 

Nightmist

Member
Ok thats it I'm officially crazy >>

Attached now... XD.

Edit: Oh and yeah, pwd and phash (Possibly other I cant recall right now) when used in a raw URL manner, mafia automatically enters your hash on the request.
 

Tirian

Member
You execute raw URLs with the cli_execute command. More or less, if something isn't an ASH command but you can do it in the game (discounting combat) and don't care that you won't be able to read the output, then do it in the minibrowser and copy the URL that is listed there into your script. The minibrowser will automatically compress and decompress your password so that you can share the scripts with your friends too, as you saw here.
 

GoldenRatio

New member
Alright, thanks guys! I got it working nicely, my script is nearing completion! The only problem is that Mafia doesn't seem to update correctly, however when I check in a normal browser it seemed to have worked.

[edit] I'll attach my scripts if anyone wants to see and maybe help me improve.

I have 2, one for my main and one for my multi. My main has pastamastery and is a myst class so the scripts takes advantage of that. On the other hand, my multi isn't, so it's more of a "general" script.
 

Attachments

  • gr.script.ash
    4.1 KB · Views: 75
  • cerpin.script.ash
    3.2 KB · Views: 80

macman104

Member
If you are using commands with raw urls, mafia does not recognize those and will not update accordingly. If you use those to move items and such, mafia doesn't recognize that, if I understand correctly.
 

Veracity

Developer
Staff member
Meat is not an item. Therefore "$item[meat]" won't work for ASH and saying "10 meat" won't work from the CLI.

I don't particularly like people using raw URLs to do things that KoLmafia should support directly; as you've noted, doing so gets your inventory out of synch. Since holatuwol added polymorphic functions to ASH in 8.3 (it's been a while since I made a new "Changes in scripting in release x.x" note. Perhaps I should, eh?) perhaps what is needed is a couple of new functions:

// Existing functions to move items
boolean put_closet( int count, item item );
boolean take_closet( int count, item item );

// New functions to move meat
boolean put_closet( int meat );
boolean take_closet( int meat );

I'd have to think how it would work for the CLI. Perhaps

closet put 10 bat wing
closet put 10

But what does it do today with

closet put 5 668 scroll
closet put 668 scroll

?

The CLI has special code to parse item names and optionally allow a count. Making it accept a simple number with no item name might be tricky. Or not.
 

GoldenRatio

New member
I'm guessing it some sort of look-up with a database? I don't know how it works but maybe you can make a bs entry in the DB for meat?
 

macman104

Member
[quote author=Veracity link=topic=286.msg1520#msg1520 date=1152911414]But what does it do today with

closet put 5 668 scroll
closet put 668 scroll

?[/quote]Ooo, that's a good question. Does it take it to mean, closet 668 of your "scroll"? And then sub-string matching jumps in, or is it, 1 "668 scroll"? I'd be just as happy for it to accept "meat" as an item. closet put 10000 meat. Where meat is the item? Then again, I don't really use CLI commands, so I'll just sit back and be quiet.
 

GoldenRatio

New member
Well, the thing is, is that there is the Meat Manager. That obviously executes some code that accomplishes the task. All that is really required is a CLI and ASH command that calls that particular code.

[edit] I'd like to ask if anyone has ever figured out a way to check fullness? I know I've seen that question here and on KoL forums, and I don't recall ever seeing an answer... but I have found a way if anyone is interested.

Code:
#assume 'amount' is a variable passed in, and 'i' is an item
int counter = 0;
while(counter < amount)
{
  if(!eat(1,i))
  {
   break;
  }
  counter = counter + 1;
}
 

holatuwol

Developer
The problem here was that KoLmafia did recognize closet meat management as a valid CLI command, but it didn't do the right thing with the data it parsed.  This is fixed and will be available in the next release. The syntax it was recognizing but failing to handle was the following:

Code:
closet put 10 meat
closet take 10 meat
 

Nightmist

Member
[quote author=holatuwol link=topic=286.msg1538#msg1538 date=1153094956]
The problem here was that KoLmafia did recognize closet meat management as a valid CLI command, but it didn't do the right thing with the data it parsed. This is fixed and will be available in the next release. The syntax it was recognizing but failing to handle was the following:

Code:
closet put 10 meat
closet take 10 meat
[/quote]
lowercase being the key >> I tried this with a uppercase M and bam its looking for Meatcars//meat detectors and all other meat items >>. Well that was a few versions back anyway, not too sure if it still has the same thing happen in the current versions.
 

Veracity

Developer
Staff member
[quote author=Veracity link=topic=286.msg1520#msg1520 date=1152911414]
// New functions to move meat
boolean put_closet( int meat );
boolean take_closet( int meat );[/quote]

Now that holatuwol made "closet put X meat" and "closet take X meat" work the way they are intended, I added the above two ASH functions. They'll be available in 8.4.
 
Top