Hi Everyone,
Onto my second last 99 (Sailing), and unfortunately noticed that the amazing Crab Mode made by Fleshgod_ would bug and disconnect, quick google and noticed a few other users were having some problems. The issue is caused by iOS misfiring in the automation process and causing the shortcut logic to fail.
So after a bit of work here is an inspired version that hopefully others might find useful.
SETUP STEPS
Create a focus mode called “
AFK Mode
”
Download and save the following Shortcuts
AFK - Setup
AFK - Clear Idle (Sub Routine shortcut)
AFK - Write State (Sub Routine shortcut)
AFK - Kill Switch
AFK - Revive
AFK - Start
AFK - Interrupt
Create the following Automations.
When creating the automations ensure the settings are
Automation – “Run Immediately”
Notify when Run – Turned Off
When App (Runescape) is closed, do AFK - Start
When App (Runescape) is opened, do AFK – Interrupt
When Focus Mode (AFK Mode) is turned off – do AFK – Kill Switch
There is an optional automation redundancy that if your switching to common apps during your AFK time. Example of Reddit but you can create multiple if there is a few different you use. I have 3 (Messages, Safari & Reddit)
When App (Reddit) is opened, do AFK - Revive
4. Adjust the required settings.
Go to Settings -> Shortcuts -> Advanced and toggle “Allow Deleting Without Confirmation” ON
5.
NOTE
On the first run of each shortcut, click ALWAYS ALLOW when it pops up. (This will allow the shortcuts to create/delete files without input)
6. Run AFK – Setup shortcut first to create files and folder
7. Switch to Focus Mode “
AFK Mode
”
8. Test run manually AFK – Start. This should make OSRS open / become the foreground App.
9. Swipe out of the app, Wait 1 minute and OSRS should be reopen / become foreground App.
10. Switch Focus Mode “
AFK Mode
” OFF or Change to a different Mode.
11. A prompt should appear saying that the kill switch was activated.
12. Swipe out of the app, Wait 1 minute and OSRS should not reopen / become foreground App.
How it works
When you close the game it starts a timer that will open the game after ~50 seconds.
Normally this would pose a problem if you open/close the app repeatedly because it starts multiple overlapping timers, but this setup avoids that.
See the Technical Explanation if you’re curious.
Technical explanations for nerds
The principle developed in the Crab Mode is still used here, with some additional redundancies to keep the process alive & firing.
Using a simple wait process will queue up another overlapping wait and double-open the app. In IOS Shortcut/Automations there’s no way to cancel a shortcut Wait operation.
To get around this, we do shorter waits in a loop and check a mutex lock file (AFK_idle.txt) to see if the wait should be terminated early.
This mutex lock file (AFK_idle.txt) also prevents kicking off a wait cycle if one is already running.
We take this 1step further to combat when iOS misfires and doesn’t run the onClose automation by creating a file so other shortcuts can work out whats happening and hopefully restart the process.
Loop_state.txt
is used to stop two shortcuts running at the same time. With it, Start knows not to run a duplicate, Revive knows whether to take over or back off, and the inner loop knows when it’s been told to stop.
Alive - Loop Running
— Start is running and in control. Any other shortcut that tries to start sees this and backs off.
Handoff - Restarting
— A new Start just fired and is telling the currently running one to stop and hand over.
Dead - Loop killed on open
— You (or Start) opened OSRS. The loop has stopped intentionally.
Exited - Changed Modes
— AFK Mode was turned off mid-session. Loop stopped cleanly.
Exited - Kill Switch
— You manually killed the session.
submitted by
/u/teflonfish
Originally posted by u/teflonfish on r/OSRSMobile
