Jump to content
  • 0

Variable is not defined


HorridModz
 Share

Question

Look at function number 2 (selectconditions) and the last function (searchandrefine).

When I run this and select some stuff, it says there is an attempt to index a nil value (encrypted) in function searchandrefine.

But I clearly define encrypted as encrypted = gg.multiChoice in function selectconditions.

Can someone please fix my code? Thanks!

function wait_for_action()

gg.setVisible(false) 

while true do

gg.sleep(500)

if gg.isVisible()then

break

end

end

end

 

function selectconditions(encrypted)

if encrypted == 1 then

encrypted = gg.multiChoice({'Encrypted'},nil,'Is the value encrypted?')

end

signs = {gg.SIGN_EQUAL,gg.SIGN_NOT_EQUAL,gg.SIGN_GREATER_,gg.SIGN_LESS,gg.SIGN_GREATER_OR_EQUAL,gg.SIGN_LESS_OR_EQUAL}

signchoice = gg.multiChoice({'=',' ≠','>','<',' ≥','≤'},nil,'What condition?')

i = 0

while not signchoice[i] do

i = i + 1

end

sign = signs[i]

end

 

function selecttype()

menu = gg.multiChoice({'Auto','Dword','Float','Double','Word','Byte','Qword','Xor'},nil,'What type to search?')

if menu == nil then

else

if menu[1] then

a = 1

type = gg.TYPE_AUTO

end

if menu[2] then

a = 1

type = gg.TYPE_DWORD

end

if menu[3] then

a = 1

type = gg.TYPE_FLOAT

end

if menu[4] then

a = 1

type = gg.TYPE_DOUBLE

end

if menu[5] then

a = 1

type = gg.TYPE_WORD

end

if menu[6] then

a = 1

type = gg.TYPE_BYTE

end

if menu[7] then

a = 1

type = gg.TYPE_QWORD

end

if menu[8] then

a = 1

type = gg.TYPE_XOR

end

end

while a == 0 do

a = 0

menu = gg.multiChoice({'Auto','Dword','Float','Double','Word','Byte','Qword','Xor',},nil,'What type to search?')

if menu == nil then

else

if menu[1] then

a = 1

type = gg.TYPE_AUTO

end

if menu[2] then

a = 1

type = gg.TYPE_DWORD

end

if menu[3] then

a = 1

type = gg.TYPE_FLOAT

end

if menu[4] then

a = 1

type = gg.TYPE_DOUBLE

end

if menu[5] then

a = 1

type = gg.TYPE_WORD

end

if menu[6] then

a = 1

type = gg.TYPE_BYTE

end

if menu[7] then

a = 1

type = gg.TYPE_QWORD

end

if menu[8] then

a = 1

type = gg.TYPE_XOR

end

end

end

end

 

function selectranges()

menu = gg.multiChoice({'Jh: Java heap','Ch: C++ heap','Ca: C++ alloc','Cd: C++ .data','Cb: C++ .bss','PS:PPSSPP','A: Anonymous','J: Java','S: Stack','A: Ashmen','V: Video','O: Other','B: Bad','Xa: Code app','Xs: Code system','Reset','All'},nil,"Select memory ranges. If you don’t know what this is, select “All”.")

ranges = ""

if menu[1] then

ranges = ranges .. "gg.REGION_JAVA_HEAP | "

end

if menu[2] then

ranges = ranges .. "gg.REGION_C_HEAP | "

end

if menu[3] then

ranges = ranges .. "gg.REGION_C_ALLOC | "

end

if menu[4] then

ranges = ranges .. "gg.REGION_C_DATA | "

end

if menu[5] then

a = 1

type = gg.TYPE_WORD

end

if menu[6] then

a = 1

type = gg.TYPE_BYTE

end

if menu[7] then

a = 1

type = gg.TYPE_QWORD

end

if menu[8] then

a = 1

type = gg.TYPE_XOR

end

gg.setRanges(ranges)

end

 

 

end



 

function searchandrefine()

gg.clearResults()

selecttype()

selectconditions(1)

value = gg.prompt({[1] = 'What is the value?'},

{[1] = '0'},

{[1] = 'text'})

gg.searchNumber(value[1], type, encrypted[1], sign)

while gg.getResultsCount() > 10 do

gg.alert('Make the value change, then click the gameguardian icon.')

