Overview
Thenatro_macro.ahk script is the main entry point for Natro Macro, handling initialization, GUI creation, configuration management, and the primary macro execution loop.
Location: submacros/natro_macro.ahk
Requirements:
- AutoHotkey v2.0+ (32-bit)
- Windows with 100% Display Scale (96 DPI)
- Administrator privileges (if running in protected directories)
Version Information
Current version identifier for the macro
Script Initialization
Architecture Check
The script enforces 32-bit execution for compatibility with Roblox automation.Ensures the script runs with AutoHotkey 32-bit. If running on 64-bit, automatically relaunches with
AutoHotkey32.exe.Behavior:- Checks
A_PtrSize != 4to detect 64-bit execution - Searches for
AutoHotkey32.exein the AHK directory - Calls
ReloadScript()with 32-bit executable path - Exits if 32-bit version not found
Elevation Check
Verifies write permissions in the script directory by attempting to open
submacros\Heartbeat.ahk in append mode.Behavior:- Tests file write access
- Requests UAC elevation if permissions denied
- Shows error message if elevation fails or directory is read-only
- Prevents execution in restricted directories
Executable Paths
OnMessage Handlers
Natro Macro uses Windows message passing for inter-process communication between the main script, background monitor, and other submacros.Message Protocol
Standard Windows message for sending string data between processes. Used by background script to send status messages like “Detected: Night” or “You Died”.
Forces execution of a specific label/function in the main script.Parameters:
wParam: Label identifier- Priority: 255 (highest)
Controls shift lock state for movement.Parameters:
wParam: State (0=off, 1=on)- Priority: 255
Sets a global integer variable.Parameters:
wParam: Variable indexlParam: Integer value- Priority: 255
Sets a global string variable.Parameters:
wParam: Variable indexlParam: String value- Priority: 255
Receives events from background monitoring script (death detection, guid detection, etc.).Parameters:
wParam: Event type (1=death, 4=backpack%, 5=backpack%filtered, 6=guid, 7=popstar, 8=popstar_active)lParam: Event data- Priority: 255
Heartbeat signal to confirm script is alive.
Triggers a forced reconnection to Roblox.
Displays amulet selection prompt.Parameters:
decision: Amulet choicetype: Prompt type
Searches for an item in the inventory.Parameters:
chosenItem: Item name to find
Copies debug logs to clipboard.
Configuration Structure
The macro uses a nested Map structure to store all settings.Configuration Import
Loads configuration from INI file or creates defaults. Configuration is organized into sections:Sections:
Settings- Core macro settings (movement speed, server, reconnect, hotkeys)Status- Runtime statistics and Discord integrationGather- Field gathering configuration (patterns, times, rotations)Boost- Booster activation settingsCollect- Collection task configurationPlanters- Planter management settingsQuest- Quest automation configurationShrine- Wind shrine settingsGUI- GUI state and preferences
Key Configuration Values
Base movement speed in studs per second (affected by haste, bear morphs, etc.)
Method for returning to hive: “Cannon” or “Walk”
Private server link for auto-reconnect
Reconnection method: “Deeplink” or “Browser”
Hive slot number (1-6)
Pattern and Path Import
Pattern Import
Imports gathering patterns from the
patterns/ directory.Security Features:- Validates pattern syntax before import
- Warns about deprecated patterns using
patterns[...]syntax - Hashes patterns to detect changes
- Shows security warning for new/modified patterns
- Validates patterns by executing them in a sandbox with
/Validate /ErrorStdOut
- Imported patterns cached in
settings/imported/patterns.ahk - Pattern hashes stored in
settings/imported/patternHashes.ahk - Patterns accessible via global
patternsMap (case-insensitive) - Pattern names stored in global
patternlistArray
Path Import
Imports movement paths from the
paths/ directory.Path Types:gtb- Go to booster (blue, mountain, red)gtc- Go to collect (machines, beesmas items, events)gtf- Go to field (all 17 fields)gtp- Go to planter (all 17 fields)gtq- Go to questgiver (black, brown, bucko, honey, polar, riley)wf- Walk from field to hive (all 17 fields)
- Paths stored in global
pathsMap with nested structure - Example:
paths["gtf"]["sunflower"]for Sunflower field path - Validates deprecated syntax and missing files
Key Variables
Scan Codes
Movement and action keys are defined using scan codes for reliability:Coordinate Modes
Main Loop Structure
The main script execution follows this flow:-
Initialization
- Check AHK version and architecture
- Elevate privileges if needed
- Close remnant processes
- Start Heartbeat script
- Import patterns and paths
- Load configuration
-
GUI Creation
- Build main interface
- Attach event handlers
- Load saved GUI state
-
Main Execution Loop
- Check macro state (running/paused/stopped)
- Execute current task
- Handle reconnection logic
- Update statistics
- Process Discord notifications
-
Background Integration
- Receive OnMessage notifications
- Update global state variables
- Respond to detection events
Debug Logging
Copies comprehensive debug information to clipboard for troubleshooting.Includes:
- Version information
- System details
- Current configuration
- Recent log entries
- Error messages
- Hotkey: F6 (default, configurable)
- Tray menu: “Copy Logs”
- Debug GUI button
See Also
- Background Script Reference - Monitoring and detection systems
- Library Functions Reference - Utility functions and helpers