Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Searching for AOB and recalulating a saved table
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 577

PostPosted: Tue Jan 01, 2013 3:46 pm    Post subject: Searching for AOB and recalulating a saved table Reply with quote

ms = createMemScan()
--Need to search for Array Of Bytes
--Barret and Tifa exists from beginning of game
--AOB for Barrett is 22 41 52 52 45 54 FF FF FF before character named, after naming 22 41 52 52 45 54 FF FF
--AOB for Tifa is 34 49 46 41 FF FF FF FF FF before character named, after naming 34 49 46 41 FF FF
memscan_firstScan(ms, soExactValue, vtByteArray, rtRounded, "22 41 52 52 45 54 FF FF", "", 0x01000000, 0x7fffffff, "*X*C*W", fsmNotAligned, "", true, false, false, false);
memscan_waitTillDone(ms);
fl = createFoundList(ms);
foundlist_initialize(fl);
foundlist_getCount(fl);
print("num of search hits", foundlist_getCount(fl));--Output 2, correct
for x = 0, foundlist_getCount(fl)-1 do--Items are in the hex format (0125D60F) without 0x
memrec1 = foundlist_getAddress(fl, x);
--print("memrec1 from foundlist_getAddress(fl, x)", memrec1);
memrec2 = "0x" .. memrec1;
print("memrec1 concatenated with '0x'", memrec2);-- Output 0x1DAC7EC, 0x01EF72C4, correct
tifaaddress = memrec2 + 0x84;--Items are in the number format of the hex summation
--print("Search record number", x, " test Tifa address", tifaaddress);
tifaaddress = string.format('%x', tifaaddress);--Items in number format converted to hex format without 0x
tifaaddress = "0x" .. tifaaddress;
print("Tifa test address as hex format", tifaaddress);--);-- Output 0x1dac870, 0x01ef72c4, correct
print(readBytes(tifaaddress, 6));--ReadBytes(address, bytecount) returns an array of integers--Output 52 73 70 65 255 255, correct for both
--bytestring = readBytes(tifaaddress, 6);--Attempted these two lines output 52, when true used after 6 resulted in blank output
--print("bytestring", bytestring);
if readBytes(tifaaddress, 6) == "52, 73, 70, 65, 255, 255" then--"52 73 70 65 255 255" is the integer representation of "34 49 46 41 FF FF"
byteoffset = tonumber(memrec2);--Original format n = tonumber("0x" .. s);
print("Correct '22 41 52 52 45 54 FF FF' to recalculate table", byteoffset);--Output blank, so IF statement is never true
end;
end;
1. During the process I found two different ways to use readBytes one without a t/f after the bytecount and one with a t/f. What is the difference and uses?
2. Correct syntax for searching for AOB?
Back to top
View user's profile Send private message Yahoo Messenger
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25295
Location: The netherlands

PostPosted: Tue Jan 01, 2013 3:52 pm    Post subject: Reply with quote

The one without a true returns the bytes as different results

e.g:
Code:

b1, b2, b3,b4,b5=readBytes(0x00400500, 5)
print(b1)
print(b2)
print(b3)
print(b4)
print(b5)


The one with true returns the bytes inside a table (see it like an array)
Code:

x=readBytes(0x00400500, 5, true)
print(x[1])
print(x[2])
print(x[3])
print(x[4])
print(x[5])

It's recommended to use the second method

the aobscan seems ok, but not sure about the 0x01000000 part

_________________
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
View user's profile Send private message MSN Messenger
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 577

PostPosted: Tue Jan 01, 2013 6:04 pm    Post subject: Reply with quote

Ah that's why it only printed one result. The 0x01000000 just eliminates informational addresses used by the game (Final Fantasy VII).
I guess I wasn't clear in the second question, once I have the two addresses what is the correct syntax to search another location for a set of bytes?
if readBytes(tifaaddress, 6) == "52, 73, 70, 65, 255, 255" then
since the print(readBytes(tifaaddress, 6)) resulted in 52 73 70 65 255 255
I did try to compare "52 73 70 65 255 255", and that didn't work either.

Would it be better to have two memscans and then compare the resulting foundlist?

Edit: I believe that the game vaiables start at 0x01000000
Back to top
View user's profile Send private message Yahoo Messenger
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Wed Jan 02, 2013 4:21 am    Post subject: Reply with quote

