Auto Farm
Reads and switches Auto Farm, the Rotation Builder's farmer. Auto Farm picks the best spot on the current map, goes there and attacks whatever is in reach, and follows the character to the next map. Its switch is saved with your settings, so Auto Farm left on starts again after you log in, reconnect or restart the game.
Your own keys still reach the game while Auto Farm farms, and so do scripts' key presses: core.input.press_key(), hold_key(), release_key(), use_item(), use_skill() and call_wndproc() work as usual. Calls that move the character, such as core.input.teleport(), move_x() or core.nav.path_to(), are refused with Rotation Builder owns the input while Auto Farm is active.
Functions
core.farm.is_enabled() -> boolean
Returns true while Auto Farm is switched on, including while it waits to get into the game or for a map where monsters spawn.
core.farm.is_active() -> boolean
Returns true while Auto Farm is moving the character and attacking on the current map. Returns false while it waits, while it changes maps or starts over, and while it is switched off.
core.farm.status() -> table
Returns what Auto Farm is doing right now:
| Field | Type | Description |
|---|---|---|
enabled | boolean | Auto Farm is switched on |
active | boolean | Same as is_active() |
state | string | What it is doing; see the table below |
map_id | number | The map it is farming or waiting on; 0 when it is off |
kills | number | Monsters killed since it last started on this map |
run_seconds | number | Seconds since it last started on this map |
| State | Meaning |
|---|---|
off | Auto Farm is switched off |
not_in_game | Waiting for the character to be in the game |
busy | Waiting while a loop or another feature uses the character |
no_monsters | Waiting for a map where monsters spawn |
no_attack_key | Waiting: put an attack skill on a hotkey |
no_jump_key | Waiting: put Jump on a hotkey |
idle | Farming, with nothing to hit from any spot it can reach |
travelling | Heading for the spot it chose |
attacking | Attacking from its spot |
attack_refused | The game is not taking the attack (MP, a cooldown or a status); it tries again every second |
changing_map | The map changed; it starts again once the next map has loaded |
dead | The character died; it starts again once the character is back up |
restarting | Starting over; it carries on in a moment |
paused | Another feature is using the character (the map rusher, Evasion, the lie detector or an auto-sell trip); it starts again once that is done |
core.farm.start()
Switches Auto Farm on, the same as Start on the Farm page. It starts once the character is in the game on a map where monsters spawn, and stays on, also after logging in again, until it is switched off.
core.farm.stop()
Switches Auto Farm off, the same as Stop on the Farm page. The switch is saved, so Auto Farm stays off at the next login too.
Example
local was_active = false
function on_tick(stage)
local active = core.farm.is_active()
if active ~= was_active then
was_active = active
core.log(active and "Auto Farm is farming" or ("Auto Farm: " .. core.farm.status().state))
end
end