How to write a simple script
In short, the process of creating a script looks like this:
1. Make a list of actions to achieve the desired result.
2. Perform them manually, in the interface, to check that everything works.
3. Then start each item in the code. To do this, see what functions are, what parameters they take and select the one you want.
4. Test the script, correcting it if necessary.
For example, you need to crack some game A.
1. Make a list of actions:
- find dword 123
- replace the first 100 results by 456.
2. Perform actions manually:
- search for dword 123
- replace the first 100 results by 456.
- make sure that everything works as it should, the game does not crash and so on.
3. open the help on scripts: https://gameguardian.net/help/
Go to the function description page: https://gameguardian.net/help/classgg.html
Take the first action "find dword 123" and browse the list of functions until you find the one you need.
In this case, this is
mixed searchNumber (string text, int type = gg.TYPE_AUTO, bool encrypted = false, int sign = gg.SIGN_EQUAL, long memoryFrom = 0, long memoryTo = -1)
Perform a search for a number, with the specified parameters. More ...
Go to the function description, study it: https://gameguardian.net/help/classgg.html#a7efd4ac7766e72688cb4a84a3915721e
Write the first line of the script:
gg.searchNumber ('123', gg.TYPE_DWORD)
Let's move on to the second action "replace the first 100 results by 456."
We read the reference again.
We see that we need two functions:
mixed getResults (int maxCount)
Load results into results. More ...
mixed editAll (string value, int type)
Edit all search results. More ...
We pass to them and read:
https://gameguardian.net/help/classgg.html#a57d16baba0f36e4dd157e25774b8977a
https://gameguardian.net/help/classgg.html#a5f859e6f707b2336152411b19fea7603
We write down the following two lines of code:
gg.getResults (100)
gg.editAll ('456', gg.TYPE_DWORD)
Continue until you have written the script completely.
In this case, the script is already ready:
gg.searchNumber ('123', gg.TYPE_DWORD)
gg.getResults (100)
gg.editAll ('456', gg.TYPE_DWORD)
4. Save the script, run it in GG, check the correctness of the work.
This example is very simple, but it shows the essence. As an extension of the script, you can add cleaning results at the very beginning, setting search regions and so on.
For more complex scripts, you need to understand the programming language lua and the ability to write code.