Jump to content
Enyby

LUA scripting

Recommended Posts

gg.toast ('Quadropus 2.0.48 Hack by Backlift')
gg.clearResults()
--gg.setRanges(gg.REGION_JAVA_HEAP)
gg.setRanges(gg.REGION_C_ALLOC)
while true do
	if gg.isVisible() then
		local d = gg.prompt({A='Number of Orbs Or Dooblins'}, {A='0'})
		if d == nil then
			gg.alert('Script canceled')
			break
		end
		gg.searchNumber (d.A, gg.TYPE_DOUBLE, true, gg.SIGN_EQUAL, 0, -1)
		cnt = gg.getResultCount()
		if cnt == 0 then 
			gg.alert('Search failed')
			break
		end
		
		if cnt == 1 then 
			gg.editAll('100000000', gg.TYPE_DOUBLE)
			gg.alert('Hacking Done, Enjoy')
			break
		end 
		
		gg.alert ('Go to game and change the value, then open gg to continue')
		gg.setVisible(false)
	end
	gg.sleep(100)
end

 

GameGuardian.git_signed.apk

Share this post


Link to post
Share on other sites

Ok testing the new version with "visible" parameters.

Share this post


Link to post
Share on other sites

You made my day enyby. I saw xmodgames use lua too. Ia it possible to protect lua scripts?

Share this post


Link to post
Share on other sites

Not in our implementation. We use LuaJ with custom changes. In general lua allow make compiled form of script but we do not plan support it.

Share this post


Link to post
Share on other sites

Interesting. Would be nice to mess around with this feature. Then I can get this to run that UNDO command I wanted.

Share this post


Link to post
Share on other sites

You can load data into script and make undo - redo in any depth. Also you can use files for store/load data and so on.

If some function common and widely used - we can add it into gg table. like function sleep.

_______________________________________________
added 0 minutes later

Good wiki for common solutions: http://lua-users.org/wiki/SleepFunction

Share this post


Link to post
Share on other sites

I'm looking in Lua manual for a "wait until X is true" command.... 

 

Does someone know such a command?

Edited by Backlift

Share this post


Link to post
Share on other sites

Use while loop.

while not x do
	gg.sleep(100)
	end

Share this post


Link to post
Share on other sites
2 minutes ago, Enyby said:

Use while loop.

 


while not x do
	gg.sleep(100)
	end

 

Got this, wait I show you a cool code.

Share this post


Link to post
Share on other sites

Does it support "goto" command?

 

I found out it does.

But the "while not" seems not working...

Edited by Backlift

Share this post


Link to post
Share on other sites

Is this ok?

"While not X is happening do Y

Do Z

end"

I want Z to be done when X is done, if not, do Y (sleep), but it seems not working, it does Z anyway 

Share this post


Link to post
Share on other sites

I made it HAHA.

 

It's super Automatic.

Only input value

Share this post


Link to post
Share on other sites

I already post code which work in auto mode. Latest version of your script.

_______________________________________________
added 2 minutes later
1 hour ago, Backlift said:

Is this ok?

"While not X is happening do Y

Do Z

end"

I want Z to be done when X is done, if not, do Y (sleep), but it seems not working, it does Z anyway 

While not x do
	y
	end
	Z

_______________________________________________
added 4 minutes later
1 hour ago, Backlift said:

Does it support "goto" command?

 

I found out it does.

But the "while not" seems not working...

Better avoid goto at all.

I do not know - maybe it present. Read reference manual and try.

 

Share this post


Link to post
Share on other sites

1. Too many comments as for me.

Hard read code behind comments.

2.

1 hour ago, Backlift said:

if gg.getResultCount() == 4

Not good choice rely on exact count. I think better firstly for `== 0` and next is `<= 4`.

3.

1 hour ago, Backlift said:

gg.prompt

Can return nil if user press `cancel` - you script crashed in this case. See my last edition - i check for this.

4 hours ago, Enyby said:

local d = gg.prompt({A='Number of Orbs Or Dooblins'}, {A='0'}) if d == nil then gg.alert('Script canceled') break end

4.

1 hour ago, Backlift said:

print -- show the user a message, this is to inform the user there are currently too much values found, the user may go in the game and change the value then open the gameguardian window again by tapping on it's floating icon ('Too much values found, Go to game and change the value, then open gameguardian window again')

`print` not show any to user. You need `gg.alert` or `gg.toast`. `print` only print debug info into dcript log executin. User can see at only at the script end. Not while script run.

5.

1 hour ago, Backlift said:

gg.sleep(1) -- sleep 1 second until next command, so it will not continiously be running, or it supposed to be

`gg.sleep` defined as `gg.sleep(int milliseconds) -> nil` then take not seconds but milliseconds. You need pass 1000 for sleep in one second.

6.

1 hour ago, Backlift said:

if gg.isVisible() == false

More easy write `if not gg.isVisible()` or `if not(gg.isVisible())`.

7. you better avoid goto. For example I make similar script without it. With loop.

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