Jump to content

LUA scripting


Enyby
 Share

Recommended Posts

  • Administrators
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

Link to comment
Share on other sites

  • Administrators

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

Link to comment
Share on other sites

  • Administrators

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.

 

Link to comment
Share on other sites

  • Administrators

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.

Link to comment
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
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.