Request: Time and/or Rollover time functions

Wolffauer

New member
Hi there!

I know this was asked before, but I couldn't find anything saying a function had been added or would not be added.

I'm looking for a basic system time function. Something as simple as:
string[] time_to_string()
returning the time as "hhmm" in 24 hour format.

Alternately (or additionally) I don't know if it is possible to tell how far from or to rollover it is, but functions like:
int minutes_until_rollover()
int minutes_since_rollover()

would be very handy for scripts that you'd like to have running all day, but doing different things at different times (a buffbot in my case).

Thanks for your consideration!
 

Wolffauer

New member
[quote author=holatuwol link=topic=1230.msg5758#msg5758 date=1189880910]
May I see an example script which would make use of those functions?
[/quote]

I've attached an example script (a bit out of date on the adventuring side), but the main loop is the only place that would use these functions.

void main()
{

cli_execute("outfit Buffing Suit");

boolean can_keep_going = (my_meat() > 200000 || item_amount($item[magical mystery juice]) >= 2000);
boolean have_adventured = false;

while(can_keep_going)
{
// Run the buff bot for a bit
cli_execute("buffbot 5");

// Make sure we have enough MMJ
if (item_amount($item[magical mystery juice]) < 2000 && my_meat() >= 190000)
{
buy(2000, $item[magical mystery juice]);
}

can_keep_going = (my_meat() > 200000 || item_amount($item[magical mystery juice]) >= 2000);

// Is it after 4 AM, and do I still need to run my adventures?
if ((have_adventured == false) && (string_to_int(time_to_string()) > 4000))
{
breakfast();
eat_stuff();
drink_stuff();
wad();
ensure_buffs();

if (stat_bonus_tomorrow() == $stat[Moxie] && stat_bonus_today() != $stat[Moxie])
{
do_adventures(my_adventures() - 91);
}
else
{
do_adventures(my_adventures());
}
have_adventured = true;

cli_execute("outfit Buffing Suit");
}

// Are we getting close to rollover?
if (minutes_until_rollover() < 10)
{
// If so, put on the PJs and logout.
cli_execute("outfit Rollover Gear");
cli_execute("exit");
}
}

// Can't keep going - put on the PJs and exit
cli_execute("outfit Rollover Gear");
cli_execute("exit");
}
 

Attachments

  • example.ash
    5.7 KB · Views: 70

holatuwol

Developer
I've looked over the script, and I have a few questions.

As it stands, the only part of the script which sounds like it'll need any vague idea of rollover is the outfit switching. For the rollover outfit switching, what's the advantage of using your full rollover outfit vs. your buffing gear? As I understand it, the only difference is the time helmet, and if it's missing, you only lose 6 adventures each day (3 adventures, and then 3 adventures for full time gear).

For the "minutes since rollover" problem, KoLmafia doesn't keep running if it hits nightly maintenance. Is there a reason your script doesn't just run the buffbot for one interation (basically, a single buffbot iteration will absorb all mail that it sees and continue processing until you run out of messages), do your adventures, and then run the buffbot indefinitely? From your example, it doesn't seem like a function with practical use.
 

Wolffauer

New member
Outfit switching it the main use of knowing when rollover is coming, yes. The current buffing outfit I has only one item in common with the rollover outfit (stainless steel solitaire), so the advantage is closer to 19 adventures each day. The full buffing gear pushes moxie as high as possible and uses the Travoltan trousers generate MP from Moxie.

The reason I want to know how long since rollover (or just what time it is) is that I can run my adventures a few hours after rollover. The theory is that lots of folks like to run right after rollover, and I've got no reason to add to the load then.

As for the rest, I inherited the code so it may change as I get a better feel for what works and what doesn't. It is currently set up to run the buff bot and regularly stop and see if we need to buy more MMJ. That may be all automated at this point and not needed, but it is independent from the time check stuff.

The solution that I was given involves having several different scripts and using the task scheduler to switch between them at specified times. I was hoping to get a function or two that would let me combine everything into a single script I can run each day.
 
Top