The scheduler is the central automation loop of the macro. Once activated via the Toggle Active button, it fires every 1,000 ms using AutoHotkey’sDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Flyingbacen/Sols-Biome-Randomizer-Macro/llms.txt
Use this file to discover all available pages before exploring further.
SetTimer, checks how much time has elapsed since each item was last used, and executes item-use or AFK actions as needed. Everything else in the macro — cooldown tracking, GUI updates, crafting resume — flows outward from this single recurring function.
How It Works
TheScheduler() function runs on a fixed SchedulerIntervalMs of 1,000 ms (one second). Each time it fires it works through a strict priority chain:
Re-entrancy guard
The very first thingScheduler() does is stop its own timer with SetTimer(Scheduler, 0). This prevents a second invocation from overlapping if an action (e.g. opening the inventory and clicking through menus) takes longer than one second to complete. The timer is unconditionally restarted at the end of the function — or on the return path after an AFK action — so the interval remains consistent.
Priority order
- AFK check first. If
(now - lastAFK) >= AFKIntervalMs, the AFK action fires immediately regardless of item cooldowns. AfterDoAFK()returns,lastAFKis updated and the scheduler returns early, deferring item checks to the next cycle. - Both items ready. If both the Biome Randomizer and Strange Controller cooldowns have elapsed simultaneously, the macro uses the Strange Controller first, sleeps 500 ms, then uses the Biome Randomizer. Timestamps are updated individually after each successful use.
- Only Biome Randomizer ready.
UseItem("Biome Randomizer")is called; on successlastUsedBiomeis updated. - Only Strange Controller ready.
UseItem("Strange Controller")is called; on successlastUsedStrangeis updated.
UseItem() call returns false (because the toggle is off), the timestamp is not updated, so the scheduler will try again next second without artificially resetting the cooldown.
The full top-level scheduler logic:
try block surfaces as a MsgBox so you can identify the line that failed without the macro silently dying.
Cooldown Tracking
All three timestamps —lastUsedBiome, lastUsedStrange, and lastAFK — are stored in memory as millisecond tick counts (A_TickCount). Cooldown durations are loaded from settings.ini in minutes and converted to milliseconds at startup:
Biome Randomizer: MM:SS, Strange Controller: MM:SS, AFK action: MM:SS) are refreshed by a separate UpdateGui timer that also fires every 1,000 ms. This keeps the display responsive without coupling it to the scheduler’s own execution time. The labels show “Ready” when the remaining time drops to zero or below.
Force Actions
Each item and the AFK action has a corresponding Force button in the GUI:- Force Biome Use — calls
UseItem("Biome Randomizer")immediately and, on success, setslastUsedBiome := A_TickCount. - Force Strange Use — calls
UseItem("Strange Controller")immediately and resetslastUsedStrange. - Force AFK — calls
DoAFK()immediately and resetslastAFK.
Cooldown state is not persisted between sessions. Every time you launch the macro,
lastUsedBiome, lastUsedStrange, and lastAFK all initialise to 0. Because A_TickCount starts well above zero, the very first scheduler cycle will see all three as immediately ready and use both items (and fire an AFK action) right away. Use the Force buttons or simply wait for the actual in-game cooldowns before toggling the macro on if you have recently used the items.