|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25291 Location: The netherlands
|
Posted: Tue Jan 01, 2013 4:15 am Post subject: |
|
|
1:
assuming that s is "0125d60f"
then you can convert that to a number by doing:
Code: |
n=tonumber("0x"..s)
|
2:
There are no breakpoints in lua (not using ce's debugger at least)
Just print out the data and limit the for loop to only 1 or twice.
Or don't make any adjustments to the table and only print out what it's going to do
_________________
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 |
|
|
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Tue Jan 01, 2013 8:17 am Post subject: How to change a group of table entries with LUA |
|
|
Ok, I finished this last night using a different number technique but will change to your suggestion. Yes if you look at the previous bit of code, I only went through the loop a couple of times. Many thanks for your patience and understanding. Here is the final product for those searching for a similar bit of code, although it probably is not optimized.
I have done quite a bit of searching and locating byte information on HOMM3.
Each character has h462 bytes.
Orrin first hero (example h126D60F, probable start h126D5F0)
Tiva last hero (example h12802AD, probable start h128070F)
ms = createMemScan()
memscan_firstScan(ms, soExactValue, vtString, rtRounded, "Orrin", "", 0, 0xffffffffffffffff, "*X*C*W", fsmNotAligned, "", false, false, false, true);
memscan_waitTillDone(ms);
fl = createFoundList(ms);--List of text searches for 'Orrin'
foundlist_initialize(fl);
foundlist_getCount(fl);
for x = 0, foundlist_getCount(fl)-1 do--Items are in the hex format (0125D60F) without 0x
memrec1 = foundlist_getAddress(fl, x);
memrec2 = "0x" .. memrec1;
tivaaddress = memrec2 + 0x22c9e;--Items are in the number format of the hex summation
tivaaddress = string.format('%x', tivaaddress);--Items in number format converted to hex format without 0x
if readString(tivaaddress, 5) == "Tiva" then--Not sure why this line required a search for 5 characters, but searching for 4 resulted in 'Tiv'
memrec1 = "0x" .. memrec1;
--byteoffset = tonumber(memrec1);--Dark Byte final suggestion and would replace the following line
memrec1 = memrec1 + 0x000000;--Item is in the number format of the hex summation
byteoffset = memrec1;--byteoffset is in the number format (19256847)
end;
end;
addresslist = getAddressList();
memrec3 = addresslist_getMemoryRecordByDescription(addresslist, "Orrin");
orrinaddress = memoryrecord_getAddress(memrec3);--Item in number format
for x = 0, addresslist_getCount(addresslist)-1 do
memrec4 = addresslist_getMemoryRecordByID(addresslist, x);
if byteoffset ~= orrinaddress then
memoryrecord_setAddress(memrec4, memoryrecord_getAddress(memrec4) + byteoffset - orrinaddress);
end;
end;
My next project is to use an Array Of Bytes bit of code on another game, but if help needed would be in a different thread.
Edited to correct code math operations in the if statement
|
|
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
|
|