Jump to content
Enyby

LUA scripting

Recommended Posts

Is there any way i can prevent people from stealing my lua script codes? Well yea, they're stealing them.. 

Share this post


Link to post
Share on other sites

It all depends only on you and your knowledge of Lua. If you know Lua, then yes. If you do not know, then no.

Share this post


Link to post
Share on other sites
Posted (edited)

gg.getResults('Value'

How to get the Value in getResults? Is the getResults('Value') can be get in searchNumber('Value') result?

Thank  you!

Edited by Maplas

Share this post


Link to post
Share on other sites
Posted (edited)
2 hours ago, Enyby said:

Could you please check my script, been sorting out looking for the error but no luck to solve it.

gg.toast('Mobile Legends Script - 1.0.0')

if gg.BUILD < 5511 then 
gg.alert('Outdated! Upgrade Game Guardian to v.8.30.0. or Later!') 
gg.toast('GameGuardian.net!')
end 

if gg.isVisible(true) then 
   gg.setVisible(false) 
   end
 
::menu::
menu = gg.choice({'God Mode','Exit'})
if menu == 1 then goto hero end
if menu == 2 then goto close end

::hero::
if hero == gg.choice({'Layla','Menu','Exit'})
if hero == 1 then goto layla end
if hero == 2 then goto menu end
if hero == 3 then goto close end

::layla::
gg.searchNumber('118;424;2500', gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1)
gg.getResults(19)print('Replaced: ', gg.editAll('999999', gg.TYPE_DWORD))
gg.toast('Injected!')
goto close

::close::
gg.toast('Script Injected!')
gg.toast('Cheaters!')

Edited by Maplas

Share this post


Link to post
Share on other sites

I do not have time for this. If you have a specific error - show the text. The validation of other people's scripts I do not do.

Share this post


Link to post
Share on other sites

Apologize, but here is the specific error that I got.

Script ended:
Script error: org.luaj.vm2.LuaError: load /storage/emulated/0/VirtualXposed/vsdcard/0/Android/obb/com.mobile.legends/scripts.lua: org.luaj.vm2.LuaError: /storage/emulated/0/VirtualXposed/vsdcard/0/Android/obb/com.mobile.legends/sc...:19
`failed read line`
'then' expected
    at org.luaj.vm2.LuaValue.error(LuaValue.java:1075)
    at org.luaj.vm2.Globals.loadfile(Globals.java:208)
    at android.ext.Script.runScript(Script.java:3361)
    at android.ext.Script$ScriptThread.run(Script.java:3294)
Caused by: org.luaj.vm2.LuaError: /storage/emulated/0/VirtualXposed/vsdcard/0/Android/obb/com.mobile.legends/sc...:19
`failed read line`
'then' expected
    at org.luaj.vm2.compiler.LexState.lexerror(LexState.java:270)
    at org.luaj.vm2.compiler.LexState.syntaxerror(LexState.java:274)
    at org.luaj.vm2.compiler.LexState.error_expected(LexState.java:823)
    at org.luaj.vm2.compiler.LexState.check(LexState.java:836)
    at org.luaj.vm2.compiler.LexState.checknext(LexState.java:840)
    at org.luaj.vm2.compiler.LexState.test_then_block(LexState.java:1893)
    at org.luaj.vm2.compiler.LexState.ifstat(LexState.java:1920)
    at org.luaj.vm2.compiler.LexState.statement(LexState.java:2042)
    at org.luaj.vm2.compiler.LexState.statlist(LexState.java:2108)
    at org.luaj.vm2.compiler.LexState.mainfunc(LexState.java:2124)
    at org.luaj.vm2.compiler.LuaC$CompileState.luaY_parser(LuaC.java:129)
    at org.luaj.vm2.compiler.LuaC.compile(LuaC.java:99)
    at org.luaj.vm2.Globals.compilePrototype(Globals.java:327)
    at org.luaj.vm2.Globals.loadPrototype(Globals.java:306)
    at org.luaj.vm2.Globals.load(Globals.java:277)
    at org.luaj.vm2.Globals.loadfile(Globals.java:202)
    ... 2 more

Share this post


Link to post
Share on other sites

Try read message.

4 minutes ago, Maplas said:

'then' expected

4 minutes ago, Maplas said:

/Android/obb/com.mobile.legends/sc...:19

16 minutes ago, Maplas said:

if hero == gg.choice({'Layla','Menu','Exit'})

Need 'then' on line 19.

_______________________________________________
added 0 minutes later

I think 'if' on line 19 is not necessary.

_______________________________________________
added 1 minute later

And on line 19 you must make assignment ('=') not comparison ('==').

Share this post


Link to post
Share on other sites

Problem solved! Thank you!

Share this post


Link to post
Share on other sites
how to use multiChoice ?

Share this post


Link to post
Share on other sites

See other scripts source as examples.

Share this post


Link to post
Share on other sites
Posted (edited)

Hi,

I have a question, I did a group search 

gg.searchNumber('123;345;789', gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1)

Lets say i want to modify

123 with 12300

456 with 85000

789 with 67549

How can i achieve this with lua script. Tried checking in https://gameguardian.net/help/  but wasn't able to find

In GG without lua, after search results i can filter results with "number >=" and "number <=".44

Thanks in advance

Edited by warriror999

Share this post


Link to post
Share on other sites

Read results into table. Iterate over this table. In loop body check value. If it has specified value - add it to table with changes. after loop setValues with new table with changes.

If you do not understand what I am talking about - you need learn lua and how to programm. Use books and internet.

Share this post


Link to post
Share on other sites

@Enyby is there a changelog for lua gg functions? So I could check the minimum version of gg my script could work with.Thank you.

Share this post


Link to post
Share on other sites

@MCbearbear

No. No any changelog. You must always use latest version of the gg.

So you can check current version with gg.require.

Always set it to latest version as you write script and you not have any problems.

Share this post


Link to post
Share on other sites

@Enyby How to keep my script open after the search?

 

Share this post


Link to post
Share on other sites

You can use sleep with loop. Like in script loader.

Share this post


Link to post
Share on other sites

hi guys, do we have a function for group search for prompt and exact value like on the 2nd line on my script

example:

d = gg.prompt({A='A'}, {A='0'})

gg.searchNumber ('d.A;123;456;789::2000', gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0)

gg.searchNumber('d.A',gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0)

gg.getResults(1)

gg.editAll('99999999',gg.TYPE_DWORD)

 

i always have problem on that 2nd line, heres the error.

Script error: org.luaj.vm2.LuaError: @/storage/emulated/0/Download/lua tests/File.txt:54
`gg.searchNumber('d.A;123;456;789::2000', gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0)`
gg.searchNumber: bad argument #2 (string): number expected, got nil
stack traceback:
    /storage/emulated/0/Download/lua tests/File.txt:54: in main chunk
    [Java]: in ?
    at org.luaj.vm2.Varargs.argerr(Varargs.java:280)
    at org.luaj.vm2.Varargs.optint(Varargs.java:202)
    at android.ext.Script$searchNumber.invokeUi(Script.java:1871)
    at android.ext.Script$ApiFunction.run(Script.java:737)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:136)
    at android.app.ActivityThread.main(ActivityThread.java:5120)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:818)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)
    at dalvik.system.NativeStart.main(Native Method)