Code:
if table.concat(readBytes(tifaaddress,6,true),', ') == "52, 73, 70, 65, 255, 255" then
  (...)
else
  (...)
end

_________________
Back to top
View user's profile Send private message MSN Messenger
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 577

PostPosted: Wed Jan 02, 2013 4:00 pm    Post subject: Reply with quote

ms = createMemScan()
--Need to search for Array Of Bytes
--Barret and Tifa exists from beginning of game
--AOB for Barrett is 22 41 52 52 45 54 FF FF FF before character named, after naming 22 41 52 52 45 54 FF FF
--AOB for Tifa is 34 49 46 41 FF FF FF FF FF before character named, after naming 34 49 46 41 FF FF
memscan_firstScan(ms, soExactValue, vtByteArray, rtRounded, "22 41 52 52 45 54 FF FF", "", 0x01000000, 0x7fffffff, "*X*C*W", fsmNotAligned, "", true, false, false, false);
memscan_waitTillDone(ms);
fl = createFoundList(ms);
foundlist_initialize(fl);
foundlist_getCount(fl);--Found 9 occurreneces
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;
print("Barret found concatenated with '0x'", memrec2);--Found 9 addresses identical to a normal search in CE
tifaaddress = memrec2 + 0x84;--Items are in the number format of the hex summation
tifaaddress = string.format('%x', tifaaddress);--Items in number format converted to hex format without 0x
tifaaddress = "0x" .. tifaaddress;);--Found 9 addresses identical to a normal search in CE
print(table.concat(readBytes(tifaaddress,6,true),', '));--Output 73, 70, 65, 255, 255 for all 9 occurrences so IF statement never true
if table.concat(readBytes(tifaaddress,6,true),', ') == "52, 73, 70, 65, 255, 255" then
byteoffset = tonumber(memrec2);--Original format n = tonumber("0x" .. s);
print("memrec2 from table", byteoffset);
--print("Correct '22 41 52 52 45 54 FF FF' to recalculate table", byteoffset);
end;
end;
--The remainder of code will be tried after part 1 is correct
--addresslist = getAddressList();
--memrec3 = addresslist_getMemoryRecordByDescription(addresslist, "Orrin");
--orrinaddress = memoryrecord_getAddress(memrec3);--Item in num 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);
--elseif byteoffset < orrinaddress then
--memoryrecord_setAddress(memrec4, memoryrecord_getAddress(memrec4) - byteoffset + orrinaddress);
--else
--end;
--end;

Thanks for the tip, but only outputs the last 5 of the 6 bytes, not sure why

EDIT: Changed
print(table.concat(readBytes(tifaaddress,6,true),', '0,5));--Output 52, 73, 70, 65, 255, 255 for all 9 occurrences
if table.concat(readBytes(tifaaddress,6,true),', '0,5) == "52, 73, 70, 65, 255, 255" then
byteoffset = tonumber(memrec2 + 0x84);--Original format n = tonumber("0x" .. s);--Change this line as it was incorrect by 0x84
print("memrec2 from table", byteoffset);Output 9 correct Tifas addresses

On two second half of code.
Back to top
View user's profile Send private message Yahoo Messenger
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 577

PostPosted: Thu Jan 03, 2013 12:11 pm    Post subject: Reply with quote

byteoffset from previous section of code = 116290112
Code:

addresslist = getAddressList();
memrec3 = addresslist_getMemoryRecordByDescription(addresslist, "Barret Name  (+hF) (22 41 52 52 45 54 FF FF)");
print("Barret from table", memrec3);

Output is 6ee7240, the last of 8 addresses found in this session
Code:

barretaddress = memoryrecord_getAddress(memrec3);--Item in num format

Output is 11493788 for both steps
Code:

for x = 0, 1 do--addresslist_getCount(addresslist)-1 do
memrec4 = addresslist_getMemoryRecordByID(addresslist, x);
print(memrec4);

Output for the two steps 00000000 and 0761FB50.
Are the entries for the table sorted ascending?
Why would the first entry in the table be 00000000?

Code:

if byteoffset > barretaddress then
memoryrecord_setAddress(memrec4, memoryrecord_getAddress(memrec4) + byteoffset - barretaddress);

