The goal of this guide is to help you understand the basics of macro creation, from simple macros to more
complex automation. I'll cover everything from the fundamental concepts to practical examples that you can
apply in your own projects.
So first of all you need imports, those are a must have in all macros, they are libraries that provide useful
functions to make your coding much easier, lets start by adding the random and time libraries like in the
image below.
After that you can start writing your first macro, for example a simple macro that gives 2 random numbers and
adds them together, you can do it like this:
The code above will generate two random numbers between 1 and 10, add them together, and print the result
after 1 second (because of the "time.sleep(1)" line which delays the output by 1 second). This is a basic
example of how a the random and time libraries work. To run the macro you must go into the same spot where you
put the file and run the command "py your_macro.py" in the terminal, where "your_macro.py" is the name of your
macro file or as an alternative you can use the launcher, just press the "macros" button and it will open a
folder, then you put the macro into that folder and then you can run the macro from by using the launcher.
Now lets do something a bit more complex, lets say you want to make a macro that will automatically click on a
button at a specific position in a game. In this example i will define a function and then call it to click on
that button "def click_button()" and i will use this function so it's easier to call it later. The function
below is an example of how you can do that but it's not a complete macro, it's just a function that you can
use in your macro to click on a specific position, it's also very unoptimised since it assignes the position
every time you call the function, but it works for this example.
Now something more advanced which is asking for user input, you can use the "input()" function to ask the user
for input, for example you can ask the user for their name and then print a greeting message like this:
This allows you to interact with the user and make your macro more dynamic. You can use this to ask the user
for input, like the amount of dice they have (example from the Board Game Macro)
Now you probably noticed that all the print statements have an "f" before the string... but why? The answer is
pretty simple, this allows you to insert variables into strings like this:
These are also some other useful functions that you can use in your macros like loops and conditionals, for
example you can use a loop to repeat a certain action multiple times, in this example the loop will execute
the print function 15 times but it will start from 0 instead of 1 since all loops start from 0 unless you
specify otherwise, like this:
You can also use conditionals to check if a certain condition is met and then execute a certain action, for
example you can check if a variable is odd or even by using this simple check and then execute a certain
action, like this:
After you have learned the basics of macro creation you will be able to create very complex and sofisticated
macros that can automate everything in any game, you can use the knowledge you gained from this guide to
create your own macros and automate your gameplay. A great example of a macro that uses all the knowledge you
gained from this guide is the Board Game Macro and its detection system for which you would need to understand
quite a bit about python to understand why that line is over there and this line is here. Here's an example
code snippet from said macro.
The whole source code for the Board Game Macro is available in the GUY2 Launcher which you can download from
the
GUY2 Macros website. This macro is a great example of how
you can automate anything you want in any game"
When i create macros i first must understand the game mechanics and how the game works, then i will try my
best to not overthink a solution. The Fishing Macro for BGSI is a great example of not overthinking a
solution, instead of checking when there's a green pixel and then clicking to break that barrier then
proceeding to hold down my mouse to hit the next green pixel/end of the fishing bar i just check the color of
the "HOLD" and "MASH" text and if it changes it means that i must click, if it changes again then that means
that i don't need to click anymore, this approach is so simple yet so effective, it works 100% of the time and
coding it took me less than 1 hour with all the testing and fallbacks included.
I also use a lot of print statements to debug my macros, this allows me to see what is happening in my macro
and where it is failing, i also use the "time.sleep()" function to slow down my macro and make it easier to
debug, this is very useful when you are trying to figure out why your macro is not working as expected.
I don't use many comments in my macros since i find them redundent, i prefer to write clean and readable code
that is self-explanatory, but if you are a beginner i would recommend using comments to explain what your code
does, this will help you understand your code better and make it easier to debug.
I try to make my code as easy to understand as possible, i use self-explanatory variable names and function
names, this way i don't have to write comments to explain what my code does nor do i have to read the code
itself to understand that "def PineappleOnPizza()" is a function that checks images in a specific area, i can
just look at the function name and understand what it does. It's a good practice to write clean and readable
code.
If i'm stuck on a problem i will try to break it down into smaller parts and solve each part separately, this
way i can focus on one problem at a time and not get overwhelmed by the complexity of the problem and the best
way to break a problem into smaller parts is to comment out the code that is not working and then try to fix
it one part at a time, this way you can see what is working and what is not working and you can focus on the
part that is not working.
I've pretty much covered the issues i faced with the Fishing Macro and how i solved them, but there are some
other issues that i faced with other macros that i would like to share with you. With the Board Game Macro i
had to figure out the whole "human-like" logic that determines the elixir's position and when to switch to
golden dice... that was truly one of the worst issues i faced with in any macro i have created, fortunately i
was able to solve it by using a combination of image recognition and assigning slots to all the 10 possible
positions for the elixir and then using logic for the slots deppending on the dice failing
Another issue i faced with the macros was the Team Enchant Macro, while it seems easy at first since u just
select a pet and enchant auto enchant a pet to whatever enchant you want, the issue arises when you have to
check if the enchant you got is the one you wanted because previously when you were auto enchanting it would
just enchant the pet to any secret enchant instead of the specific one you wanted, so i had to implement a
system that checks if the enchant is the one you wanted and if not it will re-enchant the pet until it gets
the enchant you wanted, this was a bit tricky since i had to figure out how to check the enchant and how to
re-enchant the pet but that was quite a simple fix.