a Buffbot script

Darkness

New member
Here is a script i have been working on to autorun a clan buffbot.
It eats, drinks, spleens, adventures at the gym until mp is full.
Then runs the buffbot for a while, autobuffs some clan members then goes back to the gym.
Eventually it runs out of adventures and just sits in buffbot mode.
The script is a bit messy but it seems to work ok.
We are not an uber rich clan, but this method reduces the costs quite a bit.

I want to add a few things:
1) Statday recognition. Turn banking + alternate food/booze.
2) Recognising fullness (saving it somehow).
3) Recognising Rollover time (using all adventures before then, reset fullness)
4) Clean abort. Sometimes I want to be able to manually buff players and have to use cli abort + pressing stop in the buffbot.

Any advice would be appreciated.
 

Attachments

  • magauto.ash
    3.7 KB · Views: 93
stat stat_bonus_today()
stat stat_bonus_tomorrow()

Returns the stat that is benefitted by the moon phases today or tomorrow. If it is an “ordinary” day, the return value is $stat[none].

If I were you, I would switch over to using less cli_execute commands, and more actual ash functions.

Saving fullness:
string get_property( string key )
boolean set_property( string key, string value )

Gets or sets a stored property from your character’s .kcs file.
The KoLmafia properties page contains details on many of the keys that are available for access.
These properties can be user defined properties.
string today_to_string()
Returns today’s (real-world) date in the form yyyymmdd. It is based on your computer’s system date

so if you set a property say "fullness_" + today_to_string() the first time you eat a chow, and increase it each additional time, you have it.

Code:
 while (true)
 {
 	cli_execute("buffbot 100");
 }

You really should add in obtaining MP restorers into that loop.
 

Darkness

New member
Thanks for the tips efilnikufecin.
I will probably re-write much of the script using ash functions.
Wow the KoLMafia Wiki has been updated! Yay scripty info.

Edit: Since rollover is at around 2pm here, the current system date is not enough to determine if the game has advanced a day since eating.
Is there a function for local system time? Or is there a function to return the current kol date?
Local system time would also be handy for calculating time until rollover.
 

Nightmist

Member
[quote author=Darkness link=topic=709.msg3361#msg3361 date=1169341881]
Edit: Since rollover is at around 2pm here, the current system date is not enough to determine if the game has advanced a day since eating.
Is there a function for local system time? Or is there a function to return the current kol date?
Local system time would also be handy for calculating time until rollover.
[/quote]
I'm pretty sure the today_to_string command is set to EDT (Think its EDT) so it should work for rollover checks. (A print of today_to_string returned 20070121 when its the 22nd in my country (+12 GMT)

[quote author=holatuwol link=topic=526.msg2555#msg2555 date=1161157736]
the date formatter has been updated to assume EDT, which will make it near-accurate for rollover detection purposes until Daylight Saving Time ends.
[/quote]
 

Darkness

New member
I've been using the today_to_string() for a little while now and it works fairly well for rollover checks.
However it fails at the start and end of day; which is bad.

A function that returned the current KOL date would be much better.
I guess this info could be stripped from the chat panel.

EDIT: The new (10.6) spleen and fullness counters are nice. Can we access them in the ash?
Also getting the date from the Chat pane would enable saving the fullness/spleen counter.
This would be great but i dont know how to access the closed chat pane.
Using visit_url() with the link to the startchat doesnt return anything...
 

Attachments

  • magauto.ash
    7.8 KB · Views: 51
oddly enough the data you require is stored in the charpane. It is kind of difficult to parse for the date though. If you have some extensive experience in excel, you will be able to understand the format.
PHP:
<script>
var rollover = 1171769400;
var rightnow = 1171685835;
var pwdhash = "snippity snip";
</script>

simplicity: subtracting "rightnow" from rollover should give an approximate number of seconds till rollover: 83,565
divide that by 60 gives minutes: 1,392.75
divide by 60 again gives hours: 23.2125
using remainders you can get an hh:mm:ss format
I believe the ! operator gives the remainder of a division operation so "83565 ! 60" should give 45 and "1392 ! 60" should give 12 so 23 hours 12 minutes and 45 seconds till rollover in the above example...if my math is right.

looking at charpane.3.js reveals: "// No, you're not getting exact server time. I add or subtract a random amount of time to it to make it deliberately inaccurate." The inaccuracy level (seconds or minutes or hours or days or whatev) is not exactly known, however once "rightnow" is higher than the last known state of "rollover" it seems it should absolutely be a new kol day. I'm sure the inaccuracy in the time given is for security reasons.
 

Nightmist

Member
[quote author=efilnikufecin link=topic=709.msg3727#msg3727 date=1171688293]
if my math is right.
[/quote]
Assuming the ! does mean "mod" then yeah thats the right figures. (Incase anyone wants to know, if your using MS "calc" in scientific mode you can use "%" to act as "mod", so 83565 % 60 = 45... or use the "mod" button but heh =P)
 
Is it % in ash? it's been quite some time since I first asked about it, and I cannot remember, but I think it actually is %. anyway ! is the not operator so I don't think it's right heck I dunno. I need to go to bed :(
 
Top