[Programming Help] Buy Items I Do Not Have

Raven434

Member
Is there an easy way to tell Mafia to parse a list of items and buy the ones I do not have?

Like parse this list of Crimbo Schematics and buy the ones I am missing?

Crimbot schematic: Big Head
Crimbot schematic: Big Wheel
Crimbot schematic: Bit Masher
Crimbot schematic: Bug Zapper
Crimbot schematic: Camera Claw
Crimbot schematic: Candle Lighter
Crimbot schematic: Cold Shoulder
Crimbot schematic: Crab Core
Crimbot schematic: Cyclopean Torso
Crimbot schematic: Data Analyzer
Crimbot schematic: Dynamo Head
Crimbot schematic: Grease / Regular Gun
Crimbot schematic: Grease Gun
Crimbot schematic: Gun Face
Crimbot schematic: Gun Legs
Crimbot schematic: Heavy Treads
Crimbot schematic: Heavy-Duty Legs
Crimbot schematic: High-Speed Fan
Crimbot schematic: Hoverjack
Crimbot schematic: Lamp Filler
Crimbot schematic: Maxi-Mag Lite
Crimbot schematic: Mega Vise
Crimbot schematic: Military Chassis
Crimbot schematic: Mobile Girder
Crimbot schematic: Nerding Module
Crimbot schematic: Power Arm
Crimbot schematic: Power Stapler
Crimbot schematic: Really Big Head
Crimbot schematic: Refrigerator Chassis
Crimbot schematic: Ribbon Manipulator
Crimbot schematic: Rivet Shocker
Crimbot schematic: Rocket Skirt
Crimbot schematic: Rodent Gun
Crimbot schematic: Rollerfeet
Crimbot schematic: Security Chassis
Crimbot schematic: Sim-Simian Feet
Crimbot schematic: Snow Blower
Crimbot schematic: Swiss Arm
Crimbot schematic: Tripod Legs
Crimbot schematic: Wrecking Ball

Thanks and Merry Crimbo!
 
If they are in your inventory and you want it to make sure you have one of each, you can put them in a map or array and do
Code:
 foreach it in ($strings/map) find 1 it [code] 
That will make sure you have one of each and if you don't and have mall buy on, it will buy it for you.

The "easiest" way to put them in a strings array (example: $strings[schem 1, schem 2, etc]) but a less tedious way would be to create a simple matcher, visit this post, and let the matcher pick each one up and then use the "find 1 X" on it.
 
Last edited:

fronobulax

Developer
Staff member
I used Ye Olde Text Editor to make an ash script that turned each line in the "I want it" file into an "acquire it" command. That was a whole lot faster than debugging a script that read a file. YMMV.
 

Theraze

Active member
Problem there is that you are acquiring items that cost more than a million meat, so find/acquire/retrieve_item will abort unless you put your autoBuyPriceLimit up crazy-high.

I actually posted an alias that will do that for you automatically in the crimbot botting thread, but here's a repeat.
Code:
alias crimboschem => ashq foreach it in $items[] if (it.to_string().contains_text("Crimbot schematic") && item_amount(it) < 1 && mall_price(it) < 5000 && mall_price(it) > 0) buy(1, it)
Note that this one will only buy schematics cheaper than 5k. If you want ALL buyable schematics, either put 3 more 0s on the 5k line, or just remove that part entirely. Don't remove the last part though, because there are a few non-mall schematics and you don't want the script to have problems there.
 

Raven434

Member
Posthumous TYVM for the help here.

And yes, raze, I did see your alias, I just had a brain fart on the autobuy / price aspect.

It's hell getting old...

:-/
 
Top