Page 1 of 2 1 2 LastLast
Results 1 to 10 of 15

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

  1. #1
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,674

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

    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!
    Attached Files
    Last edited by zarqon; 05-19-2019 at 03:02 PM.
    Sig by JakAtk
    My scripts: Prefref Plus | Skillref Plus | One-Click Wossna | Om*****st (??) | Psychose-a-Matic | RandBot
    Combat suite: Best Between Battle | Mercenary Mood | SmartStasis | BatMan | BatMan RE
    For script authors: ASH Wiki | ZLib | BatBrain | CLI Links | Drag-n-Drop Inventories | CanAdv | Script Registry | Map Manager
    If you appreciate my work, help me become BAT KING OF THE WORLD! Thanks to all donators!

  2. #2
    Developer
    Join Date
    Jan 2007
    Posts
    86

    Default

    Thank you for the great script, zarqon!

  3. #3
    Developer
    Join Date
    Aug 2009
    Posts
    2,956

    Default

    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.

  4. #4
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,674

    Default

    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 by zarqon; 10-29-2018 at 03:52 PM.

  5. #5
    Developer
    Join Date
    Aug 2009
    Posts
    2,956

    Default

    Oh, I'm just saying how I'd use it, if I were to. The relevant snippet I have looks something like
    PHP Code:
        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"truetrue);
        } 
    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.

  6. #6
    Junior Member
    Join Date
    Sep 2018
    Posts
    6

    Default

    Very, very cool. Thanks for the great script!

  7. #7
    Junior Member
    Join Date
    Feb 2019
    Posts
    1

    Default

    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?

  8. #8
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,674

    Default

    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 by zarqon; 02-01-2019 at 12:44 PM.
    Sig by JakAtk
    My scripts: Prefref Plus | Skillref Plus | One-Click Wossna | Om*****st (??) | Psychose-a-Matic | RandBot
    Combat suite: Best Between Battle | Mercenary Mood | SmartStasis | BatMan | BatMan RE
    For script authors: ASH Wiki | ZLib | BatBrain | CLI Links | Drag-n-Drop Inventories | CanAdv | Script Registry | Map Manager
    If you appreciate my work, help me become BAT KING OF THE WORLD! Thanks to all donators!

  9. #9
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,674

    Default

    > 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.
    Sig by JakAtk
    My scripts: Prefref Plus | Skillref Plus | One-Click Wossna | Om*****st (??) | Psychose-a-Matic | RandBot
    Combat suite: Best Between Battle | Mercenary Mood | SmartStasis | BatMan | BatMan RE
    For script authors: ASH Wiki | ZLib | BatBrain | CLI Links | Drag-n-Drop Inventories | CanAdv | Script Registry | Map Manager
    If you appreciate my work, help me become BAT KING OF THE WORLD! Thanks to all donators!

  10. #10
    Developer
    Join Date
    Apr 2010
    Posts
    5,122

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •