4.0 CheatDroid is rebuilt from scratch, and a 2.x license carries over. What changed
CheatDroid

How to Run GameGuardian Lua Scripts in CheatDroid

CheatDroid runs Lua scripts with GameGuardian’s gg functions. A script searches and changes a game’s memory for you, and asks its questions in the floating window over the game. Here’s how to get one running, and what a script can’t do in CheatDroid.

What you need

  • A rooted phone and CheatDroid 4.1.4 or newer. 4.1 runs scripts too, but the ones people share often need what 4.1.4 added.
  • The game installed. CheatDroid starts it when you run a script, if it isn’t running.
  • Permission to draw over other apps, so the script’s menu can open over the game. Without it the questions come on CheatDroid’s own screen instead, which works, with more switching.

Run one

  1. In CheatDroid, tap the game, then Memory, then the code icon at the top: Scripts.
  2. Two examples are there to start with. Change a number asks for a number you see in the game, narrows it down while you change it, and sets it. Menu over the game waits for a tap on the floating button and opens a menu, the way most published GameGuardian scripts work.
  3. For a script of your own, tap the file icon to import a .lua file, or + to write one.
  4. Tap Run. The game comes to the front with CheatDroid’s button floating over it. A question from the script opens the window on its Script tab, and it folds back to the button once you’ve answered.
  5. Stop ends the script at any point, in the window or on the Scripts screen. What it printed stays there, along with the line of any error.

What a script can use

The functions GameGuardian scripts call most: gg.searchNumber (with ranges, groups, ;text and h hex), refineNumber, searchFuzzy, getResults, editAll, getValues, setValues, addListItems with freeze, setRanges and getRangesList, getTargetInfo, processPause and processResume, timeJump, searchPointer, copyMemory, getValuesRange, bytes, and the dialogs: alert, choice, multiChoice, prompt and toast. isVisible, setVisible, showUiButton and isClickedUiButton work with CheatDroid’s floating button. The constants have GameGuardian’s values, so a script that hardcodes 4 for TYPE_DWORD gets the same thing. TYPE_AUTO, or several types or’ed together, searches as each of them at once, and every result comes back with the type it was found as in flags.

Searches take GameGuardian’s memoryFrom and memoryTo, and getResults its address, value and type filters. A group can give each number its own type (0.0001E;1D::30). getTargetInfo has the fields scripts check, processName and versionCode among them, and debug.getinfo works. Scripts that find a Unity game’s classes by name in its metadata, the kind that survive game updates, run as they do in GameGuardian.

The Lua is luaj’s 5.2 with 5.3’s operators added: gg.REGION_C_ALLOC | gg.REGION_ANONYMOUS, &, ~, <<, >> and // all work.

What it can’t

  • No speedhack: gg.setSpeed does nothing.
  • No network, and files only in CheatDroid’s scripts folder. A script can’t download or send anything. io, loadfile and gg.saveVariable work, but only there, which is where scripts keep their settings and where a script that writes another one puts it, so it shows up in your list. Any other path doesn’t open, and io.popen runs nothing. That’s deliberate: a script someone posted gets root-level access to the game and nothing beyond it.
  • No compiled scripts. A .lua file that starts with ESC L is GameGuardian bytecode, which only GameGuardian loads. CheatDroid needs the source.
  • Numbers are doubles. GameGuardian’s Lua has 64-bit integers; CheatDroid’s counts in doubles, so arithmetic past 253 comes out rounded. Addresses stay well below that.
  • A gg function CheatDroid doesn’t have stops the script with an error that names it. The ones a script is likeliest to miss: allocatePage, unrandomizer, disasm, searchAddress, and the list and memory dumps to files.

Scripts I tried

Four that people share, on a rooted Android 13 emulator with CheatDroid 4.1.4:

  • Subway Surfers Universal Script (GameGuardian forum) found the game’s data by class name in under 10 seconds, read the coins and set them.
  • Nonograms Katana (GameGuardian forum) ran through its searches, writes and freezes on version 21.4, the one it was made for.
  • RChainer (GitHub) searched pointer chains, kept its settings next to itself and wrote the script it generates into the scripts folder.
  • Multiplier from AlasGG (GitHub) ran its double and mixed-type group searches to the end.

Pro

Running a script is free as long as it only searches and reads. The first time a script sets a value, freezes one or jumps the clock, it stops there and offers Pro, the same rule as setting a value by hand.

Writing your own

Four lines are enough for coins you can see:

local now = gg.prompt({"Coins now"}, {""}, {"number"})
gg.searchNumber(now[1], gg.TYPE_DWORD)
gg.getResults(gg.getResultsCount())
gg.editAll("999999", gg.TYPE_DWORD)

With thousands of matches that sets every one of them, which can upset a game. The Change a number example narrows the search first; open it with Edit and copy from there. When a value won’t move, the memory guide says why, and that holds for scripts too.

Coming from GameGuardian? Here’s how the two compare.

Download CheatDroid