PullCrap! A script to buy stuff before ascension, and pull it after.

Rahmuss

Member
I'm trying to do something similar to this; but I want to create lists for various aspects of the game and I want to be able to run a script that will ask for the .txt file name that it needs to buy. For example, I could have one called sewers.txt and the script (something like buyList.ash) would run and ask me which filename and I would enter sewers.txt and then it would go through that list and if I already had the desired amount then it would skip those items and only buy things which I was still missing. Does that make sense?

I saw this part of the BuyCrap.ash code and I'm not a programmer, so I'm not sure how to implement this:

foreach priority in pulls
{
foreach pullItem in pulls[priority]
{
if (pullItem == $item[none])
print("ERROR - one of the items in your purchase list is misspelled. To find out which one, run this script with SIM = true, and look at the items that occur in proximity to this error.");
buyit(pullItem, pulls[priority,pullItem].number);
}
}


that code seems to check if I already have the item; but I don't know how to put that all into a script. Any clues?
 

Bale

Minion
I'd do something like this:

Code:
main(string filename) {
	int [item] mycrap
	file_to_map(filename+".txt", mycrap);
	foreach it in mycrap
		if(item_amount(it) < mycrap[it])
			print(it+": Have only "+item_amount(it)+" of "+mycrap[it], "red");
	print("All other items are good!", "green");
}
Note that you should just enter sewers without the .txt

The file sewers.txt would hold a list of items and quantities separated by tabs. Each item is on its own line.

I haven't tested this code at all, so it might be messed up.
 
Last edited:

Rahmuss

Member
Thanks Bale, I'll have to test this out later.

So in my text file, which comes first, the chicken or the egg?.... err... I mean, the amount of items, or the item name?
 

Rahmuss

Member
Just to make sure, because I can't read code all too well, this small script file will read the list in the .txt file and it will buy the items in that list right? And it will skip over items that I already have all of, is that right? I guess I should just test it out (really looking forward to it); but I won't be able to for another 8 hours or so).
 
The code Bale posted doesn't actually buy anything, it just tells you which items you're missing. To actually buy the items you'd need to add a buy command to the foreach loop and if you're going to have more then one command in the foreach loop don't forget to add the curly braces.
Code:
buy(mycrap[it] - item_amount(it),it);

Edit: If you need further help with this it's probably better to start your own thread.
 

Rahmuss

Member
Like this?

Code:
main(string filename) {
	int [item] mycrap
	file_to_map(filename+".txt", mycrap);
	foreach it in mycrap {
		if(item_amount(it) < mycrap[it])
		buy(mycrap[it] - item_amount(it),it);
		print(it+": Have only "+item_amount(it)+" of "+mycrap[it], "red");
	}
	print("All other items are good!", "green");
}
 

Bazaaretw

Member
Ok so I'm a little confused as to which column is used to determine how many of the item to buy from buycrap! could you clarify a little bit, and the list on the main page to the thread is broken I believe.

Well I figured it all out.

I am having 1 problem the script is not recognizing "Meleegra™" as the correct spelling I've also tried "Meleegra" and "Meleegra&trade"
 
Last edited:

Bazaaretw

Member
I'm also interested as to what people think, pointers, or just a thanks for putting togeather a full list.

*Also note that if you actually have the speed ascension gear then you'd change the zeros to ones.

Crap.txt
Code:
#Priority - item name - number to pull (may be zero) - if not pulled by this level, never pull. dayone = pull 