wait_for_action()

gg.refineNumber(value[1], type, encrypted[1], sign)

value = gg.prompt({[1] = 'What has the value changed to?'},

{[1] = '0'},

{[1] = 'text'})

end

continue = gg.multiChoice({'There are' .. gg.getResultsCount() .. 'results left. Would you like to continue refining?'},nil,'')

while continue[1] or gg.getResultsCount() < 2 do

gg.alert('Make the value change, then click the gameguardian icon.')

wait_for_action()

gg.refineNumber(value[1], type, encrypted[1], sign)

value = gg.prompt({[1] = 'What has the value changed to?'},

{[1] = '0'},

{[1] = 'text'})

continue = gg.multiChoice({'There are' .. gg.getResultsCount() .. 'results left. Would you like to continue refining?'},nil,'')

end

end







 

searchandrefine()

Screenshot_20220420-195800.png

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0
1 hour ago, HorridModz said:

Look at function number 2 (selectconditions) and the last function (searchandrefine).

When I run this and select some stuff, it says there is an attempt to index a nil value (encrypted) in function searchandrefine.

But I clearly define encrypted as encrypted = gg.multiChoice in function selectconditions.

Can someone please fix my code? Thanks!

function wait_for_action()

gg.setVisible(false) 

while true do

gg.sleep(500)

if gg.isVisible()then

break

end

end

end

 

function selectconditions(encrypted)

if encrypted == 1 then

encrypted = gg.multiChoice({'Encrypted'},nil,'Is the value encrypted?')

end

signs = {gg.SIGN_EQUAL,gg.SIGN_NOT_EQUAL,gg.SIGN_GREATER_,gg.SIGN_LESS,gg.SIGN_GREATER_OR_EQUAL,gg.SIGN_LESS_OR_EQUAL}

signchoice = gg.multiChoice({'=',' ≠','>','<',' ≥','≤'},nil,'What condition?')

i = 0

while not signchoice[i] do

i = i + 1

end

sign = signs[i]

end

 

function selecttype()

menu = gg.multiChoice({'Auto','Dword','Float','Double','Word','Byte','Qword','Xor'},nil,'What type to search?')

if menu == nil then

else

if menu[1] then

a = 1

type = gg.TYPE_AUTO

end

if menu[2] then

a = 1

type = gg.TYPE_DWORD

end

if menu[3] then

a = 1

type = gg.TYPE_FLOAT

end

if menu[4] then

a = 1

type = gg.TYPE_DOUBLE

end

if menu[5] then

a = 1

type = gg.TYPE_WORD

end

if menu[6] then

a = 1

type = gg.TYPE_BYTE

end

if menu[7] then

a = 1

type = gg.TYPE_QWORD

end

if menu[8] then

a = 1

type = gg.TYPE_XOR

end

end

while a == 0 do

a = 0

menu = gg.multiChoice({'Auto','Dword','Float','Double','Word','Byte','Qword','Xor',},nil,'What type to search?')

if menu == nil then

else

if menu[1] then

a = 1

type = gg.TYPE_AUTO

end

if menu[2] then

a = 1

type = gg.TYPE_DWORD

end

if menu[3] then

a = 1

type = gg.TYPE_FLOAT

end

if menu[4] then

a = 1

type = gg.TYPE_DOUBLE

end

if menu[5] then

a = 1

type = gg.TYPE_WORD

end

if menu[6] then

a = 1

type = gg.TYPE_BYTE

end

if menu[7] then

a = 1

type = gg.TYPE_QWORD

end

if menu[8] then

a = 1

type = gg.TYPE_XOR

end

end

end

end

 

function selectranges()

menu = gg.multiChoice({'Jh: Java heap','Ch: C++ heap','Ca: C++ alloc','Cd: C++ .data','Cb: C++ .bss','PS:PPSSPP','A: Anonymous','J: Java','S: Stack','A: Ashmen','V: Video','O: Other','B: Bad','Xa: Code app','Xs: Code system','Reset','All'},nil,"Select memory ranges. If you don’t know what this is, select “All”.")

ranges = ""

if menu[1] then

ranges = ranges .. "gg.REGION_JAVA_HEAP | "

end

if menu[2] then

ranges = ranges .. "gg.REGION_C_HEAP | "

end

if menu[3] then

ranges = ranges .. "gg.REGION_C_ALLOC | "