or

is there any method to search the offset from the exact values after this 

gg.searchNumber('123;456;789::2000',gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0)

gg.searchNumber('123',gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0)

gg.getResults(1)

 

now after the result i want it going into the address value of that single result

then search its offset

then edit that address value from the offset of that single result.

example from the address:

7C40DE78 = d.A

7C40DE7C = 123

7C40DE80 = 456

7C40DE84 = 789

so offset of 7C40DE7C going to 7C40DE78 is -8

while 123;456;789 are constant values

 

i hope i explained right to what i want to happen on my script thanks.

Share this post


Link to post
Share on other sites
On 7/17/2017 at 10:08 AM, Enyby said:

Starting from version 8.28.0 GG have support of LUA scripts.

It can be loaded and run.

https://www.lua.org/manual/5.2/manual.html

Scripting Documentation: https://gameguardian.net/help/

  Reveal hidden contents

 

GG function stored in table named gg.

You can print it for get short help.



print(gg)


gg =   table(5393242c): {
       [BUILD] = 6147
       [CACHE_DIR] = /data/data/catch_.me_.if_.you_.can_/cache
       [EXT_CACHE_DIR] = /mnt/sdcard/Android/data/catch_.me_.if_.you_.can_/cache
       [EXT_FILES_DIR] = /mnt/sdcard/Android/data/catch_.me_.if_.you_.can_/files
       [FILES_DIR] = /data/data/catch_.me_.if_.you_.can_/files
       [PACKAGE] = catch_.me_.if_.you_.can_
       [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
       [VERSION_INT] = 83100
       [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 */
       [choice] = function: choice /* gg.choice(table items [, string selected = nil [, string message = nil]]) -> string || nil */
       [clearResults] = function: clearResults /* gg.clearResults() -> nil */
       [copyMemory] = function: copyMemory /* gg.copyMemory(long from, long to, int bytes) -> true || string with error */
       [copyText] = function: copyText /* gg.copyText(string text [, bool fixLocale = true]) -> nil */
       [dumpMemory] = function: dumpMemory /* gg.dumpMemory(long from, long to, string dir) -> true || string with error */
       [editAll] = function: editAll /* gg.editAll(string value, int type) -> count of changed || string with error */
       [getFile] = function: getFile /* gg.getFile() -> string */
       [getLine] = function: getLine /* gg.getLine() -> int */
       [getLocale] = function: getLocale /* gg.getLocale() -> string */
       [getRanges] = function: getRanges /* gg.getRanges() -> int */
       [getResultCount] = function: getResultCount /* gg.getResultCount() -> long */
       [getResults] = function: getResults /* gg.getResults(int count) -> array || string with error */
       [getSpeed] = function: getSpeed /* gg.getSpeed() -> double */
       [getTargetInfo] = function: getTargetInfo /* gg.getTargetInfo() -> table || nil */
       [getTargetPackage] = function: getTargetPackage /* gg.getTargetPackage() -> string || nil */
       [getValuesRange] = function: getValuesRange /* gg.getValuesRange(table values) -> table || string with error */
       [getValues] = function: getValues /* gg.getValues(table values) -> table || string with error */
       [gotoAddress] = function: gotoAddress /* gg.gotoAddress(long address) -> nil */
       [isPackageInstalled] = function: isPackageInstalled /* gg.isPackageInstalled(string pkg) -> bool */
       [isProcessPaused] = function: isProcessPaused /* gg.isProcessPaused() -> bool */
       [isVisible] = function: isVisible /* gg.isVisible() -> bool */
       [multiChoice] = function: multiChoice /* gg.multiChoice(table items [, table selection = {} [, string message = nil]]) -> table || nil */
       [processKill] = function: processKill /* gg.processKill() -> bool */
       [processPause] = function: processPause /* gg.processPause() -> bool */
       [processResume] = function: processResume /* gg.processResume() -> bool */
       [processToggle] = function: processToggle /* gg.processToggle() -> bool */
       [prompt] = function: prompt /* gg.prompt(table prompts [, table defaults = {} [, table types = {} ]]) -> nil || table with keys from prompts and values from inputs */
       [removeResults] = function: removeResults /* gg.removeResults(table results) -> true || string with error */
       [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 */
       [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 */
       [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 */
       [setRanges] = function: setRanges /* gg.setRanges(int ranges) -> nil */
       [setSpeed] = function: setSpeed /* gg.setSpeed(double speed) -> true || string with error */
       [setValues] = function: setValues /* gg.setValues(table values) -> true || string with error */
       [setVisible] = function: setVisible /* gg.setVisible(bool visible) -> nil */
       [skipRestoreState] = function: skipRestoreState /* gg.skipRestoreState() -> nil */
       [sleep] = function: sleep /* gg.sleep(int milliseconds) -> nil */
       [startFuzzy] = function: startFuzzy /* gg.startFuzzy([int type = gg.TYPE_AUTO [, long memoryFrom = 0 [, long memoryTo = -1]]]) -> true || string with error */
       [timeJump] = function: timeJump /* gg.timeJump(string time) -> true || string with error */
       [toast] = function: toast /* gg.toast(string text [, bool fast = false]) -> nil */
}

In future we add help with examples.

 

 

Nice but are can Gameguardian can working on android 7.1.1 No Root. I just

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

×