Selling Items in the Mall

bumcheekcity

Active member
Right, world's quickest question:

How do I sell a CERTAIN quantity of something in the mall? The put_shop() function puts ALL of them. I want all but one, so I can just find out the amount of item(s) I have in my inventory and take one away easily, but then I don't know how to put a given quantity only in my mall.

Thanks.
 

matt.chugg

Moderator
i've had this issue before, and I do remember asking the exact same question, I did get a response from holatuwol however I foget what it was!

heres how I achieve this... using the closet to hold the amount you wish to keep, not great as it uses 3 server hits when you should only need one. The other option is probably to use visit_url() to make a direct call the store page with the correct parameters in the query sting.

Code:
void mallsell(item itemtosell, int numbertokeep)
{
	if (item_amount(itemtosell) != 0)
	{
		if (item_amount(itemtosell) > numbertokeep)
		{
			print("Mall-Selling " + itemtosell + " (" + (item_amount(itemtosell) - numbertokeep) + ") (Keeping " + numbertokeep + ")");
			put_closet(numbertokeep,itemtosell);
			put_shop(0,0,itemtosell);
			take_closet(numbertokeep, itemtosell);
		}
	}
}
 

jasonharper

Developer
There's another version of the function that allows a quantity to be specified:
put_shop( price, limit, qty, item );

Or, build the CLI command yourself:
cli_execute( "mallsell -1 whatever" );
 

matt.chugg

Moderator
There's another version of the function that allows a quantity to be specified:
put_shop( price, limit, qty, item );

Or, build the CLI command yourself:
cli_execute( "mallsell -1 whatever" );

really! now that I didn't konw, along with 4.23 million other things!

can price be passed as null/zero to take default value ?
 

jasonharper

Developer
Right, passing zero for the price or limit uses the existing values if you have any of that item in your store already, otherwise it uses 999,999,999 Meat with no limit.
 

Raven434

Member
Sorry for the thread necromancy.

This is eating my brain...

Here is my cheatsheet:

'sell 21 cocktail onion for 2,222 meat w/ a limit of 3'

> mallsell 21 cocktail onion @2222 limit 3

'Add 3 more onion, without changing anything'

> mallsell 3 cocktail onion

'Change the limit to 5'

> mallsell 0 cocktail onion @0 limit 5

And various other iterations wind up putting all the onion I have in the store.

How do I change *just* the limit.

Thanks.
 
I'm a pretty lousy script writer that is just learning, but this is what I do:

## Sell Spare Sand Dollars
if ( item_amount( $item[Sand dollar] ) > 20 )
{
cli_execute("mallsell " +(item_amount($item[Sand dollar]) -20) +" Sand dollar");
}

This is a nice way to sell all that you have, except for reserving a particular amount. Maybe this is more what you are intending?
 

Bale

Minion
That's not what he was asking. He's trying to change the limit without changing anything else.

I think the closest you can come is to put 1 of the item into your store:

> mallsell 1 cocktail onion @0 limit 5

It's a shame that there doesn't seem to be a way to remove 1 onion from your store so that you could remove 1 and then put it back...

Code:
  ## Sell Spare Sand Dollars
  if ( item_amount( $item[Sand dollar] ) > 20 )
  {
     cli_execute("mallsell " +(item_amount($item[Sand dollar]) -20) +" Sand dollar");
  }

This is a nice way to sell all that you have, except for reserving a particular amount.

You're going through an unnecessary amount of trouble. This will do the same thing:

Code:
cli_execute("mallsell -20 Sand dollar");
 
Last edited:
Top