| View previous topic :: View next topic |
| Author |
Message |
skynet888 !BEWARE! Deletes post on answer
Reputation: 1
Joined: 12 Apr 2021 Posts: 66
|
Posted: Wed Jun 14, 2023 6:55 pm Post subject: How to add an item whose value is [address1] minus [address2 |
|
|
| How to add an item whose value is [address1] minus [address2]?
|
|
| Back to top |
|
 |
LeFiXER Grandmaster Cheater Supreme
Reputation: 20
Joined: 02 Sep 2011 Posts: 1069 Location: 0x90
|
Posted: Thu Jun 15, 2023 3:49 am Post subject: |
|
|
I'm going to give advice based on what I've interpreted of your request. If it's incorrect, please specify further.
Lua:
| Code: |
...
//-- Assuming that the value is a 4-byte whole integer value:
local difference = readInteger(address1) - readInteger(address2)
...
|
If you mean in ASM:
| Code: |
...
push rbx
mov rbx,[address1]
sub rbx,[address2]
mov [item],rbx
pop rbx
...
|
|
|
| Back to top |
|
 |
skynet888 !BEWARE! Deletes post on answer
Reputation: 1
Joined: 12 Apr 2021 Posts: 66
|
Posted: Thu Jun 15, 2023 9:35 pm Post subject: |
|
|
| LeFiXER wrote: | I'm going to give advice based on what I've interpreted of your request. If it's incorrect, please specify further.
Lua:
| Code: |
...
//-- Assuming that the value is a 4-byte whole integer value:
local difference = readInteger(address1) - readInteger(address2)
...
|
If you mean in ASM:
| Code: |
...
push rbx
mov rbx,[address1]
sub rbx,[address2]
mov [item],rbx
pop rbx
...
|
|
Thank you so much for your help.
I want to know if I can add it to the cheat table, as shown in the picture.
We know that "X" is 547, "Y" is 712, and the difference between the two is 165. Can I add an item whose value is calculated by "Y - X" and updated with the values of X and Y?
| Description: |
|
| Filesize: |
2.62 KB |
| Viewed: |
2382 Time(s) |

|
|
|
| Back to top |
|
 |
LeFiXER Grandmaster Cheater Supreme
Reputation: 20
Joined: 02 Sep 2011 Posts: 1069 Location: 0x90
|
Posted: Fri Jun 16, 2023 5:19 am Post subject: |
|
|
How I would do that is using this simple Lua script
| Code: |
[ENABLE]
{$LUA}
if syntaxcheck then return end
if tmr then tmr.destroy(); tmr = nil end
local tmr = createTimer()
tmr.Interval = 500
tmr.OnTimer = function()
if AddressList.getMemoryRecordByDescription('X') == nil or
AddressList.getMemoryRecordByDescription('Y') == nil then
tmr.destroy()
return
end
AddressList['Y - X'].value = tonumber(AddressList['Y'].value) - tonumber(AddressList['X'].value)
end
{$ASM}
[DISABLE]
{$LUA}
if syntaxcheck then return end
tmr.destroy(); tmr = nil
|
|
|
| Back to top |
|
 |
skynet888 !BEWARE! Deletes post on answer
Reputation: 1
Joined: 12 Apr 2021 Posts: 66
|
Posted: Fri Jun 16, 2023 4:03 pm Post subject: |
|
|
| LeFiXER wrote: | How I would do that is using this simple Lua script
| Code: |
[ENABLE]
{$LUA}
if syntaxcheck then return end
if tmr then tmr.destroy(); tmr = nil end
local tmr = createTimer()
tmr.Interval = 500
tmr.OnTimer = function()
if AddressList.getMemoryRecordByDescription('X') == nil or
AddressList.getMemoryRecordByDescription('Y') == nil then
tmr.destroy()
return
end
AddressList['Y - X'].value = tonumber(AddressList['Y'].value) - tonumber(AddressList['X'].value)
end
{$ASM}
[DISABLE]
{$LUA}
if syntaxcheck then return end
tmr.destroy(); tmr = nil
|
|
Thanks again. I found the cause of the error. I changed tmr to a global variable and I was able to disable it - "disable" doesn't seem to recognize the local variables defined in "enable"
| Description: |
|
| Filesize: |
34.73 KB |
| Viewed: |
2330 Time(s) |

|
| Description: |
|
| Filesize: |
12.15 KB |
| Viewed: |
2330 Time(s) |

|
|
|
| Back to top |
|
 |
LeFiXER Grandmaster Cheater Supreme
Reputation: 20
Joined: 02 Sep 2011 Posts: 1069 Location: 0x90
|
Posted: Sat Jun 17, 2023 4:41 am Post subject: |
|
|
| That's true, each section is independent of one another.
|
|
| Back to top |
|
 |
|