Standard Rollover Bonus

Pazleysox

Member
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.
Release v 3.0 Rewrote most of script to make output more user friendly. Thanks to Heeheehee


Code:
svn checkout svn://svn.code.sf.net/p/standard-rollover-bonus/code/

EDIT: Fixed bug
 
Last edited:

ckb

Minion
Staff member
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:
void ListAdvItems() {
	foreach it in $items[] {
		int nt = to_int(numeric_modifier(it,"Adventures"));
		if (nt>0 && 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()>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");
			}
		}
	}
}

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:

Pazleysox

Member
PHP:
void ListAdvItems() {
	foreach it in $items[] {
		int nt = to_int(numeric_modifier(it,"Adventures"));
		if (nt>0 && 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()>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");
			}
		}
	}
}

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:

AlbinoRhino

Active member
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:
[COLOR=#0000BB][FONT=monospace][I]void ListAdvItems[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]() {
    foreach [/I][/FONT][/COLOR][COLOR=#0000BB][FONT=monospace][I]it in $items[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I][] {
        [/I][/FONT][/COLOR][COLOR=#0000BB][FONT=monospace][I]int nt [/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]= [/I][/FONT][/COLOR][COLOR=#0000BB][FONT=monospace][I]to_int[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]([/I][/FONT][/COLOR][COLOR=#0000BB][FONT=monospace][I]numeric_modifier[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]([/I][/FONT][/COLOR][COLOR=#0000BB][FONT=monospace][I]it[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I],[/I][/FONT][/COLOR][COLOR=#DD0000][FONT=monospace][I]"Adventures"[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]));
        if ([/I][/FONT][/COLOR][COLOR=#0000BB][FONT=monospace][I]nt[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]>[/I][/FONT][/COLOR][COLOR=#0000BB][FONT=monospace][I]0 [/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]&& [/I][/FONT][/COLOR][COLOR=#0000BB][FONT=monospace][I]can_equip[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]([/I][/FONT][/COLOR][COLOR=#0000BB][FONT=monospace][I]it[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]) [B]&& is_unrestricted(it)[/B] ) {
            if ([/I][/FONT][/COLOR][COLOR=#0000BB][FONT=monospace][I]available_amount[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]([/I][/FONT][/COLOR][COLOR=#0000BB][FONT=monospace][I]it[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I])>[/I][/FONT][/COLOR][COLOR=#0000BB][FONT=monospace][I]0[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]) {
                [/I][/FONT][/COLOR][COLOR=#0000BB][FONT=monospace][I]print_html[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]([/I][/FONT][/COLOR][COLOR=#DD0000][FONT=monospace][I]"You can equip your <b>"[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]+[/I][/FONT][/COLOR][COLOR=#0000BB][FONT=monospace][I]it[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]+[/I][/FONT][/COLOR][COLOR=#DD0000][FONT=monospace][I]"</b> for "[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]+[/I][/FONT][/COLOR][COLOR=#0000BB][FONT=monospace][I]nt[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]+[/I][/FONT][/COLOR][COLOR=#DD0000][FONT=monospace][I]" extra turns"[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]);
            } else if ([/I][/FONT][/COLOR][COLOR=#0000BB][FONT=monospace][I]pulls_remaining[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]()>[/I][/FONT][/COLOR][COLOR=#0000BB][FONT=monospace][I]0 [/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]&& [/I][/FONT][/COLOR][COLOR=#0000BB][FONT=monospace][I]storage_amount[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]([/I][/FONT][/COLOR][COLOR=#0000BB][FONT=monospace][I]it[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I])>[/I][/FONT][/COLOR][COLOR=#0000BB][FONT=monospace][I]0[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]) {
                [/I][/FONT][/COLOR][COLOR=#0000BB][FONT=monospace][I]print_html[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]([/I][/FONT][/COLOR][COLOR=#DD0000][FONT=monospace][I]"You have "[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]+[/I][/FONT][/COLOR][COLOR=#0000BB][FONT=monospace][I]storage_amount[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]([/I][/FONT][/COLOR][COLOR=#0000BB][FONT=monospace][I]it[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I])+[/I][/FONT][/COLOR][COLOR=#DD0000][FONT=monospace][I]" <b>"[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]+[/I][/FONT][/COLOR][COLOR=#0000BB][FONT=monospace][I]it[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]+[/I][/FONT][/COLOR][COLOR=#DD0000][FONT=monospace][I]"</b> (Good for "[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]+[/I][/FONT][/COLOR][COLOR=#0000BB][FONT=monospace][I]nt[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]+[/I][/FONT][/COLOR][COLOR=#DD0000][FONT=monospace][I]" turns) in storage, with "[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]+[/I][/FONT][/COLOR][COLOR=#0000BB][FONT=monospace][I]pulls_remaining[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]()+[/I][/FONT][/COLOR][COLOR=#DD0000][FONT=monospace][I]" pulls remaining"[/I][/FONT][/COLOR][COLOR=#007700][FONT=monospace][I]);
            }
        }
    }
}  [/I][/FONT][/COLOR]
 
Last edited:

Pazleysox

Member
Only if you are under Standard restrictions when you run the script.

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.
 

lostcalpolydude

Developer
Staff member
and then when standard restrictions change, I (hopefully) won't have to update the script.

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).
 

Theraze

Active member
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.
 

taltamir

Member
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
 

Pazleysox

Member
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

That's a mafia issue. Perhaps you don't have any equipment usable for your familiars for rollover? The script doesn't look at/for the "Little bitty bathysphere". The only way I can see it looking is when it maximizes your rollover turns, and then mafia picks an arbitrary item.
 
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.
 

Pazleysox

Member
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.

Pulled from line 18:

Code:
cli_execute("maximize adv -tie");

It has been in there since Theraze suggested it. Next time you should make sure your advise is sound before repeating what has already been said, and fixed.
 

Pazleysox

Member
Did a major overhaul of this script today. It will work for Standard, and Non-Standard runs. Now it will list equipment in a much easier to view format. It will tell you if you have an item equipped, in your inventory, or in storage. It will tell you how many pulls are remaining, so you can make the best decision possible to maximize your turns.

standard rollover.png

Here's a sample image of what the script will look like.
 
I would recommend having it not display pullable items while in hardcore, just for ease of viewing what's actually available. Really neat to see the full list of what I've got, though!
 

heeheehee

Developer
Staff member
You'll note that the accessory readout mentions that you have gear equipped for +3, +1, and +2 adv, and then lists a bunch of things for +1 and +2. Also, there are a bunch of cases where the script suggests that you could pull items you already have equipped (psychic's circlet, shoe ad t-shirt, etc)

That leads me to this usability suggestion: only show gear if it's an improvement.
 

Pazleysox

Member
I would recommend having it not display pullable items while in hardcore, just for ease of viewing what's actually available. Really neat to see the full list of what I've got, though!

I can do that.

You'll note that the accessory readout mentions that you have gear equipped for +3, +1, and +2 adv, and then lists a bunch of things for +1 and +2. Also, there are a bunch of cases where the script suggests that you could pull items you already have equipped (psychic's circlet, shoe ad t-shirt, etc)

That leads me to this usability suggestion: only show gear if it's an improvement.

I had noticed that myself. I will work on it. Thanks for the input.
 

Pazleysox

Member
Ok, I've updated the script again.

I'm not in HC, but I set it to not show items in storage if in hardcore. 2 of my clan members verified it works in HC.

Then, taking heeheehee's advice, I set the script to ignore items in storage if you already have one equipped. I will set it so that if you have one in your inventory, it won't tell you that you can pull one.

Also on heeheehee's advice, it SHOULD only tell you what you can pull if it's beneficial for you. With the exception of accessories (I need to work on this). It worked when I tested it at least.

There was an issue with having a coffin instead of a "Regular" dwelling.
 

heeheehee

Developer
Staff member
(There are accessories and weapons that give +adv which can be equipped multiple times, e.g. time sword or gold wedding ring.)
 
Top