View previous topic :: View next topic |
Author |
Message |
Johnden Cheater Reputation: 0
Joined: 30 Jan 2018 Posts: 25
|
Posted: Sat Feb 17, 2018 9:30 am Post subject: Pointer address value |
|
|
When a pointer address can't find any dynamic address or isn't in use, it displays value=??
Is it possible to detect this value using If Statement? |
|
Back to top |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Sat Feb 17, 2018 10:23 am Post subject: |
|
|
The Value property is a string so you can just compare with
if ...Value = '??' then ... end
The CurrentAddress property will also be 0 and the AddressString will be 'P->????????' (this will not be true for static addresses that aren't pointers however, their AddressString will be the same as their Address property but with ()s around it). _________________
|
|
Back to top |
|
|
Johnden Cheater Reputation: 0
Joined: 30 Jan 2018 Posts: 25
|
Posted: Sat Feb 17, 2018 10:43 am Post subject: |
|
|
I tried it in this code but it remained still in false
Code: |
function CETimer47Timer(sender)
local memrec=getAddressList().getMemoryRecordByDescription("Achievement12")
if tonumber(memrec.value)>=15 then
CETrainer_CEImage12.Visible=false
elseif tonumber(memrec.value)=='??' then
CETrainer_CEImage12.Visible=true
else CETrainer_CEImage12.Visible=true
end
end
|
|
|
Back to top |
|
|
TheyCallMeTim13 Wiki Contributor Reputation: 50
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Sat Feb 17, 2018 11:43 am Post subject: |
|
|
Johnden wrote: | I tried it in this code but it remained still in false
Code: |
function CETimer47Timer(sender)
local memrec=getAddressList().getMemoryRecordByDescription("Achievement12")
if tonumber(memrec.value)>=15 then
CETrainer_CEImage12.Visible=false
elseif tonumber(memrec.value)=='??' then
CETrainer_CEImage12.Visible=true
else CETrainer_CEImage12.Visible=true
end
end
|
|
You're comparing a string and a number, that's why it's false. Any number will never equal a string value of '??'.
Try "if memrec.value == '??' then" _________________
|
|
Back to top |
|
|
Johnden Cheater Reputation: 0
Joined: 30 Jan 2018 Posts: 25
|
Posted: Sat Feb 17, 2018 12:04 pm Post subject: |
|
|
Weird that this works:
Code: |
if memrec.value=="??" then
CETrainer_CEImage12.Visible=true
elseif tonumber(memrec.value)>=15 then
CETrainer_CEImage12.Visible=false
else CETrainer_CEImage12.Visible=true
end
|
But this doesn't:
Code: |
if tonumber(memrec.value)>=15 then
CETrainer_CEImage12.Visible=false
elseif memrec.value=="??" then
CETrainer_CEImage12.Visible=true
else CETrainer_CEImage12.Visible=true
end
|
Either way Thank You! |
|
Back to top |
|
|
TheyCallMeTim13 Wiki Contributor Reputation: 50
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Sat Feb 17, 2018 12:26 pm Post subject: |
|
|
Johnden wrote: | Weird that this works:
Code: |
if memrec.value=="??" then
CETrainer_CEImage12.Visible=true
elseif tonumber(memrec.value)>=15 then
CETrainer_CEImage12.Visible=false
else CETrainer_CEImage12.Visible=true
end
|
But this doesn't:
Code: |
if tonumber(memrec.value)>=15 then
CETrainer_CEImage12.Visible=false
elseif memrec.value=="??" then
CETrainer_CEImage12.Visible=true
else CETrainer_CEImage12.Visible=true
end
|
Either way Thank You! |
No it's not weird, that's what is expected. NIL doesn't equal any number.
Try "print(type(tonumber('??')))" in the Lua engine window to see that it's nil.
EDIT: Sorry, read it better, and yeah that's weird. You should be getting an error message about math with a nil value (on the second one). _________________
|
|
Back to top |
|
|
|