View previous topic :: View next topic |
Author |
Message |
Frouk Master Cheater Reputation: 5
Joined: 22 Jun 2021 Posts: 489 Location: mov dword ptr [Ukraine]
|
Posted: Tue Jul 13, 2021 12:29 am Post subject: dec->hex as offset |
|
|
I can't use dec->hex as offset
In game decimal offset is stored in 0xBA6774
Code: | decOffset = readBytes(0xBA6774);
hexOffset = decOffset * 40;
print(string.format('%x%',hexOffset); --Prints hexadecimal value but can't be used in offset
|
I trying to make pointer with this in lua
|
|
Back to top |
|
|
atom0s Moderator Reputation: 199
Joined: 25 Jan 2006 Posts: 8518 Location: 127.0.0.1
|
Posted: Tue Jul 13, 2021 1:59 am Post subject: |
|
|
This isn't even valid Lua code to begin with. If you are going to ask for help, it's best to actually paste the working code you've tried than trying to piece together things without testing them and saying 'i tried this' when it's obvious you didn't.
If you want to format a decimal number as a hex format, you can do:
Code: |
local hexOffset = 12345;
local hexString = string.format('0x%X', hexOffset);
print(hexString);
|
You can remove the 0x at the start of the format as needed to keep the string in hex format but without the prefix.
_________________
- Retired. |
|
Back to top |
|
|
Frouk Master Cheater Reputation: 5
Joined: 22 Jun 2021 Posts: 489 Location: mov dword ptr [Ukraine]
|
Posted: Tue Jul 13, 2021 2:26 am Post subject: |
|
|
Code: | WPDec = readBytes(0xBA6774);
WPHex = WPDec * 40; |
I used this to make pointer to waypoint struct(0xBA6774 is used to get decimal offset to waypoint,then i multiply this value to get decimal value, and then converted it to hexadecimal)
Example: We have waypoint struct that allocated in 0xBA9000(this address is changing every time we restart the game),but we didn't have hexadecimal offset so then we reading bytes in 0xBA6774 and it gives us 44 then we multiply this to 40 and it gives 1760 in decimal then converting it we getting hexadecimal offset
In Cheat Engine Lua i use this:
Code: | wpptr = 0xBA86F0; --Base address for waypoint struct
waypoint = {
Color = ("wpptr + WPHex + 0");
XPos = ("wpptr + WPHex + 8");
YPos = ("wpptr + WPHex + C");
ZPos = ("wpptr + WPHex + 10");
Size = ("wpptr + WPHex + 14");
}
|
|
|
Back to top |
|
|
|