Jump to content
Enyby

LUA scripting

Recommended Posts

@Enyby How to add multi-language support?

Share this post


Link to post
Share on other sites

Currently you can only use strings from gg. For example, in some cases '__yes__' will be replaced to localized version.  

Localization is hard thing. It is too complicated for user scripts.

Share this post


Link to post
Share on other sites

New:

[getLocale] = function: getLocale /* gg.getLocale() -> string */
[skipRestoreState] = function: skipRestoreState /* gg.skipRestoreState() -> nil */

 

Share this post


Link to post
Share on other sites

How to use gg.skipRestoreState? And maybe an example of using gg.getLocale

@Enyby Thank you

Edited by Aufar_R
Gg get locale

Share this post


Link to post
Share on other sites

getLocale return string with current locale. You can use this for build i18n script.

SkipRestoreState disable restore state of gg after script end. Currently gg restore original memory region set after script end. If you call this function then restore not happens.  

Share this post


Link to post
Share on other sites
local t = {
	['en_US'] = 'Hello',
	['ru'] = 'Привет',
}
local lang = gg.getLocale()
local s = t[lang]
if s == nil then
	s = t['en_US']
end
gg.alert(s)

scr_1502709461.jpgscr_1502709601.jpg

Share this post


Link to post
Share on other sites

@Enyby Can we change the text color? Or text position in GG lua scripts

Share this post


Link to post
Share on other sites

No.

_______________________________________________
added 3 minutes later
gg.setRanges(bit32.bxor(gg.REGION_C_HEAP, gg.REGION_C_ALLOC, gg.REGION_ANONYMOUS))
-- do some things like search values
-- gg.skipRestoreState()

If you call this script on latest GG, then memory ranges will be changed only while script run. After end script its return to values set by user.

But if you uncomment last call, memory regions do not restored after script end. And user settings will be lost.

Share this post


Link to post
Share on other sites

Okay no problem may be more interesting if text can be colored hehe. 

Share this post


Link to post
Share on other sites

@Enyby Do you have any plans to include value freeze for scripts? Or there already is but It's just me who don't know?

Share this post


Link to post
Share on other sites
On 7/17/2017 at 3:56 PM, Backlift said:

Thanks for reply, fixing the issues now.

Man you're too good at coding, I will ask something aren't these codes basically C#? If you reply it would be too helps. Thanks...

Share this post


Link to post
Share on other sites

Short help for API functions

 

