Page 239 of 241 FirstFirst ... 139 189 229 237 238 239 240 241 LastLast
Results 2,381 to 2,390 of 2401

Thread: Universal Recovery Script

  1. #2381
    Senior Member
    Join Date
    Oct 2017
    Posts
    419

    Default

    I believe I have found the issue. The function mall_quant determines the number of mall items needed to restore. It returns a floating point (unlike the function used for looking at inventory inside ronin which returns an integer).

    So, if you are trying to heal 50 HP (an amount that is passed to the mall_quant function), the item bullpup tent which restores 1000 HP will return 50/1000 = 0.05 bull pup tent quantity needed to restore 50 HP.

    The function is used in 3 places. In meat_to_mp function where it is rounded up via ceil.
    In the function to actually use the item where it is rounded up
    And in the function that determines the best mall item "best_mall" which fails to round it up

    So in the above scenario where bullpup tent costs 1900, "best_mall" will, for determining which item is best, internally calculate that the cost to heal 50 HP using a quantity of bullpup tents as = 1900 * 0.05 = 95 meat
    However, the cost to restore is not 95 meat because you cannot consume a fraction of an item, it is 1900. This item should not be the chosen result of the best_mall function. And costs should not be calculated based on fractions of an item. The function was obviously designed with multi using items that heal much much less.

    Because it does get rounded up for MP restoring, and skills are used by default when possible, this is only an issue if someone is playing in casual, aftercore, or after ronin, and has 0 known healing skills. As such, it was not really noticed until I started a brand new multi that tried to use this script from day 1 of the account existing.

    I am currently trying to decide exactly how to fix it while ensuring I don't break anything else. I am honestly not sure what the point is in having mall_quant return a floating point instead of having it automatically ceil inside the function itself. It gets ceil in every usage except one... in which case it should have been ceil and the fact it isn't is the cause of this bug...

    Incidentally, it is quite lucky I had my multi stuck in a super long glover HC ascension (I was trying to see the worst glover one can have... HC with 0 skills permed)
    I am going to have to make sure NOT to perm a healing skill, and ascend into softcore in order to test possible fixes for this issue

    Also, because the way the logic works this is very much an edge case, not a common issue like I thought. And not exactly easy to test since perming a healing skill is one of the first thing people often do. edit: its only an edge case for HP recovery, it actually does affect the MP recovery functionality too.

    Also, it will take days (and an annoying inefficient detour, I need to not perm a healing skill, and ascend into casual or get into aftercore without buying a healing skill in run) before my multi is even set up such that I can even start testing fixes. So I will get back to this when I have it set up.
    Last edited by taltamir; 09-17-2018 at 10:15 PM.

  2. #2382
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,675

    Default

    Due to Bale's continued absence I would like to share this updated version of his script for anyone still using it, so that all his work can continue to be useful. It contains a few fixes which I have found important for its continued operation.

    - Fix a divide by 0 error
    - Fix hard-to-track-down error involving scrolls of drastic healing
    - Remove version checking, as the script is not being updated
    - filter items with ZLib's be_good() to verify items are path-safe
    - Nerf to Cannelloni Cocoon was causing UR to senselessly abort. Account for the nerf.
    - Simply return true as a Vampyre (skip healing altogether)

    It also contains an attempted fix to taltamir's problem above. Adding a ceil(), as it turns out, was not the correct solution, as my mallmode multi found out when UR kept failing to find any MP restoratives. So instead, I changed mall_quant() to consider the price of the item relative to the actual amount of restoration possible with that item. If your maximum HP is 30 and you are at 10 health, an item that restores 5000 HP will now be considered as though it only restores 20 HP for the purpose of finding its cost. This will hopefully result in more sensible choices across the board.
    Attached Files
    Last edited by zarqon; 07-09-2019 at 04:07 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!

  3. #2383
    Senior Member Crowther's Avatar
    Join Date
    Nov 2006
    Posts
    1,478

    Default

    I never reached the point where I was convinced it was perfect, but here's my G-Lover's patch: Universal_recovery.ash.patch

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

    Default

    Adding a ceil() was not the right fix. Found a much better solution (above post edited accordingly and attachment updated).

    @Crowther: Yep, that and other path restrictions ought to be handled by the be_good() check!
    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!

  5. #2385
    Senior Member Crowther's Avatar
    Join Date
    Nov 2006
    Posts
    1,478

    Default

    @Crowther: Yep, that and other path restrictions ought to be handled by the be_good() check!
    Originally Posted by zarqon View Post
    Awesome!

  6. #2386
    Senior Member
    Join Date
    Feb 2010
    Posts
    1,067

    Default

    Thank you zarqon! I'd made. minor, changes to the script to make it stop failing in certain conditions but your insertion of the be_good() check checks is a HUGE help.
    Last edited by Magus_Prime; 07-07-2019 at 10:39 AM.

  7. #2387

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

    Default

    Okay, with my previous improvement the script would abort in mallcore when your HP or MP was at max due to all items being considered as effectively restoring 0. So I've updated the previous post again with an improvement to the improvement that only considers "actual" restore amounts when you are below max, and otherwise considers theoretical (unlimited) restore amounts. In so doing, I also slightly refactored best_mall() to sort a map of options rather than maintaining a "best" option, which improves debug output at high verbosity.

    This would be easier on SVN, frono, so your idea sounds fine to me.
    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. #2389
    Developer fronobulax's Avatar
    Join Date
    Feb 2009
    Location
    Central Virginia, USA
    Posts
    4,429

    Default

    This has been moved to https://svn.code.sf.net/p/kolmafiasc...y/code/scripts and zarqon and I have commit access. The Scripts Menu has been updated. It is recommended that users uninstall the OBE Universal Recovery and install the "new" one Universal Recovery. The latest version (above) has been committed to the new URL.

    svn checkout https://svn.code.sf.net/p/kolmafiasc...recovery/code/ if you don't want to use the Scripts Menu

  10. #2390
    Senior Member
    Join Date
    Oct 2017
    Posts
    419

    Default

    svn checkout https://svn.code.sf.net/p/kolmafiasc...recovery/code/ if you don't want to use the Scripts Menu
    Originally Posted by fronobulax View Post
    this should be placed in a codebox (and its link status should be revoked), as the forum software automatically truncates it and puts some ... in the middle otherwise. So if you just copy pasted it you will get a broken link that doesn't work.

    like so
    Code:
    svn checkout https://svn.code.sf.net/p/kolmafiascripts/mafiarecovery/code/
    Also best to add a note to uninstall the old version first?
    Last edited by taltamir; 07-10-2019 at 04:19 PM.

Similar Threads

  1. Anecdote - Recovery Script not firing between auto-adventures?
    By fronobulax in forum Community Support
    Replies: 1
    Last Post: 02-20-2015, 07:36 PM
  2. Replies: 0
    Last Post: 09-21-2013, 05:50 PM
  3. what are all the ways mafia can consult a script? like recovery, breakfast
    By forgot my password in forum Scripting Discussion
    Replies: 5
    Last Post: 06-11-2009, 09:05 PM
  4. Recovery Script for Hardcore
    By Bale in forum Buff Upkeep Scripts
    Replies: 84
    Last Post: 03-04-2009, 08:17 AM
  5. Very New, Need a MP Recovery Script
    By Willie0248 in forum Scripting Discussion
    Replies: 2
    Last Post: 04-15-2006, 09:30 PM

Posting Permissions

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