Jump to content
Enyby

LUA scripting

Recommended Posts


Interesting.

One may just load Lua script and only input the value.

Other options like type and region will be automatically set.

Also I think it could automatically calculate and add the other values based on the value found with stored offsets in it, makes many things easier.

Share this post


Link to post
Share on other sites

Yes. And can be created automated calculator/tool based on gg.

Present function 'toast', 'alert' and 'prompt' which allow create some dialogs for user.

For example 'Input gold amount:' and use this value for make search.

data = gg.prompt({[1]='Search value', [2]='Replace value', [3]='Max count'}, {[1]='123', [2]='456', [3]='321'})
gg.searchNumber(data[1], gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1)
found = gg.getResultCount()
gg.alert('We found: '..found)
gg.getResults(data[3])
replaced = gg.editAll(data[2], gg.TYPE_DWORD)
gg.alert('We replaced: '..replaced)
gg.alert('Summary: We search '..data[1]..', found '..found..', replaced '..replaced..' to '..data[2]..' with max count '..data[3]..';')
print('Script ended.')

bandicam 2017-07-17 07-41-24-722.pngbandicam 2017-07-17 07-41-33-494.pngbandicam 2017-07-17 07-41-38-267.pngbandicam 2017-07-17 07-41-41-348.pngbandicam 2017-07-17 07-41-45-676.pngbandicam 2017-07-17 07-41-58-375.pngbandicam 2017-07-17 07-42-01-589.png

Share this post


Link to post
Share on other sites

Haha, that's what I like.

I will try to learn it.

Will make Nice scripts.

Share this post


Link to post
Share on other sites
d = gg.prompt({A='A', B='B', C='C'}, {A='123', B='456', C='789'})
gg.alert('A + B - 3*C = '..(d.A + d.B - 3*d.C))

bandicam 2017-07-17 08-17-04-293.pngbandicam 2017-07-17 08-17-08-790.png

Share this post


Link to post
Share on other sites

Script can work with files. It can be useful for create complicated things.

API to GG will be edited and extend in future releases. Now present only basic features for scripts.

Scripts can be used for automate some things like lot of same actions. For example for Asphalt 8 Enduro Double Down can be written automated scripts which make hundred of replace in one run.

Share this post


Link to post
Share on other sites

I found it pretty easy.

Just copied the data from post above into a text file then replaced the ".txt" extention to ".Lua" and then went to search tab and rap on "more" (three lines) button and "excute script".

So simple.

I think by working with these samples, it's easily possible to make a good one for a game.

On it now.

 

Screenshot_20170717-095713.png

Screenshot_20170717-095723.png

Screenshot_20170717-095733.png

Screenshot_20170717-095741.png

Screenshot_20170717-095748.png

Share this post


Link to post
Share on other sites

No need change extension. You can load .txt files. Or any others.

Share this post


Link to post
Share on other sites

One thing, why the position of "C" and "B" are flipped?

The code is OK as I'm seeing it.

Share this post


Link to post
Share on other sites

Lua table not specified order of fields. Maybe in future I try fix this.

I make this support of scripting in last 3-4 weeks. It is first public release. Something can be not good or broken. In future we try improve it.

Share this post


Link to post
Share on other sites

Thanks for the hard work.

I will try to help too.

Share this post


Link to post
Share on other sites

Script for hack Asphalt 8 nitro:

gg.searchNumber('2;8;10;12;15;20;25;30:61', gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1)
gg.getResults(100)
print('Replaced: ', gg.editAll('1000', gg.TYPE_FLOAT))
print('Nitro hacked!')

bandicam 2017-07-17 08-49-37-459.pngbandicam 2017-07-17 08-49-50-457.pngbandicam 2017-07-17 08-50-24-287.png

Share this post


Link to post
Share on other sites

I'm working on hack for Quadropus Game.

I made it to hack the input value as double and Encrypted.

But I'm stuck in this situation:

The user needs get back into game and change the value and then come back GG and enter the new value.

Will this work? :

print('go to game and change the value and then load script again') 

So it loads the script again and it search in the found results...or it makes a new search?

_______________________________________________
added 3 minutes later

I want to make an IF Statement:

1_If found 1 value, edit value to 10000000000

2_if Not found 1 value, print'('go to game and change the value, then load the script again')

 

Possible? If yes, how?

Share this post


Link to post
Share on other sites

Depends on your logic. Read Lua manual reference posted in first post.

if gg.getResultCount() == 0 then
	gg.alert('Find something and run script again!')
else
	gg.alert('Wow! You found '..gg.getResultCount()..' results! Not bad!')
	gg.toast('You cool!')
end

bandicam 2017-07-17 09-07-47-077.pngbandicam 2017-07-17 09-08-16-419.pngbandicam 2017-07-17 09-08-18-478.png

Share this post


Link to post
Share on other sites

You can store state to file and load on each start script. Or wait for some actions. In last case user do not need run script each time.

But this not always possible.

function sleep(s)
  local ntime = os.clock() + s
  repeat until os.clock() > ntime
end

while gg.getResultCount() < 10 do
	c = gg.getResultCount()
	gg.toast('I wait for you! Only '..(10 - c)..' need!', true)
	sleep(3)
end

gg.alert('You done!')

bandicam 2017-07-17 09-16-53-901.pngbandicam 2017-07-17 09-17-08-872.png

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