Error message attempting to perform arithmetic on nil value.
Since both byteoffset and barretaddress are not nil, then the first part of the statement is causing the error.
Why would previous line not get an address in both steps?

Code:

elseif byteoffset < orrinaddress then
memoryrecord_setAddress(memrec4, memoryrecord_getAddress(memrec4) - byteoffset + barretaddress);
else
end;
end;
Back to top
View user's profile Send private message Yahoo Messenger
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 577

PostPosted: Wed Jan 09, 2013 11:57 pm    Post subject: Reply with quote

Well I did finally get the code to run, but MANY questions arise.
Code:

ms = createMemScan()
--Need to search for Array Of Bytes
--Barret and Tifa exists from beginning of game
--AOB for Barrett is 22 41 52 52 45 54 FF FF FF before character named, after naming 22 41 52 52 45 54 FF FF
--AOB for Tifa is    34 49 46 41 FF FF FF FF FF before character named, after naming 34 49 46 41 FF FF
--The key to recalculating should be 0xAD8 from Barret's name, location for menu options
memscan_firstScan(ms, soExactValue, vtByteArray, rtRounded, "22 41 52 52 45 54 FF FF", "", 0x00000000, 0x7fffffff, "*X*C*W", fsmNotAligned, "", true, false, false, false);
memscan_waitTillDone(ms);
fl = createFoundList(ms);
foundlist_initialize(fl);
foundlist_getCount(fl);
print("num of search hits", 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);
print("memrec1 from foundlist_getAddress(fl, x)", memrec1);
memrec2 = "0x" .. memrec1;
--print("Barret found", memrec2);
menuoptions = memrec2 + 0xAD8;--Items are in the number format of the hex summation
--print("Search record number", x, " test menu options", menuoptions);
menuoptions = string.format('%x', menuoptions);--Items in number format converted to hex format without 0x
menuoptions = "0x" .. menuoptions;
--print("Menu options test address as hex format", menuoptions);
--print(readBytes(menuoptions, 6));--ReadBytes(address, bytecount) returns an array of integers
--bytestring = readBytes(menuoptions, 6, true);
--for x = 0, 5 do
--print("menu options", bytestring[x]);
--end;
--if readBytes(tifaaddress, 6) == "52, 73, 70, 65, 255, 255" then--"52 73 70 65 255 255" is the integer representation of "34 49 46 41 FF FF"
--memrec1 = "0x" .. memrec1;
--print(table.concat(readBytes(menuoptions,1,true),', ',0));--returns an array of integers
print("read byte ", table.concat(readBytes(menuoptions,1,true),', ',0));
if table.concat(readBytes(menuoptions,1,true),', ',0) ~= "00" then
--byteoffset = tonumber(memrec2);--Original format n = tonumber("0x" .. s);
memrec2 = memrec2 + 0x000000--Items are in the number format of the hex summation
byteoffset = memrec2;
--print("Barret address from memory", byteoffset);
--print("Correct '22 41 52 52 45 54 FF FF' to recalculate table", byteoffset);
--memrec1 = memrec1 + 0x000000;--Items are in the number format of the hex summation
--byteoffset = memrec1;--byteoffset is in the number format (19256847)
end;
end;
print("Byteoffset to correct table entries", byteoffset);
addresslist = getAddressList();
memrec3 = addresslist_getMemoryRecordByDescription(addresslist, "Barret Name  (+hF) (22 41 52 52 45 54 FF FF)");
print("Barret from table", memrec3);
barretaddress = memoryrecord_getAddress(memrec3);--Item in num format
print("Barret address from memoryrecord_getAddress(memrec3)", barretaddress);
for x = 1, 2 do--addresslist_getCount(addresslist)-1 do
memrec4 = addresslist_getMemoryRecordByID(addresslist, x);
print("Table item num ",x, memrec4);
if byteoffset > barretaddress then
memoryrecord_setAddress(memrec4, memoryrecord_getAddress(memrec4) + byteoffset - barretaddress);
elseif byteoffset < barretaddress then
memoryrecord_setAddress(memrec4, memoryrecord_getAddress(memrec4) - byteoffset + barretaddress);
else
end;
end;

