alias buypull => ash string pulls(){int p = pulls_remaining(); return p == 0? "No pulls": "Only "+(p == 1? "1 pull": p+" pulls");}if(in_hardcore()) print("You cannot pull items in hardcore.", "red"); else {matcher input = create_matcher("(?:(\\d+)\\s+)?(.+)", $string[%%]); if(input.find()) {int q = input.group(1) == ""? 1: input.group(1).to_int(); item topull = to_item(input.group(2),q); if(topull == $item[none]) topull = to_item(input.group(2),2); if(topull == $item[none]) print('Unknown items: '+q+" "+input.group(2), "red"); else if(pulls_remaining() < 0){int s = shop_amount(topull); if(s > 0) take_shop(min(s, q), topull); buy(q-s, topull, get_property("autoBuyPriceLimit").to_int());} else if(pulls_remaining() >= q) {if(storage_amount(topull) < q) {if(shop_amount(topull) > 0) take_shop(min(shop_amount(topull), q-storage_amount(topull)), topull); buy_using_storage(q-storage_amount(topull), topull, get_property("autoBuyPriceLimit").to_int());} take_storage(q, topull); print(pulls()+" remain.", "blue");} else print(pulls()+" pulls remaining for today.", "red");} else print("Unparseable input.", "red");}