Posted: Tue Jan 03, 2023 12:23 pm Post subject: How to read offset in custom lua value?
I'm trying to read a value from an offset like this "recettear.exe+41109AA" using my custom lua value, but everything seems to throw a lua panic. What's the proper way to do this?
The game I'm attached to is "recettear.exe" and I have a value I can read from "recettear.exe+6F0B570", but I can't use "recettear.exe+6F0B570" in my code without it throwing an error:
The exact error I'm getting in the Lua Engine is "Error:[string "local syntaxcheck,memrec=......"]:7: attempt to index a nil value (global 'recettear')"
I can make it work if I manually find the proper address with the offset.
Code:
patience=readByte(0x045109AA + customer * 4)
But I want it to calculate the proper address with the offset itself. Is there a way I can find the address of "recettear.exe" so I can use it in that readByte function?
Here, `recettear` is treated as a global variable, and `.exe` is an index operation into a table. If you want it to be treated as a string and let CE parse it, enclose it in single or double quotes.
Doing arithmetic on the address requires you to parse it before passing it to readByte. Assuming `customer` is an integer, this should work:
(a single string or table argument used in a function call can omit the outside parenthesis)
If it still doesn't work, maybe you meant to treat `recettear.exe+0x6F0B570` as a pointer and not an array. Replace getAddress with readPointer _________________
I don't know where I'm going, but I'll figure it out when I get there.
I could've sworn I've tried that because that syntax looks familiar, but I must've gotten something mixed up in the game's memory from not restarting the game in between all my debugging.
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