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

Thread: Standard Rollover Bonus

  1. #1
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    261

    Default Standard Rollover Bonus

    Here's a script that I wrote that will tell you every item that you can use for rollover, while in a pathed "Standard" type ascension.

    It's designed for the Softcore user, but can be used in HC (but it's pretty worthless in HC)

    It will give you a printout of all the items you currently have in your inventory, and storage, and how many pulls you have remaining. It will also tell you how many bonus turns you will receive from said item.

    It will take into account your current muscle, mysticality & moxie, and won't tell you that you can use an item that you can not equip yet.

    If you have 0 pulls left, it will just advise you as to what you have on-hand to equip. I've done my best to include every item currently available for use in a standard ascension, with the exception of "Ticksilver Spurs".

    Check it out, please tell me what you think. I worked pretty hard on this script, and did a lot of research on it too. I'm quite happy with the results.

    Release V 1.0 Initial script released into the world.
    Release V 1.1 Fixed bug where script wasn't properly checking for Maids in your campground dwelling
    Release V 2.0 Rewrote main part of script. Thanks to ckb, and AlbinoRhino for help, and advice. The script now works for all types of ascesions, although written for SOFTCORE players.
    Release V 2.1 minor change to speed up script.


    Code:
    svn checkout svn://svn.code.sf.net/p/standard-rollover-bonus/code/
    EDIT: Fixed bug
    Last edited by Pazleysox; 08-02-2017 at 02:04 PM. Reason: release 2.1

  2. #2
    Senior Member ckb's Avatar
    Join Date
    Mar 2006
    Posts
    746

    Default

    Paz,

    I applaud your effort here. You do a good job of generating some cool information. However, you script can be simplified quite a bit by taking advantage of the fact that Mafia knows almost everything about all the items and your character. This way, you can reference Mafia's internal knowledge without having to hard-code all the info about each item into your script.

    Here is a modified function that does almost everything your script does, but with much lower overhead. It iterates across all the items Mafia knows about, check to see if it adds +Adventures and that you can equip it, then prints a result.

    PHP Code:
    void ListAdvItems() {
        foreach 
    it in $items[] {
            
    int nt to_int(numeric_modifier(it,"Adventures"));
            if (
    nt>&& can_equip(it)) {
                if (
    available_amount(it)>0) {
                    
    print_html("You can equip your <b>"+it+"</b> for "+nt+" extra turns");
                } else if (
    pulls_remaining()>&& storage_amount(it)>0) {
                    
    print_html("You have "+storage_amount(it)+" <b>"+it+"</b> (Good for "+nt+" turns) in storage, with "+pulls_remaining()+" pulls remaining");
                }
            }
        }

    I hope this is helpful. It was part of what I was getting at in your other threads. Hopefully you can see how iterating over multiple items allows you to run checks of each item without having to duplicate code or specify individual requirements for each item.
    Last edited by ckb; 07-27-2017 at 12:15 AM.

  3. #3
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    261

    Default

    PHP Code:
    void ListAdvItems() {
        foreach 
    it in $items[] {
            
    int nt to_int(numeric_modifier(it,"Adventures"));
            if (
    nt>&& can_equip(it)) {
                if (
    available_amount(it)>0) {
                    
    print_html("You can equip your <b>"+it+"</b> for "+nt+" extra turns");
                } else if (
    pulls_remaining()>&& storage_amount(it)>0) {
                    
    print_html("You have "+storage_amount(it)+" <b>"+it+"</b> (Good for "+nt+" turns) in storage, with "+pulls_remaining()+" pulls remaining");
                }
            }
        }

    Originally Posted by ckb View Post
    This is a great script, and works well, and faster than the one that I wrote, but it doesn't take into account items that can NOT be equipped in a standard ascension, which is what I'm aiming for.

    EDIT: This script also doesn't look for campground, or familiar items, which I'm sure is easy enough to fix.

    Code:
    You have 1 time helmet (Good for 3 turns) in storage, with 20 pulls remaining
    You have 1 time trousers (Good for 3 turns) in storage, with 20 pulls remaining
    You have 1 time sword (Good for 3 turns) in storage, with 20 pulls remaining
    I know these are too old to equip, and I did ask about this problem here... If there's a way to do this, I would be very happy to rewrite the script!
    Last edited by Pazleysox; 07-27-2017 at 02:46 PM.

  4. #4
    Senior Member AlbinoRhino's Avatar
    Join Date
    May 2008
    Posts
    707

    Default

    http://wiki.kolmafia.us/index.php?title=Is_unrestricted

    You can use is_unrestricted() to determine if things are allowed in Standard (or not).


    Code:
    void ListAdvItems() {
        foreach it in $items[] {
            int nt = to_int(numeric_modifier(it,"Adventures"));
            if (nt>0 && can_equip(it) && is_unrestricted(it) ) {
                if (available_amount(it)>0) {
                    print_html("You can equip your <b>"+it+"</b> for "+nt+" extra turns");
                } else if (pulls_remaining()>0 && storage_amount(it)>0) {
                    print_html("You have "+storage_amount(it)+" <b>"+it+"</b> (Good for "+nt+" turns) in storage, with "+pulls_remaining()+" pulls remaining");
                }
            }
        }
    }  
    Last edited by AlbinoRhino; 07-27-2017 at 01:34 PM.

  5. #5

    Default

    http://wiki.kolmafia.us/index.php?title=Is_unrestricted

    You can use is_unrestricted() to determine if things are allowed in Standard (or not).
    Originally Posted by AlbinoRhino View Post
    Only if you are under Standard restrictions when you run the script.

  6. #6
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    261

    Default

    Only if you are under Standard restrictions when you run the script.
    Originally Posted by lostcalpolydude View Post
    It looks as though when your NOT under standard restrictions, the script will print out everything you can wear anyways. Which isn't a bad thing. I can just change what the script does, and then when standard restrictions change, I (hopefully) won't have to update the script.

  7. #7

    Default

    and then when standard restrictions change, I (hopefully) won't have to update the script.
    Originally Posted by Pazleysox View Post
    That won't be an issue. Except it looks like I should specify a time zone in that code, some people will probably get incorrect results right around the new year currently (which would be self-correcting by the next day).

  8. #8
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    261

    Default

    Script happily re-written with new modifications.

    Thank you ckb, and AlbinoRhino for your help with this!

  9. #9
    Senior Member Theraze's Avatar
    Join Date
    Mar 2010
    Posts
    8,741

    Default

    One usefulness/server-hit suggestion:
    Code:
    	print ("You have 0 pulls remaining, Script will only maximize rollover for you.");
    	cli_execute("maximize adv");
    	print("Adventures Maximized.", "Green");
    Rather than "maximize adv" by itself, might I suggest "maximize adv, -tie" instead? If you don't explicitly avoid the tiebreaker, mafia will randomly shuffle your gear for no benefit to rollover adventures due to improving your item drops, meat drops, and other such things that don't matter while you're asleep. While it doesn't directly hurt, it slows down script execution as well as wastes server hits making changes that you'll only roll back when you log in later.

  10. #10
    Junior Member
    Join Date
    Oct 2017
    Posts
    22

    Default

    This has been a generally useful script. It found for me an item that I forgot I had and added it to my overnight outfit.

    However, for some reason it insists on swapping my familiar gear to "itty bitty bathysphere" even though this doesn't have anything to do with rollover adventures

Posting Permissions

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