end

if menu[4] then

ranges = ranges .. "gg.REGION_C_DATA | "

end

if menu[5] then

a = 1

type = gg.TYPE_WORD

end

if menu[6] then

a = 1

type = gg.TYPE_BYTE

end

if menu[7] then

a = 1

type = gg.TYPE_QWORD

end

if menu[8] then

a = 1

type = gg.TYPE_XOR

end

gg.setRanges(ranges)

end

 

 

end



 

function searchandrefine()

gg.clearResults()

selecttype()

selectconditions(1)

value = gg.prompt({[1] = 'What is the value?'},

{[1] = '0'},

{[1] = 'text'})

gg.searchNumber(value[1], type, encrypted[1], sign)

while gg.getResultsCount() > 10 do

gg.alert('Make the value change, then click the gameguardian icon.')

wait_for_action()

gg.refineNumber(value[1], type, encrypted[1], sign)

value = gg.prompt({[1] = 'What has the value changed to?'},

{[1] = '0'},

{[1] = 'text'})

end

continue = gg.multiChoice({'There are' .. gg.getResultsCount() .. 'results left. Would you like to continue refining?'},nil,'')

while continue[1] or gg.getResultsCount() < 2 do

gg.alert('Make the value change, then click the gameguardian icon.')

wait_for_action()

gg.refineNumber(value[1], type, encrypted[1], sign)

value = gg.prompt({[1] = 'What has the value changed to?'},

{[1] = '0'},

{[1] = 'text'})

continue = gg.multiChoice({'There are' .. gg.getResultsCount() .. 'results left. Would you like to continue refining?'},nil,'')

end

end







 

searchandrefine()

Screenshot_20220420-195800.png

I wanted to tell you the solution, but the writing made me excited, that's very normal.

Link to comment
Share on other sites

  • 0

Change this

function selectconditions(encrypted)

if encrypted == 1 then

encrypted = gg.multiChoice({'Encrypted'},nil,'Is the value encrypted?')

To

function selectconditions(is_encrypted)

if is_encrypted == 1 then

encrypted = gg.multiChoice({'Encrypted'},nil,'Is the value encrypted?')

"encrypted" is a local variable when passed to a command like this and cant be set as a global vatiable of the same name

 

Link to comment
Share on other sites

  • 0
5 hours ago, BadCase said:

Change this

function selectconditions(encrypted)

if encrypted == 1 then

encrypted = gg.multiChoice({'Encrypted'},nil,'Is the value encrypted?')

To

function selectconditions(is_encrypted)

if is_encrypted == 1 then

encrypted = gg.multiChoice({'Encrypted'},nil,'Is the value encrypted?')

"encrypted" is a local variable when passed to a command like this and cant be set as a global vatiable of the same name

 

Oh thanks, so my parameter and variable had a contradicting name! Easy fix, thanks for finding!

14 hours ago, HEROGAMEOfficial said:

I wanted to tell you the solution, but the writing made me excited, that's very normal.

WDYM?

Link to comment
Share on other sites

  • 0
2 hours ago, HEROGAMEOfficial said:

@EnybyDo you understand what he said?

Me: No.

I hope he read the rules. But its impossible?

If you don't understand it then don't post here please. Someone who understood already helped me.

1 hour ago, zam535582 said:

BTW..

IMG_20220422_073839.thumb.jpg.030cff47e67aefd1052b300cafed92bb.jpg

Same for you @HEROGAMEOfficialHEROGAMand @zam535582

Link to comment
Share on other sites

  • 0
2 hours ago, HEROGAMEOfficial said:

That's very helpful:

Screenshot_20220422-081920.thumb.png.148bd52b78000c6e926516502116b4ea.png

Its "funny" how you haven't had a ban yet, posting every time a useless comment that isn't helping anyone. Tagging Enyby in every post. Why do you tag Enyby for this, do you think he does not check the forum?? Your always reacting to mistakes of people, but it does not help with their question. Try to educate on what he did wrong, or ask for more information if you can't understand the post. 

Link to comment
Share on other sites

  • 0

Unless your intentionally posting nonsense comments for the sake of profile status. But then if i look to your profile status most of your comments are more about complains then something else. Barely helping anyone. People get the delusional thought that on this forum the amount of posts you have is linked to your experience or some sort.

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.