The print out put was
num of search hits 8 --All 8 addresses were identical to the normal CET scan
memrec1 from foundlist_getAddress(fl, x) 02937058
read byte 255
memrec1 from foundlist_getAddress(fl, x) 02939058
read byte 251
memrec1 from foundlist_getAddress(fl, x) 0293B058
read byte 255
memrec1 from foundlist_getAddress(fl, x) 0293D058
read byte 255
memrec1 from foundlist_getAddress(fl, x) 0293F058
read byte 255
memrec1 from foundlist_getAddress(fl, x) 02941058
read byte 255
memrec1 from foundlist_getAddress(fl, x) 067CC7EC
read byte 255
memrec1 from foundlist_getAddress(fl, x) 06917240
read byte 255
Byteoffset to correct table entries 110195264
Barret from table 09F10A70
Barret address from memoryrecord_getAddress(memrec3) 108840940
Table item num 1 074D6F40
Table item num 2 074D7060

Now the code needs to be changed as my initial "fix point" proved to be inaccurate.
But what puzzles me are a number of issues:
1. Line 49 for x = 1, 2 do when I did the code for HOMM3 I used 0, num table entries-1, but this did not work in this case as all it produced was a set of zeros and a subsequent error. Why the difference?
2. Table entry 17 and 18 (highlighted) were adjusted, so why these two instead of the first two items in the table?
3. The search record highlighted is the correct on, but the next entry is identical byte for byte to the previous set of 0x4A4 bytes (9 heroes all 0x84) The only difference is the items and materia which as far as I can tell are only in one place, making the address highlighted as correct. Why have two sets of identical information in the emulator?



CETBeforeLUA.png
 Description:
 Filesize:  54.73 KB
 Viewed:  14848 Time(s)

CETBeforeLUA.png



CETAfterLUA.png
 Description:
 Filesize:  54.61 KB
 Viewed:  14848 Time(s)

CETAfterLUA.png


Back to top
View user's profile Send private message Yahoo Messenger
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25295
Location: The netherlands

PostPosted: Thu Jan 10, 2013 5:40 am    Post subject: Reply with quote

1:
Lua tables start their index at 1
C/Pascal arrays start their index at 0, and the element indexer is a C/Pascal object.
Mostly ce lua uses pascal/c arrays, but in a few rare cases like the memoryrecord_getAddress it returns a lua table

2:
You use addresslist_getMemoryRecordByID() instead of addresslist_getMemoryRecord()
Each cheat entry has an unique ID that never changes no matter where you drag it to or what addresses you put in front
If you use addresslist_getMemoryRecord() you get the index in the list (counted from 0)

3: Depends on the game and emulator. Perhaps it's used as an default initializer, or one is used by the emulator internally and the other is used by the game where when the game wishes to read the address it gives the other one instead (speed improvement)

_________________
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
View user's profile Send private message MSN Messenger
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 577

PostPosted: Thu Jan 10, 2013 12:08 pm    Post subject: Reply with quote

