Pantogram.ash -- add a "pantogram" command to your CLI

zarqon

Well-known member
pantogram.ash

What the Well-Dressed Man Is Wearing

What ho, script-users all! The devs have very understandably decided not to implement a CLI command for the portable pantogram, however I found the daily trousers ritual had become rather cumbersome, like that cheery aunt who's come round for tea a few too many times in recent history for my liking, if you ask me. One's patience only goes so far, does one's. So I wrote this little blighter that almost fools me into thinking there is a CLI command that works pretty much just like I'd want it to. Topping, eh, what?

How to Use It

Simply type
Code:
pantogram <pipe-delimited item names/keywords>
in the CLI. The keywords are items or modifiers or nicknames, and specify what you want in each slot. They can be in any order. You may omit specifying up to all slots -- for any omitted slots, default choices will be used (the obvious free choices based on your primestat, plus stench resistance and -combat). You can type "pantogram help" to see a list of all available keywords, keeping in mind that in addition to the provided list, the item name will also work. The default/current choice for each slot will also be bolded so you can see what you need to select if you want to override those values.

Since summoning pants is something you can't retry if you mistype, the script will tell you what it's about to summon and sacrifice, and ask for confirmation before actually summoning your pants.

But now things get more powerful, with a few features for people who wish to automate or just generally be 'power users'. There are a handful of keywords which you can also include to alter the script's default behavior:

  • silent -- Suppresses the confirmation message, so you'll simply get whatever you typed. "pantogram silent" would simply summon pants with all the default choices.
  • default -- Useless. Does nothing. It exists so that you (or cli_execute()) can "pantogram default" to summon default pants without triggering the popup asking for params. Including this keyword will not overwrite any other selections.
  • force -- This keyword lets you make prioritized lists. Normally, if you specify multiple selections for the same slot, the script would abort with a warning. Likewise, if you specified a keyword but don't have the requisite item, the script would abort with a warning. However, using the force keyword, you can specify as many options for a slot as you'd like, and the most recent (last-mentioned) possible option will be selected for that slot.

    For example, "pantogram low meat|low items|high items" would cause an error because they are all options for the same slot, but "pantogram low meat|low items|high items|force" would first check "low meat" (let's suppose you have a taco shell), choose that, then check "low items" (you lack a fairy gravy boat so it will stick with the taco shell), then move along to "high items" (you have a tiny dancer), choosing high items for the slot in the end. If you lacked the required sacrifice items for all three, it would fall back to the default.
  • help -- as already mentioned, prints a list of keywords for each slot (with current selections highlighted). Current selections, meaning whatever is currently chosen at that point in your keywords list. "pantogram mus|help|mox" would show a list with Muscle highlighted as your current choice, then pop up the confirmation message, in which Moxie was your selected bonus. Silly, but possibly useful in debugging.

Installation

Download the two attached files. Put the text file in your data directory and the ASH file in your scripts directory. You're done!

Spiffing! I find that being conveniently betrouser'd has put a veritable spring in my step! I wish the same for you lot. Toodle-oo!
 

Attachments

  • pantodata.txt
    2.1 KB · Views: 223
  • pantogram.ash
    5.4 KB · Views: 165
Last edited:

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
Thank you for the great script, zarqon!
 

heeheehee

Developer
Staff member
Based on your example for force, it sounds like this doesn't automatically buy items.

I already added pantogram support to my farming script, but if I were to use something like this, I'd want it to auto-purchase items, subject to a max budget (preferably configurable). I'd also want some way to skip the confirmation, since user_confirm goes against the whole point of set-and-forget.
 

zarqon

Well-known member
For the former,

acquire X desireditem
pantogram desireditem


For the latter, it is already documented above.

ETA: Sorry if the above was terse, I was on my phone. What I hope you gathered from this is that the purpose of this script is to make the pantogram convenient to automate, not to actually automate it. It's meant to be the CLI command mafia would have had were it to have one. I've seen another script around that makes all the decisions for you if that's what you want.

Say in your login script you want to get +60% meat if you have a spare porquoise, but if you don't, definitely get the +30% meat using an affordable taco shell:

acquire 1 taco shell
pantogram taco shell|porquoise|force|silent


would do you just fine.

All that said, I could add a flag to buy the items specified if missing (respecting your autoBuyPriceLimit property).
 
Last edited:

heeheehee

Developer
Staff member
Oh, I'm just saying how I'd use it, if I were to. The relevant snippet I have looks something like
PHP:
    if (mall_price($item[lead necklace]) * 11 + mall_price($item[porquoise]) < PANTOGRAM_VALUE) {
      retrieve_item(11, $item[lead necklace]);
      retrieve_item(1, $item[porquoise]);
      visit_url("inv_use.php?pwd&which=3&whichitem=9573");
      visit_url("choice.php?whichchoice=1270&pwd&option=1&m=1&e=5&s1=-1%2C0&s2=706%2C1&s3=865%2C11", true, true);
    }

which sadly runs basically never. Lead necklaces are just too expensive to be worthwhile, and even 60% meat from porquoise is inferior to Great Wolf trousers in my case.
 

JohnKeel

New member
This script doesn't seem to let the pantogram pants work with the modifier maximizer until you refresh all. Do you have any idea why that might be happening?
 

zarqon

Well-known member
I don't think mafia recognizes when you acquire the pants, as there isn't a "You acquire" message in the CLI. That seems like both a mafia bug (not recognizing item acquisition) and a script bug (not submitting the URL that mafia looks for). I'll have another look at this when I play my turns later today. In the meantime I bet "refresh inv" would also work, and save a few server hits compared to "refresh all".

ETA: Okay, mafia shows the pants in inventory, despite the lack of acquisition message. Unfortunately I did things out of order and will have to wait till tomorrow to test further.
 
Last edited:

zarqon

Well-known member
> pantogram stench

Pantalones summonated.

> itemref pantogram

9572: pantogram
9573: portable pantogram (1)
9574: pantogram pants (pants) (1)

> ash numeric_modifier($item[pantogram pants], "Stench Resistance")

Returned: 0.0

> ash numeric_modifier($item[pantogram pants], "Combat Rate")

Returned: 0.0

> refresh inv

Updating inventory...
Requests complete.

> ash numeric_modifier($item[pantogram pants], "Stench Resistance")

Returned: 0.0

> ash numeric_modifier($item[pantogram pants], "Combat Rate")

Returned: 0.0

> refresh all

Loading character status...
Refreshing session data...
Synchronizing moon data...
Loading character status...
Retrieving character data...
Updating inventory...
Examining Meat in closet...
Updating closet...
Retrieving quest data...
Retrieving familiar data...
Familiar data retrieved.
Retrieving campground data...
Examining Meat and pulls in storage...
Updating storage...
You are currently a member of Storm Knights
Session data refreshed.

> ash numeric_modifier($item[pantogram pants], "Stench Resistance")

Returned: 2.0

> ash numeric_modifier($item[pantogram pants], "Combat Rate")

Returned: -5.0

So mafia detects the pants acquisition but doesn't learn what the enchantments are until a "refresh all". Note that "refresh inv" was insufficient. I think this is probably enough to submit a bug report.
 

Darzil

Developer
What is the urlString you are submitting? The code in PantogramRequest is looking for regex "m=(\\d)&e=(\\d)&s1=(.*)?&s2=(.*)?&s3=(.*)"

I guess it is failing there, as you are getting the pants in inventory, which is just before the code tries to match the urlstring to find what was requested.

I suspect if m, e, s1, s2 and s3 were in a different order from the one KOL uses, it'd fail to match, but would work.
 

zarqon

Well-known member
Ah, the script foreaches the key => value pairs to build the query string, so they'd be in alphabetical order. If it's too much work to make mafia's detection order-agnostic, I can change the script to submit the bits in that order.

EDIT: And... changed. It just means 25 map lookups instead of 5 temporary variables so it will run 200ns slower. Will wait a day so I can test and then upload the mafia-compliant version.
 
Last edited:

Darzil

Developer
Submitting in the same order as KOL so the detection works would be preferred, by me at least. If KOL was doing them in any order then we'd definitely update mafia.
 

zarqon

Well-known member
> pantogram silent

Pantalones summonated.

> ash numeric_modifier($item[pantogram pants],"Combat Rate")

Returned: -5.0

Looks fixed! Have updated the first post with the version that submits in the order KoLmafia is looking for.
 

Malibu Stacey

Active member
Code:
> pantogram help

Preference previousNotifyList changed from  to 
Sending kmail to Zarqon...
You've already summoned pants today.

I'd recommend moving this line

Code:
if (have_item($item[pantogram pants]) > 0) vprint("You've already summoned pants today.",0);
to after
Code:
   if (params == "help") return;
 
Top