Example Buffbot Script:

Aprocalypse

New member
This isn't meant to be used by anyone else, however, I recall a while back someone was interested in how I script my buffbot, IocaineBot - here's the main script.

Currently, I use three different scripts, (well, four, technically, and a batch file), IocaineBot.ash, IocaineBotPrestat.ash and IocaineBotStatDay.ash.

IocaineBot.ash = average day
IocaineBotPrestat.ash = the day before stat days
IocaineBotStatDay.ash = stat day

I could put them all together in one file with the new ASH functions for determining stat day, but just to make it easier for myself to read, I kept them seperate. The only real difference is that IocaineBotPreStat.ash is IocaineBot.ash, leaving enough adventures to have 200 adventures on a stat day. IocaineBotStatDay.ash consumes higher quality food (too costly to eat daily), but else is the same as IocaineBot.ash.

I'm only uploading and explaining IocaineBot.ash, because I'm a lazy bastard, and this is only really for show, not for actual use.

Changes that'll probably happen includes cuttinng down on the Moxie Buffs used (to increase MP, due to MP being juged from moxie, due to the moxie magnet - could use a equalising potion instead, for other offhand items to be used... costlier though).

The fourth script simply is ran from a batch file (which is ran at 2:30 each day(30 minutes after the end of rollover, incase of long rollover), which logs on the character, and then tests what kind of day it is, then runs that script. Huzzah.


Basically what the IocaineBot.ash script does (brackets show things that would be edited to be of use to others, [square brackets show comments]):

- Check if Drunkeness is under 15 (15 changed to 20 if character has liver not stomach)
- run breakfast routine
- Buys/uses 1 milk of magnesium
- eats 20 fullness worth of food, [4 chow meins], with a munchies pill each.
- Drinks 2xMoxie Superhuman DB drink, drink 2xTPS [will put character overdrunk, will buy items if need be] (Change drink routine, if have liver)
- run adventure routine
- If adventures greater than 10
- adventure 5 adventures at zodiac gym [done to reduce outliers]
- If adventures lower than 10
- adventure 1 adventure at zodiac gym [done to reduce outliers]
- run spleen routine
- Use ten twinkly wads [10 spleen]
- Adventure 10 adventures at zodiac gym
- Use 1 of each elemental wad [5 spleen]
- Use/buy a load of +moxie buffs
- End Drunkeness check
[after here is always run, no matter drunkeness]
- Create infinite loop
- Run buffbot for 15 iterations
- If number of MMJs under 1000 (change to whatever) [Ensure meat on hand!]
- Buy 5000 MMJs [Ensure meat on hand!]
- Restart infinite loop

The advantage of this is, one script can be used for running, powerleveling and restarting the bot in case of a crash.

So, eh, have a look.
 

Attachments

  • iocainebot.ash
    3.6 KB · Views: 238

Tirian

Member
I suspect it means that most of us don't see the need to buy MMJs 5000 at a time. :)

My main thought looking over this script, besides seeing how the other half lives, is that buying items from the mall one at a time is tough on you and probably worse on the server. I've got to figure that KoLmafia does a separate mall search for each of the ten twinkly wads you buy even though the market hasn't changed in the few seconds between them. You might want to consider adding in a helper function like this:

Code:
void buy_up_to( int quantity, item it )
{
  buy ( quantity - item_amount( it ), it );
}

Aside from that, wow, neat.
 

Aprocalypse

New member
My main thought looking over this script, besides seeing how the other half lives, is that buying items from the mall one at a time is tough on you and probably worse on the server. I've got to figure that KoLmafia does a separate mall search for each of the ten twinkly wads you buy even though the market hasn't changed in the few seconds between them. You might want to consider adding in a helper function like this:

I always meant to do that... but whenever I do, laziness overtakes me. Seriously, I'm so lazy that it makes KoL lag. <_<

I suspect it means that most of us don't see the need to buy MMJs 5000 at a time.

500k worth of MMJs takes you less far than you'd think. >_< I usually randomly log in and buy 10k or so.
 

Nightmist

Member
[quote author=Aprocalypse link=topic=339.msg1833#msg1833 date=1155304963]
I don't get it. <_<
[/quote]

=P Yeah I ment the buying sooo many MMJ's... without a meat check =P. Which is rather amusing to me but I clearly have a abnormal sense of humor xD.

[quote author=asturia link=topic=339.msg1880#msg1880 date=1155491570]
just a question nothing to do with the script.
How do you fund this bot?
[/quote]
This is me guessing but I assume the amount of meat send in (Donations+purchases) will be break even or very close to the running costs of the bot. Thats just a guess though, I've never personally ran a buffbot before so I can't really say for certain.
 

Aprocalypse

New member
How do you fund this bot?
This is me guessing but I assume the amount of meat send in (Donations+purchases) will be break even or very close to the running costs of the bot. Thats just a guess though, I've never personally ran a buffbot before so I can't really say for certain.

There is a small amount of meat that is regained through purchases, and a signifigant part through donations, there's a slow leak of funds out of that bot which means I need to top it up occaisonally, except the changes to the KoLMafia purchase interface may change that. I'm going to lower the number off buffs in a bit (when I update the Mafia script to use the correct eat/drink), which should cut down the costs signifigantly.

=P Yeah I ment the buying sooo many MMJ's... without a meat check =P. Which is rather amusing to me but I clearly have a abnormal sense of humor xD.

I should probably put a check there in case of a mafia problem, too, ensuring all meat is not burned. <_<
 

Artscrafter

New member
First off, thanks for posting this. It was quite helpful as a reference while I was writing my own buffbot script. (To think that I almost forgot to include the use of wads!) One quick critique though: I'm not sure why you're creating and iterating a variable for your infinite loop here:

Code:
int z;
z = 1;
while (z > 0)
    {
	cli_execute("buffbot 15");
	while( item_amount ($item[magical mystery juice]) < 1000)
		buy(5000,$item[magical mystery juice]);
	z = z + 1;
    }
I could imagine that this would be useful if you wanted to know how many times it's gone through the loop, but you never dump z out anywhere. I'd recommend replacing it with the following:

Code:
while (true)
    {
	cli_execute("buffbot 15");
	if( item_amount ($item[magical mystery juice]) < 1000 && my_meat() > 500000)
		buy(5000,$item[magical mystery juice]);
    }

That gives you the meat check too.
 

Aprocalypse

New member
This is a very old version now, and that variable was created for future versions I was intending to write. (my current script version now reports amount of uptime)

The new version is condensed into one script, which detects what kind of day it is, and whatnot. I'll upload that when I get a chance - it's a much more elegant solution than this script. :)

Also, thanks for the code critique. [That'll make me remember to put the meat check in too, hopefully] :)
 
Top