Feature cronjob-like setting

Ulti

Member
I'd like to see the ability that every "x" seconds, KoLMafia can run a saved command in the gCLI. I don't care if it get queued or not, but the idea is that one should be added to the queue on an interval. I know it's possible to have the interval controlled by JavaScript and ping KoLMafia, but I'd rather that KoLMafia had a built-in cronjob-like feature. When the command is finally run, I believe it would be easy for scripters to control an "_" property regarding the last time the command was run to know whether or not to run the 2nd command so close to the first depending on the scripter's needs. The task I had in mind was checking pending clan applications, the clan activity log, and logging my KoLMafia activity regularity to decide if I'm by my computer clicking in-game doing anything or probably doing other stuff. Then based on my activity decide if I'm inactive and probably doing other stuff, run my farming script if I have adventures left. Then check up on the script about 5 minutes later check on my activity again to decide if the script is doing anything. If not, decide if the script encountered an error and attempt to re-run it. After 3 attempts or so, decide not to run it anymore, then as rollover approaches to overdrink if I'm not gonna lose turns to rollover, then finally equip my rollover gear. I understand all this can be controlled by JavaScript within the relay browser, but I think having it built it allows me to not keep a KoL open in a tab if I'm busy nor put unnecessary HTTP Request strain on the browser if Java can handle this already.
 
Couldn't you fairly trivially implement that with wait()?

EDIT - Oh, I see. You want to be able to do other things manually in mafia inbetween calls.
 
Last edited:

Ulti

Member
Interesting concept. How are you planning on detecting your activity?

If my mainpane is navigating around, JavaScript can detected this and ping mafia to update a "_" property with the timestamp JavaScript detected. (if the timestamp differs from Mafia by too much, it would understand it's running the ash script late after being queued for a while)
I'm thinking have the top window set an onbeforeunload or onunload property on the mainpane frame which would ping the top frame to wait a split second then set an onbeforeunload or onunload property on the next page in the mainpane then ping mafia with the timestamp. Also it would check on the frame on an interval in case a page errored or something to make sure the current page loaded in the frame has such an event listener set.
 
Last edited:

Ulti

Member
Just wanted to bump this request because I thought of another use for it, auto-equipping your rollover gear near rollover without getting sworded or staphed, based on a cronjob-like setting, maybe 5 mins to rollover.
 

lostcalpolydude

Developer
Staff member
Just wanted to bump this request because I thought of another use for it, auto-equipping your rollover gear near rollover without getting sworded or staphed, based on a cronjob-like setting, maybe 5 mins to rollover.

That could be handled by a chatbotScript, I think. Or you could wear a lamp and never deal with the sword/staph again.
 
Top