Pulling different forms of pete's jacket out of hangks?

Bloody Knuckles

New member
I'm trying to write a script that will either pull [pete's jacket] or [pete's jacket (popped)]

like so

if (cli_execute("pull pete's leather jacket") && cli_execute("pull pete's leather jacket (collar popped)"))

but i'm running into "cannot find" errors. What should I do?
 

Veracity

Developer
Staff member
Use the "storage_amount" and "take_storage" ASH functions, rather than cli_execute with the "pull" command, and use $item constants to specify the items you want.
 

Veracity

Developer
Staff member
Well, he did post a line, which included ambiguous item names which require fuzzy matching to disambiguate. At least, the first one did. I don't know what a "cannot find" error is, since he did not show the exact error message, but I suspect it is due to the item name ambiguity.

I suggested that since he's using ASH, he should use ASH functions rather than cli_execute with CLI commands, but, he COULD use the actual item names in his CLI commands, rather than depending on fuzzy matching (which is for the benefit of human typing, rather than scripts, for which there is no reason whatsoever NOT to use full item names; the script will not get tired of typing extra characters). Something like this.

Code:
if (cli_execute("pull Sneaky Pete's leather jacket") && cli_execute("pull Sneaky Pete's leather jacket (collar popped)"))
 

Veracity

Developer
Staff member
To be clear about the ambiguity:

When you say "pete's leather jacket" do you mean "Sneaky Pete's leather jacket" or "Sneaky Pete's leather jacket (collar popped)"? I know that you mean the former, but ASH has no way of knowing that. If you say "Sneaky Pete's leather jacket", yes that could be "Sneaky Pete's leather jacket (collar popped)" - except it is an exact match, which takes precedence.
 

lostcalpolydude

Developer
Staff member
I regularly type "fold pete jacket" to get the unpopped version (or did before the maximizer could handle it, at least), so I don't actually think that's the issue.
 

Veracity

Developer
Staff member
Fair enough. I guess the OP will have to tell us exactly what error message he got by doing what exactly.
 

Bale

Minion
I regularly type "fold pete jacket" to get the unpopped version (or did before the maximizer could handle it, at least), so I don't actually think that's the issue.

Back when I did sneaky pete ascensions I decided to make things simple for myself and made it so that I could just pop collar (or even just "pop") and let it switch forms without having to name them.

Code:
alias pop => ashq item unpop,popped; switch($string[%%]){case "shirt": case "collar": case "pete": case "": unpop = $item[Sneaky Pete's leather jacket]; popped = $item[Sneaky Pete's leather jacket (collar popped)]; break; case "hat": case "helm": case "boris": unpop = $item[Boris's Helm]; popped = $item[Boris's Helm (askew)];}  string choice; if(available_amount(popped) == 0 && available_amount(unpop) > 0) choice = popped; else if(available_amount(popped) > 0) choice = unpop; if(choice == $item[none]) print("You do not have a collar you can pop.", "red"); else cli_execute("fold "+choice);
 

Bloody Knuckles

New member
I kept getting "[Sneaky Pete's Leather Jacket] requested but not available". I tried flipping the order, but that didn't solve this problem. Also solved this problem with veracity's suggestion of using the storage checking function. Thanks Veracity!
 
Last edited:
Top