View Full Version : AR......Script request
icon315
12-02-2009, 10:39 PM
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
Coconut Shells
Little Paper Umbrellas
Magical Ice Cubes
Dry Noodles
Scrumptious Reagents
It would be a good idea if you could add some items...or Edit the list.
Heffed
12-02-2009, 10:55 PM
This is quite a simple thing. Should take you maybe 10 minutes of reading the KoLMafia Wiki (http://wiki.kolmafia.us/index.php?title=Main_Page).
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.
foreach it in $items[Coconut Shells, Little Paper Umbrellas, Magical Ice Cubes, Dry Noodles, Scrumptious Reagents]
put_shop(999999999, 0, it);
cli_execute("undercut");
lostcalpolydude
12-02-2009, 11:10 PM
AR means limit 1 (usually), and probably mall minimum price.
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.
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...
foreach it in $items[Coconut Shells, Little Paper Umbrellas, Magical Ice Cubes, Dry Noodles, Scrumptious Reagents]
put_shop(mall_price(it), 1, it);
icon315
12-02-2009, 11:32 PM
Thanks.....but i added something...please go to the top :)
lostcalpolydude
12-02-2009, 11:35 PM
Replace mall_price(it) with 100 and it looks good to go, for adding stuff to the store.
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.
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);
}
lostcalpolydude
12-03-2009, 12:41 AM
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.
The minimum that you can use is 100 or 2*autosell, whichever is larger.Thanks for the information. I'll use that.
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.
icon315
12-03-2009, 08:30 PM
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
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.
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.
icon315
12-10-2009, 11:29 PM
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
I can't imagine why. There's nothing unusual in this script.
icon315
12-11-2009, 02:21 AM
I can make a video about it if you want....Maybe it is just Mafia doing it
adeyke
12-12-2009, 06:10 AM
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.
Powered by vBulletin® Version 4.1.12 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.