Page 6 of 8 FirstFirst ... 4 5 6 7 8 LastLast
Results 51 to 60 of 80

Thread: Rethinking Candy

  1. #51
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,551

    Default

    Revision 17630 has a couple of tweaks to the Sweet Synthesis frame:

    - I renamed the "unrestricted" checkbox to "allowed" - i.e., check it to see only things are "allowed" in your current run (or in Standard, if you are not otherwise restricted).
    - I added tooltips to the checkboxes and effect buttons.

    I think that's it for the GUI until Phase 5, although bug fixes and user-suggested tweaks are always possible.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  2. #52
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,551

    Default

    I noticed the following in Ezandora's script:

    Code:
    int synthesis_price(item it)
    {
        if (!it.tradeable)
            return 999999999;
        int price = it.historical_price();
        if (it.historical_age() > 60.0) //initiate re-search of everything if their knowledge is too old
        	return it.mall_price();
        if (price <= 0)
            return 999999999;
        return price;
    }
    It's a good idea, even if incorrectly coded: if the historical price is "too old", fetch a new price.

    I can't quite do it On Demand like that, since every action you do on the Sweet Synthesis frame happens in the Swing (i.e., GUI updating) thread and we can't (don't want to) freeze the GUI while making requests of KoL. But buttons can execute their action in a different thread, so ...

    Revision 17632 adds a Check Prices button which will update the saved mall price of every candy whose current price is more than an hour old. And I made the "cost" of an untradeable item be 999,999,999, rather than Integer.MAX_INT.

    (Ezandora's function is incorrectly coded because historical_age() returns the age as a fractional day. Therefore, that function will refresh the price if the saved value is more than 60 days old. That is certainly not what was intended.)
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  3. #53

    Default

    Since mall_price() won't actually do a new search if you already ran it once in the current session, I think 60 days is actually more likely than 60 minutes.

  4. #54
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,551

    Default

    Considering I updated prices for all candies yesterday - and, as is the default, shared mall prices - nobody has a mall price more than a day old.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  5. #55
    Senior Member
    Join Date
    Jul 2012
    Posts
    180

    Default

    Hmm, don't the prices only update when you log in? Then wouldn't this search everything if it's been more than an hour since you logged in? Allowing day-old prices seems like it wouldn't make all that much difference in displayed prices and reduce the number of searches for most people.

  6. #56
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,551

    Default

    Feel free to not press the button.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  7. #57
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,551

    Default

    Revision 17637:

    Code:
    > synthesize? box of Dweebs, PEEZ dispenser
    
    Searching for "box of Dweebs"...
    Search complete.
    Searching for "PEEZ dispenser"...
    Search complete.
    Item 'box of Dweebs is a complex candy. You have 248 of it available to you without using the mall, where it costs 100 Meat.
    Item 'PEEZ dispenser is a complex candy. You have 5 of it available to you without using the mall, where it costs 135 Meat.
    Synthesizing those two candies will give you 30 turns of Synthesis: Greed
    
    > synthesize? bag of W&Ws, bag of W&Ws
    
    Searching for "bag of W&Ws"...
    Search complete.
    Item 'bag of W&Ws is a complex candy. You have 236 of it available to you without using the mall, where it costs 100 Meat.
    Item 'bag of W&Ws is a complex candy. You have 236 of it available to you without using the mall, where it costs 100 Meat.
    Synthesizing those two candies will give you 30 turns of Synthesis: Greed
    
    > inv W&W
    
    bag of W&Ws (236)
    
    > synthesize bag of W&Ws, bag of W&Ws
    
    Encounter: Sweet Synthesis
    You acquire an effect: Synthesis: Greed (30)
    Done!
    
    > inv W&W
    
    bag of W&Ws (234)
    I think this completes Phases 1-4.

    Phase 5 is "advanced" features; we have the infrastructure, but they involve writing (an) algorithm(s) to decide candy combos which are possible and/or cheap.

    CLI:

    synthesize EFFECT
    synthesize? EFFECT

    ASH:

    boolean sweet_synthesis( effect )

    GUI:

    "Automatic" button to load and select a minimum cost pairing for a particular effect. You like it? Press "Synthesize!".

    When filtering on "available" candy (i.e., in-run):

    Pre-analyze candy combos and filter out candies which will not combine with things you have to get the selected effect.

    The above and grey-out effects you can't currently get at all.

    I'm going to take a break before thinking about the above. This has been non-stop work for a week. I have learned a whole lot about Java Swing widgets, but I am tired.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  8. #58
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,551

    Default

    Well, I wanted my script to let KoLmafia make intelligent choices for it, so revision 17644 has the following:

    GUI:

    There is now an Automatic button which will select an appropriate pair of candies to get the desired effect.

    If you are in-run, it will use only "available" candy and will prefer candies that you have more of.
    If you are post-run, it will consider all candies and will choose the pair with the lowest total mall price.

    If you want to force "available" candies post-run, check the "available" checkbox.

    ASH:

    item [int] sweet_synthesis_pair( effect )
    item [int] sweet_synthesis_pair( effect, flags )

    For the desired effect, pick a suitable pair of candies.

    If you are in-run, it will use only "available" candy and will prefer candies that you have more of.
    If you are post-run, it will consider all candies and will choose the pair with the lowest total mall price.

    If you want to force "available" candies post-run, use flags = 1.

    boolean sweet_synthesis( effect )
    boolean sweet_synthesis( effect, flags )

    The same, but it will actually perform Sweet Synthesis to get the effect.

    Note that although you can specify flags when actually requesting the effect, it will always use at least the flags imposed by your run; you can be more restrictive post-run, but you cannot be less restrictive in-run.

    Code:
    > ash sweet_synthesis_pair( $effect[ Synthesis: Greed ] )
    
    Returned: aggregate item [2]
    0 => box of Dweebs
    1 => PEEZ dispenser
    
    > ash sweet_synthesis( $effect[ Synthesis: Greed ] )
    
    Encounter: Sweet Synthesis
    You acquire an effect: Synthesis: Greed (30)
    Returned: true
    
    > ash sweet_synthesis_pair( $effect[ Synthesis: Greed ], 1 )
    
    Returned: aggregate item [2]
    0 => Crimbo fudge
    1 => sugar sheet
    
    > ash sweet_synthesis( $effect[ Synthesis: Greed ], 1 )
    
    Encounter: Sweet Synthesis
    You acquire an effect: Synthesis: Greed (30)
    Returned: true
    session log:

    Code:
    cast 1 Sweet Synthesis
    Encounter: Sweet Synthesis
    
    synthesize box of Dweebs, PEEZ dispenser
    You acquire an effect: Synthesis: Greed (30)
    
    cast 1 Sweet Synthesis
    Encounter: Sweet Synthesis
    
    synthesize Crimbo fudge, sugar sheet
    You acquire an effect: Synthesis: Greed (30)
    Still need to add the "synthesize EFFECT" and "synthesize? EFFECT" CLI commands, and play more games with the GUI.
    Later.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  9. #59
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,551

    Default

    Revision 17645 allows this:

    Code:
    > synthesize? Synthesis: Greed
    
    Item 'box of Dweebs' is a complex candy. You have 247 available to you without using the mall, where it costs 100 Meat.
    Item 'PEEZ dispenser' is a complex candy. You have 51 available to you without using the mall, where it costs 135 Meat.
    Synthesizing those two candies will give you 30 turns of Synthesis: Greed
    
    > synthesize Synthesis: Greed
    
    Your spleen has been abused enough today
    I suppose one last tweak to that would be to allow keywords, rather than fuzzy matched effect names.

    I may do that. If not, I am done until I ascend, by and by, since heeheehee's suggested GUI tweaks are for the benefit of in-run Sweet Synthesis and it will be a lot easier to test once I am in-run. I may even get candies from the Gingerbread Train Station in order to test.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  10. #60
    Minion Bale's Avatar
    Join Date
    Jun 2008
    Posts
    13,287

    Default

    I am incredibly impressed by the level of support you have added for ash scripts to have complete control over this skill.

    It is quite safe to say that no single skill has ever prompted this much effort. Well done.

Posting Permissions

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