There is an ash function rollover() but it is not documented on the wiki.
Some tracing through the code indicates that this is UNIX time of next rollover, populated as part of ApiRequest (as part of processing api.php).
One approach you could take with a chatbotScript is to look out for the System Announcement indicating X minutes to rollover, then just sleep "an amount of time" until you expect rollover to be done, then cli_execute("login " + my_name());
When I have run such bots in the past, I have personally preferred to set scheduled tasks (cronjobs specifically) that kill any existing Mafia instances at a certain time, then rebuild + relaunch Mafia. This picks up new Mafia changes / script updates. (Script updates are less relevant for a chatbotScript, although I seem to recall some situations with stickiness wherein I needed a tiny script to clear + rebind chatbotScript. I don't remember the exact details, but I think it had to do with trying to load a broken version of the script.)
Thanks guys, that already helps! So what happens when I call a regular action (let's say cast a skill) and it turns out it's rollover. Will it abort, or will it hang until rollover is over and then retry? If it aborts, is there some way I can "catch" the abort?
Typically this will cause
an abort.
The wiki has a blurb on
catching aborts in ASH. If you're writing this in JS, you... might be able to use try/catch? I don't know, I've not used much JS with Mafia.