AR......Script request

icon315

Member
Can anyone make a script that hosts ARs?......let me rephrase.....a script that purchases 11 of the following items then puts them in the store @ min price with a limit of 1

  1. Coconut Shells
  2. Little Paper Umbrellas
  3. Magical Ice Cubes
  4. Dry Noodles
  5. Scrumptious Reagents

It would be a good idea if you could add some items...or Edit the list.
 
Last edited:

Bale

Minion
All you want it to do is to put all those items in the store at cheapest price? All you own? Regardless of what that cheapest price is? No limit on how many someone can buy? That's so easy it is boring. Fortunately it is also as short as it is boring.

PHP:
foreach it in $items[Coconut Shells, Little Paper Umbrellas, Magical Ice Cubes, Dry Noodles, Scrumptious Reagents]
   put_shop(999999999, 0, it);
cli_execute("undercut");
 

Bale

Minion
Okay. Here's the same thing with a purchasing limit of 1. I think it is pretty self-explanatory how to edit the list of items that you want to sell.

PHP:
foreach it in $items[Coconut Shells, Little Paper Umbrellas, Magical Ice Cubes, Dry Noodles, Scrumptious Reagents] 
   put_shop(999999999, 1, it); 
cli_execute("undercut");

Or if you want to match the price for the 5th purchasable item in the mall. That's slightly above the undercut price and ignores some of those 1/day limit items. I guess this isn't what you want...

PHP:
foreach it in $items[Coconut Shells, Little Paper Umbrellas, Magical Ice Cubes, Dry Noodles, Scrumptious Reagents] 
   put_shop(mall_price(it), 1, it);
 
Last edited:

Bale

Minion
Thanks.....but i added something...please go to the top :)
That's a good bit more information on your request. Is lostcalpolydude right that min price means the lowest price that you can possibly sell it for in the mall? Minimum price is the same as autosell, right? Okay, this will make sure you have 11 of each item in the mall, acquiring more if you don't already have enough. (If you've got some in the store already, it will count those as part of the 11.) That makes the script a little more interesting.

PHP:
int q;
foreach it in $items[Coconut Shell, Little Paper Umbrella, Magical Ice Cube, Dry Noodle, Scrumptious Reagent] {
	q = 11 - shop_amount(it);
	retrieve_item(q, it);
	put_shop(autosell_price(it), 1, q, it); 
}
 
Last edited:

lostcalpolydude

Developer
Staff member
ARs always use a price meaningfully below the cheapest normal mall price (the point is that the ticket is a prize by itself, otherwise it's just a raffle). The minimum that you can use is 100 or 2*autosell, whichever is larger. I've seen 101 used, perhaps to avoid bots that search for stuff at 100 meat.
 

Bale

Minion
The minimum that you can use is 100 or 2*autosell, whichever is larger.
Thanks for the information. I'll use that.

PHP:
foreach it in $items[Coconut Shell, Little Paper Umbrella, Magical Ice Cube, Dry Noodle, Scrumptious Reagent] {
	retrieve_item(11 - shop_amount(it), it);
	put_shop(max(2* autosell_price(it), 100), 1, 11 - shop_amount(it), it); 
}
The list of items can be easily edited if you change your mind about what items to use in the AR.
 
Last edited:

icon315

Member
How do i edit the script? Add items...Up limits? andis there a way to make it wait 5min after putting the items in the the store, then send a msg to Chatbot "roll 1d# in games?...then to bring up the store log
 

Bale

Minion
Mafia will not allow you to send messages that freely. Sorry. It will only send messages to people in your clan to keep you from spamming.

As for editing the script, here. This should make it more self-explanatory in case it's all greek to you. For the items, you can add and delete them from that comma delimited list, but make sure you don't change the stuff at the ends.

PHP:
int quantity_up_for_raffle = 11;
int limit_per_player = 1;
boolean[item] raffle_items = $items[Coconut Shell, Little Paper Umbrella, Magical Ice Cube, Dry Noodle, Scrumptious Reagent];

foreach it in raffle_items{
	retrieve_item(quantity_up_for_raffle - shop_amount(it), it);
	put_shop(max(2* autosell_price(it), 100), limit_per_player, quantity_up_for_raffle - shop_amount(it), it); 
}

That's the last I'm going to bother with this script.
 

Attachments

  • ARScript.ash
    396 bytes · Views: 40

icon315

Member
For some reason the script doesn't let me use it more than once in a session.....why is that?

I figured out a way of making this work....i have to open a new window in mafia, then reopen the main window
 

adeyke

Member
The problem is that it assumes that there are currently shop_amount() of an item in the shop and then adds only however much is missing. The first time this function is called, it checks the store inventory, but afterward, it just reports on its internal record of it. If any of the tickets have been bought, it won't detect their absence and thus the script won't replace them.

To fix it, you'd need to get it to refresh the store inventory to make the shop_amount() result accurate again.
 
Top