Way to use all "retrieved" items? Or do I have to hard-code each line?

Basically it. I have a pretty basic buff script in the work that retrieve_items a lot of crap. I'd rather not have to type the use command for each and every one
 
Will it do that regardless of the "buy" options being checked in mafia?

Also, tried something like this:

Code:
  foreach x in $items[cyclops eyedrops, sorority brain, polka pop, pressurized potion of perception, black snowcone, pumpkin juice, potion of the litterbox, knob goblin eyedrops, resolution: be happier, eyedrops of the ocelot, off-white paisley oyster egg, eyedrops of the ermine, irradiated pet snacks, Knob Goblin pet-buffing spray, resolution: be kinder, disintegrating spiky collar, half-orchid]
  {
    retrieve_item( x, 1 );
	use( x, 1 );
  }

And got the error:

Code:
Function 'retrieve_item( item, int )' undefined. This script may require a more recent version of KoLmafia and/or its supporting scripts. (hobopolisbuff.ash, line 31)

I was guessing that would work. Can I retrieve/use lots of items in one line? "use(1, $item[cyclops eyedrops, sorority brain, polka pop, pressurized potion of perception, black snowcone, pumpkin juice, potion of the litterbox, knob goblin eyedrops, resolution: be happier, eyedrops of the ocelot, off-white paisley oyster egg, eyedrops of the ermine, irradiated pet snacks, Knob Goblin pet-buffing spray, resolution: be kinder, disintegrating spiky collar, half-orchid]);" doesn't work.
 

lostcalpolydude

Developer
Staff member
Code:
> ashref retrieve

boolean retrieve_item( int, item )
When you tell mafia to use() an item, it will implicitly do retrieve_item(). It will check all of the same places.
 

AlbinoRhino

Active member
You have the "x" and the "1" reversed in retrieve_item & use.

retrieve_item(1, x);
use(1, x);

Should work better.
 

slyz

Developer
The autoBuyPriceLimit is used by commands like retrieve_item() and all the commands that use it internally, like use(), eat(), drink() etc...

However, when you use the buy() command, Mafia will buy regardless of the autoBuyPriceLimit. Since you specifically told it to buy, it isn't an "auto-buy" action.

You could then do the following:

- try to retrieve_item()
- if retrieve_item didn't work and if the item is tradeable, buy() one
- use the item if either retrieve_item() or buy() worked.

PHP:
  foreach itm in $items[ cyclops eyedrops,
						 sorority brain,
						 polka pop,
						 pressurized potion of perception,
						 black snowcone,
						 pumpkin juice,
						 potion of the litterbox,
						 knob goblin eyedrops,
						 resolution: be happier,
						 eyedrops of the ocelot,
						 off-white paisley oyster egg,
						 eyedrops of the ermine,
						 irradiated pet snacks,
						 Knob Goblin pet-buffing spray,
						 resolution: be kinder,
						 disintegrating spiky collar,
						 half-orchid ]
{
	if ( retrieve_item( 1, itm ) || ( itm.is_tradeable() && buy( 1, itm ) ) )
	{
		use( 1, itm );
	}
}
 
Top