before starting the first day.  never = do not auto-pull.
1	rock and roll legend	1	dayone
1	Spooky Putty Mitre	1	dayone
1	jewel-eyed wizard hat	0	dayone
1	Haiku Katana	0	dayone
1	ice sickle	0	dayone
1	Bag o' Tricks	0	dayone
1	pilgrim shield	0	dayone
1	Travoltan Trousers	0	dayone
1	V for Vivala mask	0	dayone
1	navel ring of navel gazing	0	dayone
1	moveable feast	1	dayone
1	C.A.R.N.I.V.O.R.E. button	1	
1	stainless steel scarf	1	
1	Mr. Accessory Jr.	0	
1	Mr. Accessory	1	
1	quadroculars	1	never
1	aquaviolet jub-jub bird	1	never
1	clockwork pirate skull	1	dayone
1	facsimile dictionary	1	dayone
1	dope wheels	1	dayone
1	chef-in-the-box	1	dayone
1	bartender-in-the-box	1	dayone
3	Spooky-Gro fertilizer	1	
4	filthy knitted dread sack	1	never
4	filthy corduroys	1	never
4	bugbear beanie	1	never
4	bugbear bungguard	1	never
4	Knob Goblin elite helm	1	
4	Knob Goblin elite pants	1	
4	Knob Goblin elite polearm	1	
5	ring of conflict	1	
5	monster bait	1	
6	sonar-in-a-biscuit	4	4
7	harem veil	1	
7	harem pants	1	
7	knob goblin perfume	2	4
8	disassembled clover	3	
8	7-Foot Dwarven mattock	1	9
8	miner's helmet	1	9
8	miner's pants	1	9
8	asbestos ore	3	never
8	chrome ore	3	never
8	linoleum ore	3	never
8	pool cue	1	
8	handful of hand chalk	1	
1	dingy planks	1	
10	dungeoneer's dungarees	1	9
10	goat cheese	6	9
11	668 scroll	1	9
11	30669 scroll	1	9
11	64067 scroll	1	9
12	big book of pirate insults	1	9
12	swashbuckling pants	1	9
12	stuffed shoulder parrot	1	9
12	hot wing	1	9
12	mullet wig	1	9
12	briefcase	1	9
13	awful poetry journal	1	10
13	furry fur	1	10
13	giant needle	1	10
14	dusty bottle of marsala	1	11
14	dusty bottle of merlot	1	11
14	dusty bottle of muscat	1	11
14	dusty bottle of pinot noir	1	11
14	dusty bottle of port	1	11
14	dusty bottle of zinfandel	1	11
14	wet stew	1	11
14	ketchup hound	1	11
14	stunt nuts	1	11
14	drum machine	1	11
14	tomb ratchet	11	never
15	beer helmet	1	12
15	bejeweled pledge pin	1	12
15	bullet-proof corduroys	1	12
15	distressed denim pants	1	12
15	reinforced beaded headband	1	12
15	round purple sunglasses	1	12
15	Mick's IcyVapoHotness Inhaler	1	12
15	cyclops eyedrops	1	12
15	scroll of ancient forbidden unspeakable evil	1	12
16	adder bladder	1	never
16	Angry Farmer candy	1	never
16	Black No. 2	1	never
16	gremlin juice	1	never
16	Mick's IcyVapoHotness Rub	1	never
16	pygmy pygment	1	never
16	super-spikey hair gel	1	never
16	thin black candle	1	never
16	wussiness potion	1	never
16	handsomeness potion	1	never
16	jabañero-flavored chewing gum	1	never
16	lime-and-chile-flavored chewing gum	1	never
16	marzipan skull	1	never
16	Meleegra™ pills	1	never
16	pickle-flavored chewing gum	1	never
16	tamarind-flavored chewing gum	1	never
17	large box	4	never
17	bubbly potion	2	never
17	cloudy potion	2	never
17	dark potion	2	never
17	effervescent potion	2	never
17	fizzy potion	2	never
17	milky potion	2	never
17	murky potion	2	never
17	smoky potion	2	never
17	swirly potion	2	never
18	barbed-wire fence	1	never
18	baseball	1	never
18	black pepper	1	never
18	bronzed locust	1	never
18	chaos butterfly	1	never
18	disease	1	never
18	fancy bath salts	1	never
18	frigid ninja stars	1	never
18	inkwell	1	never
18	Knob Goblin firecracker	1	never
18	leftovers of indeterminate origin	1	never
18	mariachi G-string	1	never
18	meat vortex	1	never
18	NG	1	never
18	photoprotoneutron torpedo	1	never
18	plot hole	1	never
18	powdered organs	1	never
18	pygmy blowgun	1	never
18	razor-sharp can lid	1	never
18	sonar-in-a-biscuit	1	never
18	spider web	1	never
18	Stick of dynamite	1	never
18	tropical orchid	1	never
19	acoustic guitarrr	1	never
19	bone rattle	1	never
19	star crossbow	1	never
19	star hat	1	never
19	star staff	1	never
19	star sword	1	never
19	white pixel	30	never
19	star	8	never
19	line	8	never
19	star chart	1	never
19	filthy poultice	6	
19	Wand of Nagamar	1	
0	glass of goat's milk	1	never
0	milk of magnesium	4	never
0	Boris's key lime pie	1	never
0	jarlsberg's key lime pie	1	never
0	sneaky pete's key lime pie	1	never
0	delicious spicy noodles	4	never
0	Knob sausage stir-fry	12	never
0	bat wing stir-fry	12	never
0	rat appendix stir-fry	12	never
0	bat wing chow mein	6	never
0	knob sausage chow mein	6	never
0	rat appendix chow mein	6	never
0	spaghetti with Skullheads	6	never
0	gnocchetti di Nietzsche	6	never
0	fettucini Inconnu	6	never
0	hot hi mein	6	never
0	stinky hi mein	6	never
0	sleazy hi mein	6	never
0	Hell broth	6	never
0	digital key lime pie	4	never
0	star key lime pie	4	never
0	Mon Tiki	20	never
0	gimlet	20	never
0	prussian cathouse	20	never
0	fuzzbump	20	never
0	roll in the hay	20	never
0	perpendicular hula	20	never
0	corpsedriver	4	never
0	corpse on the beach	4	never
0	corpsetini	4	never
0	not-a-pipe	12	never
0	glimmering roc feather	6	never
0	prismatic wad	6	never
 

