 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Branimir Advanced Cheater
Reputation: 0
Joined: 12 May 2015 Posts: 59
|
Posted: Tue Jan 12, 2016 9:03 am Post subject: [SUGGESTION] An option to auto-generate addresses via offset |
|
|
Here is the full message:
I know about Smart edit Address(es), but that only works if the addresses are already in the Cheat Table.
So, please add an option to auto-generate addresses based on:
start address
offset
end address
What I mean is:
You input a start address (Your "base" address), an offset (The amount to increase that address by), and an end address (The point where CE stops making addresses).
After your selection is over, CE adds your chosen offset to your start address, then creates a result address.
It repeats that cycle until it hits the end address. eg: start 00000000 -> offset 4C -> end 00002E9C.
eg2: 00000000, 0000004C, 00000098, 000000E4, 00000130, 0000017C, 000001C8... -> 00002E9C (END).
If you could implement such an option... it would make my life so much easier!
If such a thing already exists in CE then, you have my sincerest apologies!
Thank you for your time.
|
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4702
|
Posted: Tue Jan 12, 2016 10:52 am Post subject: |
|
|
Code: | function addMoreAddresses(baseAddress, step, endAddress)
if type(baseAddress) == "number" then
baseAddress = string.format("%X",baseAddress)
end
if type(step) == "string" then
step = tonumber(step,16)
end
if type(endAddress) == "number" then
endAddress = string.format("%X",endAddress)
end
local al = getAddressList()
local base = al.createMemoryRecord()
base.setAddress(baseAddress)
base.setDescription("Base Address")
base.Type = vtString
base.String.Size = 0
for i=0, (tonumber(endAddress,16)-tonumber(baseAddress,16))/step, 1 do
local rec = al.createMemoryRecord()
local str = string.format("+%X", i * step)
rec.setAddress(str)
rec.setDescription(str)
rec.appendToEntry(base)
end
end | Edit: added argument checks
Modification of Zanzer's code here.
_________________
I don't know where I'm going, but I'll figure it out when I get there.
Last edited by ParkourPenguin on Tue Jan 12, 2016 4:12 pm; edited 1 time in total |
|
Back to top |
|
 |
Branimir Advanced Cheater
Reputation: 0
Joined: 12 May 2015 Posts: 59
|
Posted: Tue Jan 12, 2016 12:44 pm Post subject: |
|
|
Code: | function addMoreAddresses(baseAddress, step, endAddress)
local al = getAddressList()
local base = al.createMemoryRecord()
base.setAddress(baseAddress)
base.setDescription("Base Address")
base.Type = vtString
base.String.Size = 0
for i=0, (endAddress-baseAddress)/step, 1 do
local rec = al.createMemoryRecord()
local str = string.format("+%X", i * step)
rec.setAddress(str)
rec.setDescription(str)
rec.appendToEntry(base)
end
end |
Apologies, but could you explain to this ignorant fool how to properly use your LUA script to achieve the desired results?
|
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4702
|
Posted: Tue Jan 12, 2016 12:54 pm Post subject: |
|
|
Open up the Lua script window (Table -> Show Cheat Table Lua Script, or Ctrl + Alt + L), paste that function in, and execute the script by clicking on the button at the bottom.
Then, you just have to call that function with the appropriate arguments. baseAddress is a number corresponding to what address you want to start at, step is the offset as you call it, and the end address is where you want to end. Using the example in your first post, it would be like this:
Code: | addMoreAddresses(0, 0x4C, 0x2E9C) | The 0x in front of numbers specifies that number is a hexadecimal number. 0x4C == 76 (decimal).
You can call that function either via the Lua console window (Ctrl + Alt + Shift + L) or just write it under the function in the Lua script window and execute the script again. Example using the Lua script window:
Code: | function addMoreAddresses(baseAddress, step, endAddress)
...
end
addMoreAddresses(0, 0x4C, 0x2E9C) |
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
 |
Branimir Advanced Cheater
Reputation: 0
Joined: 12 May 2015 Posts: 59
|
Posted: Tue Jan 12, 2016 1:22 pm Post subject: |
|
|
ParkourPenguin wrote: | Open up the Lua script window (Table -> Show Cheat Table Lua Script, or Ctrl + Alt + L), paste that function in, and execute the script by clicking on the button at the bottom.
Then, you just have to call that function with the appropriate arguments. baseAddress is a number corresponding to what address you want to start at, step is the offset as you call it, and the end address is where you want to end. Using the example in your first post, it would be like this:
Code: | addMoreAddresses(0, 0x4C, 0x2E9C) | The 0x in front of numbers specifies that number is a hexadecimal number. 0x4C == 76 (decimal).
You can call that function either via the Lua console window (Ctrl + Alt + Shift + L) or just write it under the function in the Lua script window and execute the script again. Example using the Lua script window:
Code: | function addMoreAddresses(baseAddress, step, endAddress)
...
end
addMoreAddresses(0, 0x4C, 0x2E9C) |
|
Worked like a charm.
Many thanks for your help.
I still need to properly name them all, but oh well. You can't have it all.
|
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|