gg =   table(5393242c): {
       [BUILD] = 6147
The build number.
       [CACHE_DIR] = /data/data/catch_.me_.if_.you_.can_/cache
Directory cache. On the internal memory.
       [EXT_CACHE_DIR] = /mnt/sdcard/Android/data/catch_.me_.if_.you_.can_/cache
External cache directory. Usually on an external memory card.
       [EXT_FILES_DIR] = /mnt/sdcard/Android/data/catch_.me_.if_.you_.can_/files
External directory of files. Usually on an external memory card.
       [FILES_DIR] = /data/data/catch_.me_.if_.you_.can_/files
The directory of files. On the internal memory.
       [PACKAGE] = catch_.me_.if_.you_.can_
The name of the application package.
       [REGION_ANONYMOUS] = 32
       [REGION_ASHMEM] = 524288
       [REGION_BAD] = 131072
       [REGION_CODE_APP] = 16384
       [REGION_CODE_SYS] = 32768
       [REGION_C_ALLOC] = 4
       [REGION_C_BSS] = 16
       [REGION_C_DATA] = 8
       [REGION_C_HEAP] = 1
       [REGION_JAVA] = 65536
       [REGION_JAVA_HEAP] = 2
       [REGION_OTHER] = -1032320
       [REGION_PPSSPP] = 262144
       [REGION_STACK] = 64
       [SIGN_EQUAL] = 536870912
       [SIGN_FUZZY_EQUAL] = 536870912
       [SIGN_FUZZY_GREATER] = 67108864
       [SIGN_FUZZY_LESS] = 134217728
       [SIGN_FUZZY_NOT_EQUAL] = 268435456
       [SIGN_GREATER_OR_EQUAL] = 67108864
       [SIGN_LESS_OR_EQUAL] = 134217728
       [SIGN_NOT_EQUAL] = 268435456
       [TYPE_AUTO] = 127
       [TYPE_BYTE] = 1
       [TYPE_DOUBLE] = 64
       [TYPE_DWORD] = 4
       [TYPE_FLOAT] = 16
       [TYPE_QWORD] = 32
       [TYPE_WORD] = 2
       [TYPE_XOR] = 8
       [VERSION] = 8.31.0
Text version of the application.
       [VERSION_INT] = 83100
The numeric version of the application.
       [alert] = function: alert /* gg.alert(string text [, string positive = 'ok' [, string negative = nil [, string neutral = nil]]]) -> int: 0 = cancel, 1 = positive, 2 = negative, 3 = neutral */
Displays a dialog with several buttons. The return result depends on which of the buttons was pressed. The dialog can be canceled with the "Back" button.
       [choice] = function: choice /* gg.choice(table items [, string selected = nil [, string message = nil]]) -> string || nil */
Displays the selection dialog from the list. The list is made up of the items table. Selected sets the index of the table that will be selected by default. If selected is not specified or is specified as nil, then sssyok will be without the default choice. Message specifies the title of the dialog box. The function returns nil if the dialog has been canceled, or the index of the selected item.
       [clearResults] = function: clearResults /* gg.clearResults() -> nil */
Clears the list of search results.
       [copyMemory] = function: copyMemory /* gg.copyMemory(long from, long to, int bytes) -> true || string with error */
Copy memory.
       [copyText] = function: copyText /* gg.copyText(string text [, bool fixLocale = true]) -> nil */
Copy text to the clipboard. If the second parameter is true or not specified, the text will be converted as a number from the English locale to the selected one.
       [dumpMemory] = function: dumpMemory /* gg.dumpMemory(long from, long to, string dir) -> true || string with error */
Dump of memory.
       [editAll] = function: editAll /* gg.editAll(string value, int type) -> count of changed || string with error */
Edit all search results. Requires before downloading results via getResults. The value can be any valid string. The type is specified by one of the constants TYPE_*.
       [getFile] = function: getFile /* gg.getFile() -> string */
Gets the file name of the currently running script.
       [getLine] = function: getLine /* gg.getLine() -> int */
Gets the current line number of the script being executed.
       [getLocale] = function: getLocale /* gg.getLocale() -> string */
Gets the string with the currently selected locale in the application. For example, en_US, zh_CN, ru, pt_BR, ar, uk.
       [getRanges] = function: getRanges /* gg.getRanges() -> int */
Gets the bit mask of the selected memory regions.
       [getResultCount] = function: getResultCount /* gg.getResultCount() -> long */
Gets the number of results found.
       [getResults] = function: getResults /* gg.getResults(int count) -> table || string with error */
Gets a table with the results found. No more than count elements. Each element is a table with three keys: address (long), value (string with a value), flags (one of the constants TYPE_*).
       [getSpeed] = function: getSpeed /* gg.getSpeed() -> double */
Gets the current speed from the speedhack.
       [getTargetInfo] = function: getTargetInfo /* gg.getTargetInfo() -> table || nil */
Gets a table with information about the selected process. The set of fields can be different. Print the resulting table to see the available fields.
       [getTargetPackage] = function: getTargetPackage /* gg.getTargetPackage() -> string || nil */
Gets the package name of the selected process, if possible.
       [getValuesRange] = function: getValuesRange /* gg.getValuesRange(table values) -> table || string with error */
Gets the memory regions for the passed value table. The referenced table can be either an address list or a list of tables with the address field. The result is a table where each key, from the original table, will be associated with a short region code (Ch, for example).
       [getValues] = function: getValues /* gg.getValues(table values) -> table || string with error */
Gets the values for the transferred list of items. Each list item must be a table with address and flags fields (one of the constants TYPE_*). The result is a new table with elements. Each element is a table with three keys: address (long), value (string with a value), flags (one of the constants TYPE_*).
       [gotoAddress] = function: gotoAddress /* gg.gotoAddress(long address) -> nil */
Go to the specified address in the memory editor.
       [isPackageInstalled] = function: isPackageInstalled /* gg.isPackageInstalled(string pkg) -> bool */
Check whether the specified application is installed on the system by the package name.
       [isProcessPaused] = function: isProcessPaused /* gg.isProcessPaused() -> bool */
Check if the selected process is paused.
       [isVisible] = function: isVisible /* gg.isVisible() -> bool */
Check if the application interface is open.
       [multiChoice] = function: multiChoice /* gg.multiChoice(table items [, table selection = {} [, string message = nil]]) -> table || nil */
Displays the multiple choice dialog. The list of items is specified by the items table. The selection table specifies the selection status. The keys must match. If the key is not found in the second table, then the element will be unchecked. Message specifies an optional title for the dialog box. The result is a table with the selected keys and values TRUE (analogue of the selected selection table), or nil if the dialog was canceled.
       [processKill] = function: processKill /* gg.processKill() -> bool */
Finishes the selected process. Returns true on success and false otherwise.
       [processPause] = function: processPause /* gg.processPause() -> bool */
Pauses the selected process. Returns true on success and false otherwise.
       [processResume] = function: processResume /* gg.processResume() -> bool */
Resume the selected process. Returns true on success and false otherwise.
       [processToggle] = function: processToggle /* gg.processToggle() -> bool */
Toggles the pause state of the selected process. Returns true on success and false otherwise.
       [prompt] = function: prompt /* gg.prompt(table prompts [, table defaults = {} [, table types = {} ]]) -> nil || table with keys from prompts and values from inputs */
Displays the dialog for data entry. The prompts table specifies the keys and description for each input field. The defaults table specifies the default values. The types table specifies the types of input fields (string). Valid types: number, text, path, file, setting, speed. The type depends on the output of additional elements near the input field (for example, buttons for selecting a path or file).
       [removeResults] = function: removeResults /* gg.removeResults(table results) -> true || string with error */
Removing items from the list of results found. Each list item must be a table with address and flags fields (one of the constants TYPE_*).
       [searchAddress] = function: searchAddress /* gg.searchAddress(string text [, long mask = -1 [, int type = gg.TYPE_AUTO [, int sign = gg.SIGN_EQUAL [, long memoryFrom = 0 [, long memoryTo = -1]]]]]) -> true || string with error */
Perform an address search with the specified parameters. The format of the search string corresponds to the format of the search string through the application interface.
       [searchFuzzy] = function: searchFuzzy /* gg.searchFuzzy([string difference = '0' [, int type = gg.TYPE_AUTO [, int sign = gg.SIGN_FUZZY_EQUAL [, long memoryFrom = 0 [, long memoryTo = -1]]]]]) -> true || string with error */
Continues fuzzy search, with the specified parameters.
       [searchNumber] = function: searchNumber /* gg.searchNumber(string text [, int type = gg.TYPE_AUTO [, bool encrypted = false [, int sign = gg.TYPE_EQUAL [, longmemoryFrom = 0 [, long memoryTo = -1]]]]]) -> true || string with error */
Perform a search for a number, with the specified parameters. The format of the search string corresponds to the format of the search string through the application interface.
       [setRanges] = function: setRanges /* gg.setRanges(int ranges) -> nil */
Set a set of memory regions. The parameter is the bit mask of REGION_* constants.
       [setSpeed] = function: setSpeed /* gg.setSpeed(double speed) -> true || string with error */
Setting the speed of the speedhack. If speedhack was not loaded, then it will be loaded. The call is blocking. Managing the script will be returned only after the full load speedhack.
       [setValues] = function: setValues /* gg.setValues(table values) -> true || string with error */
Sets the values for the transferred list of items. Each list item must be a table with address, value (string), and flags (one of the TYPE_* constants).
       [setVisible] = function: setVisible /* gg.setVisible(bool visible) -> nil */
Opens or closes the application interface.
       [skipRestoreState] = function: skipRestoreState /* gg.skipRestoreState() -> nil */
Do not restore the state of the application (for example, a set of memory regions), after the script is completed.
       [sleep] = function: sleep /* gg.sleep(int milliseconds) -> nil */
Pauses execution of the script for the specified number of milliseconds.
       [startFuzzy] = function: startFuzzy /* gg.startFuzzy([int type = gg.TYPE_AUTO [, long memoryFrom = 0 [, long memoryTo = -1]]]) -> true || string with error */
Starts a fuzzy search, with the specified parameters.
       [timeJump] = function: timeJump /* gg.timeJump(string time) -> true || string with error */
Performs a time jump. The format of the string is similar to the time format in the time jump dialog.
       [toast] = function: toast /* gg.toast(string text [, bool fast = false]) -> nil */
Shows a toast. The second parameter allows you to display the toast less than usual.
}

Share this post


Link to post
Share on other sites
1 hour ago, Enyby said:

[toast] = function: toast /* gg.toast(string text [, bool fast = false]) -> nil */
Shows a toast. The second parameter allows you to display the toast less than usual.

How to use the second parameter?

And one more thing.

If the cheat only works with versioncode 291, how to make the script only works with that ver. Code?

Screenshot_20170819-052335.png

Edited by Aufar_R

Share this post


Link to post
Share on other sites
4 hours ago, Aufar_R said:

How to use the second parameter?

Set it to true or false. Or omit. If it true - toast will be visible less time.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...