dj_d

Member
The header on the file defines the columns - priority, item name, number to pull, and point at which you should no longer pull.
 

Bazaaretw

Member
The header on the file defines the columns - priority, item name, number to pull, and point at which you should no longer pull.

I figured that one out :p thx

My problem now is that something on this line:

16 adder bladder 1 never
16 Angry Farmer candy 1 never
16 Black No. 2 1 never
16 gremlin juice 1 never
16 Mick's IcyVapoHotness Rub 1 never
16 pygmy pygment 1 never
16 super-spikey hair gel 1 never
16 thin black candle 1 never
16 wussiness potion 1 never
16 handsomeness potion 1 never
16 jabañero-flavored chewing gum 1 never
16 lime-and-chile-flavored chewing gum 1 never
16 marzipan skull 1 never
16 Meleegra™ pills 1 never
16 pickle-flavored chewing gum 1 never
16 tamarind-flavored chewing gum 1 never

Is misspelled, and I can't figure it out, because when I cut this entire list out it says there are not any misspellings, but I tried cutting sections of this and it still says there are misspellings, I figured it was the meleegra pills, but that's not it...
 
Last edited:

Bazaaretw

Member
I figured that one out :p thx

My problem now is that something on this line:

16 adder bladder 1 never
16 Angry Farmer candy 1 never
16 Black No. 2 1 never
16 gremlin juice 1 never
16 Mick's IcyVapoHotness Rub 1 never
16 pygmy pygment 1 never
16 super-spikey hair gel 1 never
16 thin black candle 1 never
16 wussiness potion 1 never
16 handsomeness potion 1 never
16 jabañero-flavored chewing gum 1 never
16 lime-and-chile-flavored chewing gum 1 never
16 marzipan skull 1 never
16 Meleegra™ pills 1 never
16 pickle-flavored chewing gum 1 never
16 tamarind-flavored chewing gum 1 never

Is misspelled, and I can't figure it out, because when I cut this entire list out it says there are not any misspellings, but I tried cutting sections of this and it still says there are misspellings, I figured it was the meleegra pills, but that's not it...

IT has to be the meleegra pills...

acquire 1 handsomeness potion
acquire 1 lime-and-chile-flavored chewing gum
acquire 1 marzipan skull
ERROR - one of the items in your purchase list is misspelled. To find out which one, run this script with SIM = true, and look at the items that occur in proximity to this error.
acquire 1 none
acquire 1 pickle-flavored chewing gum
acquire 1 pygmy pygment
acquire 1 tamarind-flavored chewing gum

but when I remove the meleegra pills line from the script it still says there is something misspelled.
 

Muroni

New member
I know this is a bit of necrosis here, but can anybody please tell me how to change the script so it will buy anything I'm missing from the mall, and not try to create it if I have the ability? I somehow didn't realize it would do that :(
 

lostcalpolydude

Developer
Staff member
I know this is a bit of necrosis here, but can anybody please tell me how to change the script so it will buy anything I'm missing from the mall, and not try to create it if I have the ability? I somehow didn't realize it would do that :(

I believe that in BuyCrap.ash, you want to change
cli_execute("acquire "+number+" "+it);
to
cli_execute("buy "+number+" "+it);

I'm not sure why it was a problem though, since you can just buy the ingredients it used.
 

Muroni

New member
I believe that in BuyCrap.ash, you want to change
cli_execute("acquire "+number+" "+it);
to
cli_execute("buy "+number+" "+it);

I'm not sure why it was a problem though, since you can just buy the ingredients it used.
Thanks for such a fast response. I'll test it out soon.

To answer your question about why I want to change it-for some reason, it purchased 5 glasses of goat's milk, then it checked that I wanted milk of mags also, so it made those. Then it never checked my goat's milk again. Same with everything else like that. It made sure I had a chef and a bartender, but then it used them to create the food and drinks in the list and it never made sure I had another. It checked I had the wads I wanted, then made hi mein with them and never replaced the used wads. I wanted both wads and hi mein, both milk and mags, etc. I suppose I can always just make sure I run it several times-so that it always goes back and rebuys anything it has used...Unless your fix works :)

It also made a ton of hi mein with adventures I still wanted to use today :( That's what I get for testing it before running out of adventures!

Your fix is changing "acquire" to "buy" so that means it isn't going to look at how many I already have, is that correct?
 
Last edited:
Top