1. Ok
2. Ok, I did not understand the implication of each instruction.
3. Ok
Final code for Final Fantasy VII using the emulator psxfin.exe, as it executes properly at least twice, works after Barret is "named" during the initial sequence of the game not before AND Barret must not be re-named.
Onto next game, thanks for the help.
Code:
ms = createMemScan()
--Need to search for Array Of Bytes
--Barret and Tifa exists from beginning of game
--AOB for Barrett is 22 41 52 52 45 54 FF FF FF before character named, after naming 22 41 52 52 45 54 FF FF
--AOB for Tifa is    34 49 46 41 FF FF FF FF FF before character named, after naming 34 49 46 41 FF FF
--The key to recalculating should be 0x14AA54 from Barret's name, location of second Barret address from memory
memscan_firstScan(ms, soExactValue, vtByteArray, rtRounded, "22 41 52 52 45 54 FF FF", "", 0x00000000, 0x7fffffff, "*X*C*W", fsmNotAligned, "", true, false, false, false);
memscan_waitTillDone(ms);
fl = createFoundList(ms);
foundlist_initialize(fl);
foundlist_getCount(fl);
print("num of search hits", 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);
print("memrec1 from foundlist_getAddress(fl, x)", memrec1);
memrec2 = "0x" .. memrec1;
secondbarretaddress = memrec2 + 0x14AA54;--Items are in the number format of the hex summation
print("Search record number", x, " test menu options", secondbarretaddress);
secondbarretaddress = string.format('%x', secondbarretaddress);--Items in number format converted to hex format without 0x
--print(table.concat(readBytes(secondbarretaddress,8,true),', ',0));--returns an array of integers
if table.concat(readBytes(secondbarretaddress,8,true),', ',0) == "34, 65, 82, 82, 69, 84, 255, 255" then--table.concat(table, sep, start, length) Zero based
memrec2 = memrec2 + 0x000000--Items are in the number format of the hex summation
byteoffset = memrec2;--byteoffset is in the number format (105039852)
--print("Barret address from memory", byteoffset);
print("Correct '22 41 52 52 45 54 FF FF' to recalculate table", byteoffset);
end;
end;
--print("Byteoffset to correct table entries", byteoffset);
addresslist = getAddressList();
memrec3 = addresslist_getMemoryRecordByDescription(addresslist, "Barret Name  (+hF) (22 41 52 52 45 54 FF FF)");
--print("Barret from table", memrec3);
barretaddress = memoryrecord_getAddress(memrec3);--Item in num format
--print("Barret table address from memoryrecord_getAddress(memrec3)", barretaddress);
for x = 0, addresslist_getCount(addresslist)-1 do--addresslist_getCount(addresslist)-1 do
--memrec4 = addresslist_getMemoryRecordByID(addresslist, x);
memrec4 = addresslist_getMemoryRecord(addresslist, x);
if byteoffset > barretaddress then
memoryrecord_setAddress(memrec4, memoryrecord_getAddress(memrec4) + byteoffset - barretaddress);
elseif byteoffset < barretaddress then
memoryrecord_setAddress(memrec4, memoryrecord_getAddress(memrec4) + byteoffset - barretaddress);
else
end;
end;


Edited to correct code, which logically could be reduced by three lines in the last if statement
Back to top
View user's profile Send private message Yahoo Messenger
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 577

PostPosted: Fri Jan 11, 2013 11:17 pm    Post subject: Reply with quote

The above code worked using one lap, but didn't work using another.
The error was pointing to a memory block that obviously doesn't exist in the second lap. So I need an error trapping routine to continue the program if it finds an error.

This is the line that failed:
if table.concat(readBytes(secondbarretaddress,8,true),', ',0) == "34, 65, 82, 82, 69, 84, 255, 255" then
In this case the loop fails on the third of 7 finds. The error reports bad argument #1 to 'concat' (table expected, got nil)

