mapchange ( | any | * ) [, ...]
Triggers when changing map to . If the argument is any or * (asterisk or star) then it triggers on any map change.
Comma-separated arguments are treated as OR conditions.
openkore ,
can you give me example of macro
Assistant
Certainly! In OpenKore, macros are written using the Macro Plugin, which allows you to define specific actions that the bot should execute under certain conditions. The mapchange hook is useful for triggering macros when your character moves to a different map.
Here's an example of how you might write a macro using the mapchange trigger:
perl
User
I got error, I think this code is wrong "mapchange prt_fild08, gef_fild04, any"
Assistant
Apologies for the confusion. In OpenKore's Macro Plugin, the mapchange condition should be specified in a way that doesn't combine specific maps with the wildcard any directly.
Here’s how you should structure the macro for map changes:
If you want to trigger actions on specific maps or on any map, you should write separate automacro triggers. Below are examples showing how to handle both specific maps and any map:
Trigger on Specific Maps
perl
User
the error message is : Attempt to STORE non blessed reference (or not a reference)
value:
$VAR1 = {};
Assistant
The error message you're encountering suggests there's an issue with the syntax of the macro or how variables are being used/set within it. This can occur when attempting to handle or manipulate data in ways that are not compatible with how OpenKore's Macro Plugin expects them.
User
I still got same error
Assistant
If you're still encountering the error "Attempt to STORE non blessed reference (or not a reference)" in OpenKore, this might be due to incompatibility issues or a deeper problem with Perl's handling of data structures. Let's address this by focusing on a few troubleshooting techniques and ensuring that there aren't any external influences causing this error.
User
I got same error again
Assistant
automacro changeMapAction {
mapchange prt_fild08, gef_fild04, any
priority 1
call {
# Example actions once the map has changed
do c @autostorage
do c @alootid 526 # Change autoloot item to specific one when map changes
log Entered a new map, executing actions. Check autostorage and aloot settings!
}
}
Explanation:
automacro changeMapAction: This defines a new macro named changeMapAction.
mapchange prt_fild08, gef_fild04, any: The macro will trigger whenever you change to the maps prt_fild08 or gef_fild04, or to any other map (any acts as a wildcard).
priority 1: This sets the priority of the macro. In OpenKore, a lower number means higher priority.
call {...}: This block contains the actions to perform when the macro is triggered:
do c @autostorage: Executes the @autostorage command, likely opening storage, if conditions are met.
do c @alootid 526: Sets the autoloot item ID to 526 for the current session. Adjust according to your needs.
log Entered a new map, executing actions...: Logs a message to the console to inform you that the map has changed and actions are being executed.
This setup allows your bot to take specific actions every time your character changes maps, and you can adjust the commands in the call block to fit your desired behavior.
automacro changeMapActionSpecific {
mapchange prt_fild08, gef_fild04
priority 1
call {
# Actions for specific maps
log Entered specific map: prt_fild08 or gef_fild04
# Add more commands here
}
}
Trigger on Any Map
perl
automacro changeMapActionAny {
mapchange *
priority 2
call {
# Actions for any map change
log Entered a new map, executing general actions.
# Add more commands here
}
}
Explanation:
Specific Maps (changeMapActionSpecific): This automacro triggers when you enter either prt_fild08 or gef_fild04 specifically.
Any Map (changeMapActionAny): Using mapchange * triggers on any map change. It's separated from specific maps using a different macro.
Priority: Ensure priorities are set according to the logic you desire – specific actions (priority 1) should usually take precedence over general ones (priority 2).
By implementing these macros, you should be able to perform specific actions on designated maps and separate actions for any map changes. Make sure that you also have the Macro Plugin properly set up and loaded in your OpenKore configuration for these to work.
Let's simplify the macros to ensure there are no syntax-related issues and focus only on the core functionality:
Simplified Macro for Specific Map Change
perl
automacro changeMapActionSpecific {
mapchange prt_fild08
priority 1
call {
log Entered map: prt_fild08
# Add specific actions for this map
}
}
automacro changeMapActionSpecific2 {
mapchange gef_fild04
priority 1
call {
log Entered map: gef_fild04
# Add specific actions for this map
}
}
Simplified Macro for Any Map Change
perl
automacro changeMapActionAny {
mapchange *
priority 2
call {
log Entered a new map, executing general actions
# Add actions for any map change
}
}
Explanation:
Separate Automacros: Each map you want to handle specifically should have its own automacro block. This ensures there's no conflict or parsing issue between specific maps and the wildcard *.
Avoid Complex Commands Initially: Start simple; once you're confident there's no syntax issue, you can gradually add more complex commands inside the call block.
If the issue persists after simplifying, it could point to other aspects such as an incorrect setup in OpenKore or the Macro Plugin not being loaded correctly. Here are some troubleshooting steps:
Ensure Macro Plugin is Loaded: Double-check your control/config.txt to confirm that the Macro Plugin is enabled.
Check OpenKore Version: Make sure you're using a stable version of OpenKore as plugins may behave differently in different versions.
Review Logs: Check the OpenKore logs for any additional information that might indicate why this error occurs.
Test with Minimal Code: Temporarily reduce the automacro to bare minimum checks and logging to ensure it's recognized and executed.
If you continue to face errors, consider reaching out to the OpenKore community or forums for further assistance, as they could provide more specific support given the context of your setup.
Troubleshooting Steps:
Verify Macro Plugin Installation:
Make sure the macro plugin is correctly installed and loaded. Check if plugins/macro.pl is present and referenced in your control/config.txt.
Use Simple Log Actions:
Simplify the macro to confirm it's loading correctly. Here’s a basic version to ensure no data manipulation is causing issues:
Ensure that the Perl version required by OpenKore matches the one you have. Different versions might handle data types slightly differently.
Validate Configuration:
Inspect related configuration files (control/config.txt, control/macro.txt) for any syntax issues like misplaced lines or incorrect settings.
Minimize External Influences:
Temporarily disable other plugins or custom configurations to see if the problem resolves, indicating a conflict elsewhere.
Test Environment Setup:
Run OpenKore in a minimal, clean setup. Sometimes fresh installations help in identifying corrupted files or settings issues.
Review Those Error Logs:
Carefully interpret any logs being generated. Errors involving Perl’s data handling might provide more context in verbose or debug modes.
Community Forums:
If none of the above steps resolve the issue, check OpenKore forums, Discord, or GitHub issues. Sometimes others might have faced similar issues and obtained fixes.
By following these steps, you should be able to isolate the problem or at least gain more insight into why the error occurs. If new information arises or another error message appears, it could be useful for further diagnosis.
I'm sorry to hear that the issue persists. Let's attempt a different approach to isolate and resolve the issue. This error is typically indicative of a reference-related problem, possibly due to an internal issue with data handling within the Macro Plugin or its interaction with the rest of OpenKore.
Here’s a focused set of steps to diagnose and resolve the problem:
Step-by-Step Approach
Check OpenKore Version Compatibility:
Ensure you are using an up-to-date and stable version of OpenKore and confirm that the Macro Plugin you're using is compatible with it. Sometimes, an outdated plugin or OpenKore version may lead to such issues. Check the OpenKore GitHub repository for the latest releases and notes on compatibility.
Isolate the Macro Plugin:
Disable all other plugins and scripts, except the Macro Plugin, to verify that no other code is interfering. Test the simplest form of a macro:
If you are running OpenKore in an environment with Perl installed, ensure that your Perl installation is current. Perl updates may provide fixes for memory management or reference issues that could affect OpenKore operations.
Re-download Macro Plugin:
If possible, download a fresh copy of the Macro Plugin and replace the existing one. Corruption or incomplete downloads could cause unexpected behavior.
Run in Debug Mode:
Launch OpenKore in a debug mode. This is done by adjusting the verbosity settings in OpenKore (config.txt), such as enabling more detailed logs (debug or verbose settings), to pinpoint the error’s location more accurately.
Community Resources:
Post a detailed issue on the OpenKore forums or on GitHub, mentioning the version, environment, and exact error messages along with what you've tried. This community has technical users who might recognize this specific problem.
Alternative Tools:
As a temporary workaround, consider using alternative plugins or a different automation approach if the macro functionality remains critical and unresolved within a reasonable time.
Each of these steps aims to address a potential source of the problem, whether it be software version mismatches, corrupt files, or configuration errors. If you find a solution following these suggestions, it would be worthwhile to document the exact fix, as this can aid others in the community experiencing similar problems.