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

Thread: Valhalla relay scrips for pets and consumables

  1. #1
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    12,304

    Default Valhalla relay scrips for pets and consumables

    For use in TCRS, to give you a heads-up about what you'll get for a particular class/sign combination.

    For the "astral pets" page, perhaps two dropdowns: "Class" and "Sign" and another control (dropdown, checkbox, radio buttons...) to say whether you are doing TCRS or not.

    If you are not doing TCRS or have not chosen both class and sign, all 15 astral equipment pieces display the default modifiers you get for a non-TCRS run.
    If you are doing TCRS and have selected both class and sign, the modifiers are replaced with those that apply.
    That's all Javascript and, judging my tune spoon functionality provided by KoL which does similar dynamic updates, not that hard.

    For the "astral consumables" page, something similar, except the items it shows you are astral hot dog, astral pilsner, and steel margarita (whose size is of interest) and what it shows is size/modifiers (since they can grant an effect).

    This could be a relay script - and I append the data files for such which will be needed to modify the HTML - or built-in to KoLmafia.

    I attach a couple of data files, and the simple ASH script I used to generate them from the following maps, which I created by reading all 54 TCRS_class_sign.txt files.

    string [string, string, item ] pet_modifiers;
    string [string, string, item ] consumable_modifiers;
    Attached Files
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  2. #2
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    12,304

    Default

    You know, I sort of like how this turned out.

    Here is a relay script which handles the pets as I envisioned.
    It needs the data files I generated.
    Put the script in "relay" and the data files in "data" and tell me how it looks next time you are in Valhalla.

    (No consumables yet).
    Attached Files
    Last edited by Veracity; 06-27-2019 at 03:55 AM.

  3. #3
    Senior Member
    Join Date
    Feb 2010
    Posts
    1,094

    Default

    Tried it this morning and it works well. Thank you.

    Edit: It occurred to me, after ascending, that it would be helpful to know what, non-wish, sources of "Got Milk" are available for a given class/moon-sign combination. Not sure where it would be best to put it though.
    Last edited by Magus_Prime; 06-28-2019 at 12:35 PM.

  4. #4
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    12,304

    Default

    Here's a new version which also (in addition to the previous support for the astral pet store) decorates the Deli to let you look at the size (and possible granted effects) of the astral hot dog and astral pilsner - as well as for the steel margarita. Improved the ASH and Javascript, too.

    I suspect that some people have spreadsheets and such and make class/sign decisions based on which easily available potions give them run-shortening effects. I suspect that consumable and pet attributes are lower in priority - although they'll want +ML and such. Not that I really know, since I don't compete. But what I have here is probably useful for the general public.

    I'm considering submitting this script and associated data files right into the "relay" and "data" directories of KoLmafia itself, so they become "official" support for this, rather than requiring you to install them from svn - and requiring me being the only one who maintains it, since the alternative puts them on my Sourceforge repository. I want this to be a generally available KoLmafia interface improvement to the KoL page, since what KoL provides is downright misleading, what with the description it shows when you click on the equipment being randomized every time you click it. That's a poor CX, in my opinion.
    Attached Files
    Last edited by Veracity; 06-29-2019 at 11:10 PM.

  5. #5
    Senior Member
    Join Date
    Dec 2008
    Posts
    593

    Default

    I for one would appreciate it if you added this to mafia itself, though I suppose if I ever get round to actually doing one of the summer runs I can easily install the script you've added here. Dunno how much of the general public who visits these forums often enough to be aware of that option though.

  6. #6
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    12,304

    Default

    I'm interested in dev opinions on this technique.

    Consider what we do to decorate Fernswarthy's Basement. We have supporting Javascript functions in relay/basement.js and Java in webui/BasementDecorator. When you visit basement.php, it modifies the HTML from the server to load basement.js and use that to change the UX for the page. The Java code uses methods and data from the rest of the KoLmafia source code to support that.

    This is a relay script written in ASH which uses data that I provide and methods in the ASH runtime library. As a relay script, when you visit afterlife.php, the script is called and it modifies the HTML to directly inject the Javascript functions it needs and adjusts the other elements of the page.

    The two techniques are equivalent:

    1) Both use data provided by KoLmafia itself. I created new data files from the 54 TCRS class/sign data files - as well as, in effect, modifiers.txt, to get the non TCRS data - to get files which go in the "data" directory.
    2) Both inject Javascript to provide for dynamic adjustment of what the browser displays, running in the browser itself.
    3) Both replace the page returned by the KoL server with a customized version.
    4) Both COULD use user settings to control whether or not you see the modifications - although neither does, I believe.

    The relay script provides the following advantages (and disadvantage):

    If the user puts their own relay script in to the "relay" directory, it will override the built-in support. They could inadvertently remove the support we provided. But they could take the relay file from the KoLmafia source and customize or augment it to meet their own needs. However, building it in like I propose would make merging our changes with their customizations harder, since SVN's merge ability is unavailable.

    Using the BasementDecorator technique, users can still augment the built-in changes, since I believe we pass the KoLmafia adjusted page to the relay script.

    My opinion: I think using a relay script and associated data files (including, potentially, auxillary Javascript files) is the "modern" preferred technique, now that ASH has matured into its current state. Now, the REAL "modern" technique would use something other than regexps to find & insert stuff in the (often crufty) HTML that KoL provides. Perhaps the xpath functionality which we have - and which will soon be improved, if Saklad5 has their way - will make ALL relay scripts easier to code robustly.

    And I think for UI improvements that we want ALL users to have without having to know to do an SVN install, putting the script and data right into the KoLmafia "relay" and "data" source directories is the way to go.

    Thoughts?
    Last edited by Veracity; 06-30-2019 at 01:39 AM.

  7. #7
    Senior Member
    Join Date
    Feb 2010
    Posts
    1,094

    Default

    FYI: In post four the attached file TCRS_astral_pets.txt should be named TCRS.astral_pets.txt for afterlife,ash to use it.

  8. #8
    Senior Member
    Join Date
    Apr 2009
    Posts
    1,862

    Default

    If the user puts their own relay script in to the "relay" directory, it will override the built-in support.
    Originally Posted by Veracity View Post
    Maybe it's time to invent some techniques and tools for running multiple independent relay scripts on the same page?

    I can imagine something with, say, new-style relay scripts (that get passed page DOM object and have to use new DOM-manipulation functions) for xxx.php living as relay/xxx/script_###.ash, and then one old-style script living as relay/xxx.ash
    - but how does mafia decide which of the new scripts gets run first? Would it just have to assume that they are really indepentend - and commutative, so the order does not matter?
    - would the old-style run before or after new-style? I am thinking after, it already had to potentially deal with any changes in mafia's output, and the first examples we have of "new-style" is just migration of mafia's builtin(s)

  9. #9
    Senior Member
    Join Date
    Apr 2018
    Posts
    331

    Default

    FYI: In post four the attached file TCRS_astral_pets.txt should be named TCRS.astral_pets.txt for afterlife,ash to use it.
    Originally Posted by Magus_Prime View Post
    Do you mean “afterlife.ash”?

  10. #10
    Senior Member
    Join Date
    Feb 2010
    Posts
    1,094

    Default

    When first posted the file " TCRS.astral_pets.txt" has a period between "TCRS" and "astral". The second time it was posted there is an underscore in that spot.

Posting Permissions

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