PDA

View Full Version : A script to automatically sell starter equipment



RealBurgerKing
06-30-2011, 09:17 AM
This is the first ash script I have uploaded for mass use. It does just what it says. I find that having to constantly select and autosell these items after KoLmafia gets clovers from the hermit tedious. I thought I would share the love. If you already have a script set up to run at breakfast, you can easily automate this by adding:


cli_execute("call scripts\\AutosellStarterEquipment.ash");

as the first line within the main function of your breakfast script. Enjoy!

5018

Bale
06-30-2011, 09:32 AM
Whoa! Why would you do that?! Are you aware that the chewing gum on a string will not produce any starter equipment if you have 1 of each type. The best way to ensure you get worthless items is to have all the starter stuff in your inventory.

You're actually costing yourself meat every time you autosell starter equipment.


Also, to critique your script, there is a command to autosell() (http://wiki.kolmafia.us/index.php?title=Autosell) items so you should not use cli_execute() for that. The CLI autosell command does not interact with batch_open(). Aside from that it is pretty well done for a first script.

Now for something more advanced. You might also find it interesting that you can do this:


foreach EquipItem in $items[seal-skull helmet, seal-clubbing club, helmet turtle, turtle totem, pasta spoon, ravioli hat, saucepan, hollandaise helmet, disco mask, disco ball, mariachi hat, stolen accordion]

RealBurgerKing
06-30-2011, 09:42 AM
SAY WHAT?!?!?!?!?! I had no idea! *smacks self on forehead and yells DOH*. Thanks for the help Bale. BTW, don't you ever sleep?

Bale
06-30-2011, 10:21 AM
To expand upon what I said about chewing gum: Specifically it won't give you any item that you have as long as there is an item you do not have, so if you have all the starter gear and you lack a worthless item then you will get the worthless item you lack. If you have all starter gear and all three worthless items then you will get extra starter gear so make sure you don't use gum in that state. (If you've got all three worthless items, closet them before using more gum.)

That was probably more information than you really needed, but the inaccuracy in my above post was annoying me.



BTW, don't you ever sleep?

I do sleep, but I do it in a different timezone.

RealBurgerKing
06-30-2011, 06:47 PM
Ok, here's the revamped script to sell all starter equipment in inventory, except for 1 of each.4948

Veracity
06-30-2011, 06:57 PM
(If you've got all three worthless items, closet them before using more gum.)
And "acquire worthless item" will do exactly that kind of closet shuffle for you.

Bale
06-30-2011, 08:31 PM
Ok, here's the revamped script to sell all starter equipment in inventory, except for 1 of each.4948

Why didn't you use the ASH autosell() (http://wiki.kolmafia.us/index.php?title=Autosell) command instead of removing batch_open() and batch_close()? Using the cli command like that you are only selling 1 item at a time instead of up to 11 with a single server hit.

The cli command also has an odd issue: If you want to sell an item that has a number as the first part of its name it will throw an error. (The 1337 7r0uZ0RZ is just one of these.)

RealBurgerKing
06-30-2011, 08:41 PM
Mmkay, I took your advice Bale, and recoded the script using the autosell function. Here's the result:

4950

Bale
06-30-2011, 08:44 PM
Better and simpler both. But you forgot to re-add the batch_open() and batch_close() like you had in your first version. Those save server hits so they are very important. Saving server hits is good for everyone who plays since it helps reduce lag.

RealBurgerKing
06-30-2011, 08:50 PM
Mmkay, next build with batch_open() and batch_close().

4951

Bale
06-30-2011, 09:07 PM
Hm. I see a problem right here:


int AutosellItem(item EquipmentName)
{
if(item_amount(EquipmentName) > 1)
{
autosell((item_amount(EquipmentName) - 1), EquipmentName);
return (item_amount(EquipmentName) - 1);
}
return 0;
}

This function will always return 0. You should be able to figure out why.
(Hint: both return commands always return 0!)

RealBurgerKing
06-30-2011, 09:18 PM
*DOH*

Lol, it seems code is never bug free.

Next build: 4952

Bale
06-30-2011, 09:45 PM
Looks great to me! Congratulations on your first posted script.

slyz
06-30-2011, 10:14 PM
Congratulations on your first posted script.
You are still eligible for my KoLMafia Scripting Contest (http://forums.kingdomofloathing.com/vb/showthread.php?t=187554)!

RealBurgerKing
07-01-2011, 01:49 AM
Thanks Bale, and thanks slyz for the offer. I might just might make a submission. :)