I looked in the code list and found errorOnLookupFailure(state):If set to true (default) address lokups in string form will raise an error if it can not be looked up...(Useful for pointers that don't work 100% of the time).
Since that command only exists in 6.2, I installed it, pulled up a previous code that worked with 6.1 and got an errror with the line listed above. Changed it to read from 1 instead of 0 and the code performed, BUT the addresses were changed incorrectly.
This instance the name correct location is 0x67BC7EC which is
108775404, the table address was 0x64BC7EC which is 105629676.
The address correction should be current address +108775404(correct location) - 105629676(current table address) that should inrease all the addresses by 3145728 (0x300000) which is what the desired results should be, and was with ver 6.1. With 6.2 the addresses looked like this:
108614448, 108614452 etc. Very confusing until I applied a calculator and the numbers become the equivalent to the associated hex addresses.

It appears to me that the procedure, memoryrecord_setAddress(memrec4, memoryrecord_getAddress(memrec4) + byteoffset - barretaddress) now treats these as hex addresses, whereas 6.1 treated them as number addresses. IF this is correct then all my coding built with 6.1 is incorrect with 6.2. This does seem to be inconsistent.
Back to top
View user's profile Send private message Yahoo Messenger
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 577

PostPosted: Sat Jan 12, 2013 9:30 am    Post subject: Reply with quote

Attempting to fix the code but getting incorrect address recalculations
Code:

....
print("Byteoffset to correct table entries", byteoffset);

Ouput of byteoffset is 0x67AC7EC which is the correct address
Code:

addresslist = getAddressList();
memrec3 = addresslist_getMemoryRecordByDescription(addresslist, "Barret Name  (+hF) (22 41 52 52 45 54 FF FF)");
print("Barret from table hex notation", memrec3);

Output of memrec3 is 0641D8C0 and I have no way to know if this is correct
Code:

barretaddress = memoryrecord_getAddress(memrec3);--Item in num format
print("Barret table address from memoryrecord_getAddress(memrec3) num format", barretaddress);
barretaddress = string.format('%x', barretaddress);--Items in number format converted to hex format without 0x
barretaddress = "0x" .. barretaddress
print("Barret table address from memoryrecord_getAddress(memrec3) hex format", barretaddress);

Ouputs of the two print statements are 105629676 and 0x64bc7ec which are both correct
Code:

for x = 0, 1 do--addresslist_getCount(addresslist)-1 do--addresslist_getCount(addresslist)-1 do
memrec4 = addresslist_getMemoryRecord(addresslist, x);--Items are in hex format without 0x
--testmemrec4 = memrec4 + byteoffset - barretaddress
print("Address of table record", memrec4);

Output of the two loops 0633700 and 06337D80
Code:

--print("Address correction", memoryrecord_setAddress(memrec4, memoryrecord_getAddress(memrec4) + byteoffset - barretaddress));
if byteoffset ~= barretaddress then
print(byteoffset-barretaddress);

Output is 3080192 which is correct (0x067AC7EC - 0x064BC7EC)
Code:

memoryrecord_setAddress(memrec4, memoryrecord_getAddress(memrec4) + byteoffset - barretaddress);
end;
end;

Addresses where changed respectively from
06405330 to 107959088 but should have been 06785330
06405334 to 107959092 but should have been 06785334
What am I doing wrong now?

Second question, I added function RecalculateAddresses() and an end; at the end of the code. When the execute script button was selected, nothing happened. Why did nothing happen?
Back to top
View user's profile Send private message Yahoo Messenger
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25295
Location: The netherlands

PostPosted: Sat Jan 12, 2013 10:01 am    Post subject: Reply with quote

It's a bug in 6.2 where it detects that the input can be parsed as a string, and thus handles it as a string input (problem with lua_isstring() is that it returns true for integers)

you need to convert the new address to a cheat engine interpretable address

So, instead of
Code:

memoryrecord_setAddress(memrec4, memoryrecord_getAddress(memrec4) + byteoffset - barretaddress);


do:
Code:


memoryrecord_setAddress(memrec4, string.format("%x", memoryrecord_getAddress(memrec4) + byteoffset - barretaddress));

_________________
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
View user's profile Send private message MSN Messenger
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 577

PostPosted: Sat Jan 12, 2013 12:05 pm    Post subject: Reply with quote

Great that worked almost 100%, as first two addresses are incorrect, but that may have been my tinkering during the debug.

1. What does errorOnLookupFailure(false) do exactly? Just continue with next statement?
2. Did you see the question of adding the function statement? As this will lead to a form used to perform some other tasks including the recalculation of addresses.
Back to top
View user's profile Send private message Yahoo Messenger
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25295
Location: The netherlands

PostPosted: Sat Jan 12, 2013 12:12 pm    Post subject: Reply with quote

1: Instead of giving an error and stopping the script it makes it return nil (check for that manually)

2: Did the execute button have the functionname in it's "onclick" event tab ?

_________________
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
View user's profile Send private message MSN Messenger
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 577

PostPosted: Sat Jan 12, 2013 12:40 pm    Post subject: Reply with quote

No the form hasn't been tried yet with 6.2. The function was put into the Lua script: Cheat Table.
I was tinkering with one form on 6.1, but now that has been negated. Two projects for the form would be:
1. One button to recalculate the addresses that will use the function RecalculateAddresses()

2. One button to change the value of a block of addresses, but I could not get the code right as I couldn't get writeInterger(address, value), writeIntergerLocal(address, value) or doValueChange(addresslist).

The task intended is:

Table Item 1
Table Item 2
...
Table Item n--Change these values to ff. Don't know how to find n address for a for loop as m is a known value
Table Items n+m
...
Table Item last

Edited: What I meant to say, I can find that n record by the table description as done previously, but I don't know how to access the nth table record and then write vaues to the mth record.
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites