GG help
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.

In the latest versions of GameGuardian, you can write the script directly from the interface:

You turn on script recording and perform consistently all the action to produce a result. GameGuardian writes your actions to a script file.

However, not all of your actions fall into this record and not all parameters are taken into account. So this is only suitable for very simple scripts, or as a workpiece for later editing.

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:
    • Go to the function description page:
    • 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:
    • 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:
    • 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 GameGuardian, 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.