Jump to content

LUA scripting


Enyby
 Share

Recommended Posts

On 7/24/2017 at 7:08 AM, Enyby said:

print(gg.choice({'1', 'cat', 'dog', 'racoon', 'bear'}))


Im trying to use that code for this:


gg.choice({'Hack Coins'}, {'Hack Energy,Shield or Life'})
if gg.choice() == 1 then goto coin end
if gg.choice() == 2 then goto other end
if gg.choice() == nil then print('ABORT: No value type selection') goto endall end

but it won't work and says something like this:

Bad argument, Table expected, Got number (or value)

how to define table for it? :D

Link to comment
Share on other sites

  • Administrators
31 minutes ago, Backlift said:

but it won't work and says something like this:

Wrong usage.

local c = gg.choice({'Hack Coins', 'Hack Energy,Shield or Life'})
if c == 1 then goto coin end
if c == 2 then goto other end
if c == nil then print('ABORT: No value type selection') goto endall end

 

Link to comment
Share on other sites

  • Administrators

In next release we make required call gg.getResults before gg.editAll. If it is not true script can end with message

Quote

You must call gg.getResults before calling gg.editAll.

Good:

	gg.clearResults()
	gg.searchNumber ('8', gg.TYPE_DWORD)
	gg.getResults(count)
	gg.editAll('1', gg.TYPE_DWORD)

Bad:

	gg.clearResults()
	gg.searchNumber ('8', gg.TYPE_DWORD)
	-- gg.getResults(count)
	gg.editAll('1', gg.TYPE_DWORD)

 

Link to comment
Share on other sites

  • Administrators
17 minutes ago, Aufar_R said:

Can you give me an example of a full code using that code?

-- good	
gg.clearResults()
gg.searchNumber ('8', gg.TYPE_DWORD)
gg.getResults(10) -- we load first 10 results or less
gg.editAll('8', gg.TYPE_DWORD) -- we change all loaded, all ok

-- bad	
gg.clearResults()
gg.searchNumber ('8', gg.TYPE_DWORD)
gg.editAll('8', gg.TYPE_DWORD) -- we try change all loaded, but we do not ask load any results, so script crash on this line

 

Link to comment
Share on other sites

24 minutes ago, Logic11211 said:

If I wanted to write a script with the new dword xor search... What's the proper syntax ?

I use this script:

 a = gg.prompt ( etc...) 

 z = a .. 'X7' 

 gg.searchNumber(z, gg.type_DWORD, etc...) 

That is for searching "valueX7"

 

Link to comment
Share on other sites

  • Administrators
14 minutes ago, Backlift said:

'X7'

One note: 7 is bad choice for dword. Dword must be aligned in 4 bytes. So this number must be 4 8 12 16 20, but not 7.

_______________________________________________
added 1 minute later
16 minutes ago, Backlift said:

I use this script:

gg.prompt return table, not value, so need

z = a[1] .. 'X7' 
_______________________________________________
added 2 minutes later
17 minutes ago, Backlift said:

 gg.searchNumber(z, gg.type_DWORD, etc...) 

That is for searching "valueX7"

"etc..." part not required started from 8.29.0. If it omitted then used defaults.

Link to comment
Share on other sites

1 minute ago, Enyby said:

One note: 7 is bad choice for dword. Dword must be aligned in 4 bytes. So this number must be 4 8 12 16 20, but not 7

oh, didn't knew that. thanks.

 

1 minute ago, Enyby said:

gg.prompt return table, not value, so need


z = a[1] .. 'X7' 

yeah. i actually used 

 a = v['i'] 

 

before that, thanks for saying.

Link to comment
Share on other sites

  • Administrators
Just now, Backlift said:

oh, didn't knew that. thanks.

This written in app help for this search method:

Quote

Distance must respect values align. For example, dword must be aligned to 4-bytes boundary. This mean search \"40__mode_xor__7\" is useless for dword because 7 can not divide to 4.

 

Link to comment
Share on other sites

  • Administrators
1 minute ago, Backlift said:

yeah. i actually used

I advice use integer indexes without specify it on creation. It can produce right order of fields on prompt. For explicit indexes order can be any.

local data = gg.prompt({'v1.0.0', 'v1.1.0', 'v2.0.0'}, {'1', '2', '3'}) -- here order fields on dialog always be as I specified

print(data[1], data[2], data[3])

-- in any examples below order can be any
local data = gg.prompt({[i]='v1.0.0', [j]='v1.1.0', [k]='v2.0.0'}, {[i]='1', [j]='2', [k]='3'}) 
local data = gg.prompt({[1]='v1.0.0', [2]='v1.1.0', [3]='v2.0.0'}, {[1]='1', [2]='2', [3]='3'}) 
local data = gg.prompt({[0]='v1.0.0', [1]='v1.1.0', [2]='v2.0.0'}, {[0]='1', [1]='2', [2]='3'}) 

 

_______________________________________________
added 2 minutes later
12 minutes ago, Enyby said:

"etc..." part not required started from 8.29.0. If it omitted then used defaults.

 

On 24.07.2017 at 2:43 AM, Enyby said:

[searchNumber] = function: searchNumber /* gg.searchNumber(string text[, int type[, bool encrypted[, int sign[, long memoryFrom[, long memoryTo]]]]]) -> true || string with error */

 

_______________________________________________
added 3 minutes later

Defaults is obviously:

gg.searchNumber(string text[, int type = gg.TYPE_AUTO[, bool encrypted = false[, int sign = gg.SIGN_EQUAL[, long memoryFrom = 0[, long memoryTo = -1]]]]]

 

Link to comment
Share on other sites

@Enyby can see an example of (gg.searchfuzzy)? 

I got how start fuzzy works, but this command is complicated:

 searchFuzzy /* gg.searchFuzzy([string difference[, int type[, int sign[, long memoryFrom[, long memoryTo]]]]]) 

_______________________________________________
added 2 minutes later

example of changed value.

and unchanged.

 

the (string diffrence) option is not defined at (gg) table

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.