View previous topic :: View next topic |
Author |
Message |
sugarcool How do I cheat? Reputation: 0
Joined: 21 Jun 2021 Posts: 3
|
Posted: Mon Jun 21, 2021 4:02 pm Post subject: Memory Record Changing To Nil After Restart |
|
|
Every time I save and close my cheat engine table when I reopen it my custom address seems to be set to nil. It's still recognized as existing however it's nil. The only workaround I found so far was to create new addresses that haven't existed yet. Afterwards, the address is still stored but the value is "???". I've tried a workaround when checking if the value is nil it will rewrite the address to float 1.5, and in the meantime set speed to 15, however, that doesn't work either and the value remains "???" or nil but the address still is continuing to be stored.
Currently, due to this problem, this code gives me an "attempt to perform arithmetic on a nil value" at line 17.
Code: |
{$lua}
local al = getAddressList()
local x = al.getMemoryRecordByDescription("LPVelX")
local y = al.getMemoryRecordByDescription("LPVelY")
local z = al.getMemoryRecordByDescription("LPVelZ")
local SpeedAddress = "ElytraSpeed"
[ENABLE]
if not getAddressSafe(SpeedAddress) then
local addr = allocateMemory(4)
registerSymbol(SpeedAddress, addr)
writeFloat(SpeedAddress, 1.5)
end
local speed = readFloat(getAddressSafe(SpeedAddress))
x.Value = x.Value * speed
y.Value = y.Value * speed
z.Value = z.Value * speed
[DISABLE]
|
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Tue Jun 22, 2021 12:29 am Post subject: |
|
|
how do you update/initialize the address of ElytraSpeed ?
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
sugarcool How do I cheat? Reputation: 0
Joined: 21 Jun 2021 Posts: 3
|
Posted: Tue Jun 22, 2021 6:27 am Post subject: |
|
|
Dark Byte wrote: | how do you update/initialize the address of ElytraSpeed ? |
I don't know what this means but currently, I just put a manual address with the address "ElytraSpeed". It works the first time around but when I save and reopen the cheat table it breaks. Also wouldn't the first part of the code initialize it if it doesn't exist?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Tue Jun 22, 2021 8:39 am Post subject: |
|
|
ok I see how it gets used
Try keeping track of the processid
e.g
Code: |
if myscript==nil then
myscript={} --not local
end
if myscript.processid~=getOpenedProcessID() then
unregisterSymbol(SpeedAddress)
local addr = allocateMemory(4)
registerSymbol(SpeedAddress, addr)
writeFloat(SpeedAddress, 1.5)
myscript.processid=getOpenedProcessID()
end
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
sugarcool How do I cheat? Reputation: 0
Joined: 21 Jun 2021 Posts: 3
|
Posted: Tue Jun 22, 2021 2:01 pm Post subject: |
|
|
Oh ok. I ended up finding a fix of unRegistering the symbol when it's nil and registering it again. Thank you, I didn't know it would change base on processId or that processId even existed.
Dark Byte wrote: | ok I see how it gets used
Try keeping track of the processid
e.g
Code: |
if myscript==nil then
myscript={} --not local
end
if myscript.processid~=getOpenedProcessID() then
unregisterSymbol(SpeedAddress)
local addr = allocateMemory(4)
registerSymbol(SpeedAddress, addr)
writeFloat(SpeedAddress, 1.5)
myscript.processid=getOpenedProcessID()
end
|
|
|
|
Back to top |
|
|
|