Items

Pazleysox

Member
Code:
	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)

My standard rollover bonus uses that code. The script looks at ALL items, and spits out ALL items you can equip, or pull and equip for bonus turns.

Is there a way I can break it down into slots? IE: spit out hats only first, then weapons / offhand next, etc.
 

fronobulax

Developer
Staff member
I don't see an easy way.

The lazy way would be to check item_type() for each of the ~100 item types that are of interest. That would take more time than optimal since you would be traversing the entire item list once for each type you were interested in.

A slightly more efficient way could be to record the item name and type in a map (rather than printing) during one pass, sort the map and iterate over the map printing things in the order you want.

Potentially complicated if one item can have more than one type and by the fact that item types can have spaces in them.
 

heeheehee

Developer
Staff member
to_slot(item) is probably useful here. Something like...

Code:
boolean [slot, item] map;
foreach it in $items[] {
  slot s = it.to_slot();
  if (s != $slot[none] && to_int(numeric_modifier(it,"Adventures") > 0 && ...) {
    map[s, it] = true;
  }
}
foreach s, it, _ in map {
  print(it);
}

(you could also hardcode the order in which you want to iterate over the slots, I guess... e.g. by using $slots[hat, pants, shirt, hat, weapon, off-hand, acc1, hat] or whatever)
 

Darzil

Developer
I just use maximize("adv, 0.1 pvp fights +switch trick-or-treating tot", false); but then I am not considering pulls. I have it in my logout script, so I wouldn't want it using pulls, just in case I was planning to log in again later to carry on playing.
 

Pazleysox

Member
I just use maximize("adv, 0.1 pvp fights +switch trick-or-treating tot", false); but then I am not considering pulls. I have it in my logout script, so I wouldn't want it using pulls, just in case I was planning to log in again later to carry on playing.

I have that in mine too. I only use the script in question when I'm in ronin, and have extra pulls. I haven't personally used it in some time, and happened to use it yesterday. I wasn't happy with the results, as it was rather confusing.
Code:
Checking Gear
You have 2 dead guy's watch (Good for 1 turns) in storage, with 20 pulls remaining
You have 1 stainless steel solitaire (Good for 2 turns) in storage, with 20 pulls remaining
You can equip your plexiglass pocketwatch for 3 extra turns
You have 1 gold wedding ring (Good for 1 turns) in storage, with 20 pulls remaining
You can equip your aerogel ascot for 3 extra turns
You can equip your tiny plastic golden gundam for 1 extra turns
You can equip your novelty monorail ticket for 3 extra turns
You have 4 genie's turbane (Good for 2 turns) in storage, with 20 pulls remaining
You can equip your psychic's circlet for 3 extra turns
You have 1 scepter of the Skeleton Lord (Good for 3 turns) in storage, with 20 pulls remaining
You have 7 shoe ad T-shirt (Good for 3 turns) in storage, with 20 pulls remaining
You have 1 chalk chlamys (Good for 2 turns) in storage, with 20 pulls remaining
Here's the output I get. Mind you, I just logged in, and haven't run any turns, that's why there's 20 pulls remaining. I will work on this today. Thanks everyone for the feedback. I'll post my results later.
 

Pazleysox

Member
Here's what I came up with, and it seems to work as I would expect.
Code:
boolean [slot, item] map;
foreach it in $items[] 
	{
	  slot s = it.to_slot();
	  int nt = to_int(numeric_modifier(it,"Adventures"));
	  if (nt > 0 && can_equip(it) && is_unrestricted(it) )
		{
		if (s == $slot[hat])
			{
			map[s, it] = true;

		if (available_amount(it)>0)
 			{
	                print_html("<b>You can equip your </b><font color=7900a7>"+it+"</font> for "+nt+" extra turns");
		        }
		else if (pulls_remaining()>0 && storage_amount(it)>0) 
			{
        	        print_html("You have "+storage_amount(it)+" <font color=7900a7><b>"+it+"</b></font> (Good for "+nt+" turns) <b><font color=008000>in storage</b></font>, with "+pulls_remaining()+" pulls remaining");
		        }
     		}

			}
		}
which spits out this (for me):
Code:
You have 4 genie's turbane (Good for 2 turns) in storage, with 2 pulls remaining
You can equip your psychic's circlet for 3 extra turns

Now I will go about making the script look a little easier to read.
 
Last edited:
Top