75 lines
4.2 KiB
Markdown
75 lines
4.2 KiB
Markdown
# Villager Macro
|
||
|
||
Macro replaces the old generic recorder with the supplied `trade.ahk` workflow.
|
||
The AutoHotkey source and its Desktop INI are read only; the client stores its own
|
||
configuration in the active client profile under `profiles` beside the DLL.
|
||
An existing `villager-trade.ini` is still read for initial migration.
|
||
|
||
## Use
|
||
|
||
1. Enable **Macro** in **UTILITY**, then close the client menu and open a villager.
|
||
2. Hover the trade row and press **F7**, then the trade button and press **F8**.
|
||
3. With a villager out of stock, hover the red X and press **F9** to sample the
|
||
strongest red pixel in a 17×17 area, matching the script's default calibration.
|
||
4. To recalibrate the material detector, hover an **empty** material slot and press
|
||
**F10**. The client saves the position, moves away, waits for the hover highlight
|
||
to disappear, and reads the empty-slot color. Alternatively edit the coordinates
|
||
and RGB color directly in the GUI.
|
||
5. Press **F6** to start or stop. **End** or **Escape** also stops immediately.
|
||
Ctrl+Escape stops this macro; it does not unload the DLL.
|
||
|
||
All keys are rebindable. While Macro is enabled, its assigned keys take priority
|
||
over other module toggles, including the existing F6/F7/F8 HUD/crosshair bindings.
|
||
Disable Macro to return those keys to their normal module controls.
|
||
|
||
The GUI also provides capture/start/stop buttons. Capture buttons wait for you to
|
||
close the client menu, then show a countdown before sampling the cursor position.
|
||
Start from the GUI waits for the same countdown after you return to the trade UI.
|
||
|
||
## Settings and persistence
|
||
|
||
The GUI exposes delay, click hold duration, maximum attempts, all calibration
|
||
coordinates and RGB colors, stock search radius/tolerance, red calibration radius
|
||
and minimum dominance, material tolerance, detector toggles, visible-cursor guard,
|
||
notification enable/duration, and live progress. A run takes a snapshot of timing,
|
||
coordinates, and detection settings when it starts.
|
||
|
||
The first load imports `Desktop/papertrade.ini` if there is no client profile.
|
||
**Import papertrade.ini** imports it again. Row/button/red X entries are supported,
|
||
as are optional `[slot] sx/sy/color` entries. **Save settings**, captures, starts,
|
||
and disabling Macro save the active client profile. GUI edits also autosave.
|
||
Switching profiles stops the run and countdown; enabling Macro from a saved
|
||
profile arms it without starting trades. The original INI is never written.
|
||
|
||
The click order follows the script: preliminary row click and material check;
|
||
move to the button before stock detection; select the row; check materials with
|
||
the cursor off the slot; click the trade button; repeat up to the attempt limit.
|
||
The configurable delays are minimum waits; frame rate can lengthen them. Nothing
|
||
sleeps in the rendering callback. Counts reflect trade-button attempts, not server
|
||
confirmation that each trade succeeded.
|
||
|
||
## Stops and notifications
|
||
|
||
Trading stops on stock exhaustion, the empty-material color, manual stop, module
|
||
disable/unload, Escape, focus loss, client menu opening, trading menu closure when
|
||
the visible-cursor guard is enabled, window resizing, pixel-read failure, or mouse
|
||
input failure. A held left mouse button is released on cancellation; failed releases
|
||
retain ownership for retry and prevent another run from starting.
|
||
|
||
Notifications appear at the upper right, with sliding/fading cards, reflow, shadows,
|
||
colored status icons, a spinner while running, and progress/lifetime bars. Trading
|
||
updates one persistent card rather than creating a toast for every attempt. The
|
||
renderer remains active after Macro is disabled so final stop messages can finish.
|
||
|
||
## Verification
|
||
|
||
The isolated trading-engine tests exercise the exact precheck/repeat click order,
|
||
three-attempt completion, stock/material stops, read failures, mid-click cancellation,
|
||
release retry, disabled checks, and RGB tolerance/red dominance. ImGui tests exercise
|
||
notification deduplication, progress updates, rendered finite vertices, dismissal,
|
||
and expiry. Debug/Release client builds and the existing integration suite pass.
|
||
|
||
Villager interaction and screen-pixel matching still require an in-game check with
|
||
your resolution/UI scale, resource pack, and trading screen. Recalibrate if those
|
||
change; the macro does not identify trades semantically or bypass game trade rules.
|