Jump to content
  • 0

How to specify data type in script


HorridModz

Question

I have a script that checks nearby values in memory from a reference address (obtained from a reference value that is unchanging). This is because the hack I am scripting has a bunch of encrypted values stored near each other in memory. These values each represent whether or not you have a weapon in your inventory.

My script is able to search the unchanging reference value and get the value of each address below it, one by one. Here are some parts of my code:

This part initiates where to start.

startaddress = REFERENCEADDRESSHERE
distance = startaddress
direction = 1

This part moves a step.

distance = distance + direction
onaddress = startplace[1].address + offset

This part gets the value, address, flags, etc. of this address (the only way I know is to search for the address ... I wish there was a better way!

gg.clearResults()
gg.searchAddress(onaddress,0xFFFFFFFF) -- Idk how to get value from address other than searching address :(
onplace = gg.getResults(1) -- Only 1 result should come up since it is exact address

Now this code below is where my problem takes place.

onvalue = onplace.value -- Problem: IDK how to ensure it takes the the dword value only...

It gets the value, but IDK how to make it only get the dword value. What if there are multiple values and data types in this address?

 

Thanks a lot for reading!

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

6 hours ago, HorridModz said:

I have a script that checks nearby values in memory from a reference address (obtained from a reference value that is unchanging). This is because the hack I am scripting has a bunch of encrypted values stored near each other in memory. These values each represent whether or not you have a weapon in your inventory.

My script is able to search the unchanging reference value and get the value of each address below it, one by one. Here are some parts of my code:

This part initiates where to start.

startaddress = REFERENCEADDRESSHERE
distance = startaddress
direction = 1

This part moves a step.

distance = distance + direction
onaddress = startplace[1].address + offset

This part gets the value, address, flags, etc. of this address (the only way I know is to search for the address ... I wish there was a better way!

gg.clearResults()
gg.searchAddress(onaddress,0xFFFFFFFF) -- Idk how to get value from address other than searching address :(
onplace = gg.getResults(1) -- Only 1 result should come up since it is exact address

Now this code below is where my problem takes place.

onvalue = onplace.value -- Problem: IDK how to ensure it takes the the dword value only...

It gets the value, but IDK how to make it only get the dword value. What if there are multiple values and data types in this address?

 

Thanks a lot for reading!

gg.searchAddress(onaddress,0xFFFFFFFF,gg.TYPE_DWORD)

Link to comment
Share on other sites

3 hours ago, BadCase said:

gg.searchAddress(onaddress,0xFFFFFFFF,gg.TYPE_DWORD)

Yes, I knew you would come to the rescue! 😉 Thanks a lot. By the way, I discovered your il2cpp dump toolbox today - it's amazing and incredibly useful!

Link to comment
Share on other sites

@BadCaseI had to abandon this method because IDK how the address search works. I played around with mask and address, but never got the results I wanted - I think this is because the function expects the address seen in the memory editor (like 7FDC0C4CA650), while when I get address from gg.getResults() with .address returns a number like 1425261431.

Here are some examples I tried:

gg.searchAddress(1425261431,1425261431,gg.TYPE_DWORD)

gg.searchAddress(1425261431,0x1425261431,gg.TYPE_DWORD)

gg.searchAddress(0,1425261431,1425261431,gg.TYPE_DWORD)

gg.searchAddress(0~1000000000000000000,1425261431,gg.TYPE_DWORD)

gg.searchAddress(1425261431,0~1000000000000000000,gg.TYPE_DWORD)

gg.searchAddress(1425261431,0x,gg.TYPE_DWORD)

 

None of these work - adding 0x, changing the address value, changing the mask value. I believe this is because " the function expects the address seen in the memory editor (like 7FDC0C4CA650), while when I get address from gg.getResults() with .address returns a number like 1425261431".


I gave up on this and tried using code like this:

getplace = startplace
onaddress = startplace.address + offset
getplace.address = onaddress

gg.clearList()
gg.addListItems(getplace) 
value = gg.getListItems()[1].value

This code is supposed to change the address that is being looked at by the offset, which is 1, so the script can then get the next memory item into
"getplace". Then it is supposed to add the item to the saved list with gg.addListItems(getplace) and pull it back out with gg.getListItems()[1]. It then gets the value with .value. The logic behind this is that changing the address and adding to the saved list should make gg update the value and flags to the ones corresponding to the address (I have not tested this theory).

Remember, the goal is to get the value of the item below "startplace" in memory.

My next plan is a nearby search, but I think I am overthinking this. I think there are many easy ways to do what I want. and I just don't understand the mechanics. I've wasted about 5 hours with silly things like this. Do you know a method to do what I want to do? I am guessing there is an easy way to do this, but I can't find out how.

Link to comment
Share on other sites

On 6/6/2022 at 5:21 PM, HorridModz said:

@BadCaseI had to abandon this method because IDK how the address search works. I played around with mask and address, but never got the results I wanted - I think this is because the function expects the address seen in the memory editor (like 7FDC0C4CA650), while when I get address from gg.getResults() with .address returns a number like 1425261431.

Here are some examples I tried:

gg.searchAddress(1425261431,1425261431,gg.TYPE_DWORD)

gg.searchAddress(1425261431,0x1425261431,gg.TYPE_DWORD)

gg.searchAddress(0,1425261431,1425261431,gg.TYPE_DWORD)

gg.searchAddress(0~1000000000000000000,1425261431,gg.TYPE_DWORD)

gg.searchAddress(1425261431,0~1000000000000000000,gg.TYPE_DWORD)

gg.searchAddress(1425261431,0x,gg.TYPE_DWORD)

 

None of these work - adding 0x, changing the address value, changing the mask value. I believe this is because " the function expects the address seen in the memory editor (like 7FDC0C4CA650), while when I get address from gg.getResults() with .address returns a number like 1425261431".


I gave up on this and tried using code like this:

getplace = startplace
onaddress = startplace.address + offset
getplace.address = onaddress

gg.clearList()
gg.addListItems(getplace) 
value = gg.getListItems()[1].value

This code is supposed to change the address that is being looked at by the offset, which is 1, so the script can then get the next memory item into
"getplace". Then it is supposed to add the item to the saved list with gg.addListItems(getplace) and pull it back out with gg.getListItems()[1]. It then gets the value with .value. The logic behind this is that changing the address and adding to the saved list should make gg update the value and flags to the ones corresponding to the address (I have not tested this theory).

Remember, the goal is to get the value of the item below "startplace" in memory.

My next plan is a nearby search, but I think I am overthinking this. I think there are many easy ways to do what I want. and I just don't understand the mechanics. I've wasted about 5 hours with silly things like this. Do you know a method to do what I want to do? I am guessing there is an easy way to do this, but I can't find out how.

Do you have a static value that you search for to get your starting location?

Link to comment
Share on other sites

15 hours ago, BadCase said:

Do you have a static value that you search for to get your starting location?

@BadCase

Yes. My game stores whether or not you own a weapon in hashed dword values (and I edit them to 1 to unlock weapons). These values are stored in memory in order of when they were added. They are all close in memory, but there are other values in between each (with no concrete patterns). My script searches one hashed value, then finds the next valid hashed value by seeing if it is a dword greater than 10000000.

Manually, you search the first hashed value (which is known and unchanging) and goto that address, then use the order of weapons added to let you know how many hashed dword values to count above or below the value you want to get. You then count these many values going in direction up or down, only counting hashed values and ignoring non-valid values. 

The script does what you would do manually. You input the direction (up or down) and how many values to count. It then searches the first hashed value and records the address of it. The goal is to then use a while loop to move up or down 1 address in memory until it finds a valid hashed value and repeat that the specified number of times.

The problem I run into is moving up or down 1 address in memory and getting the value of this address (also making sure it gets the dword value specifically, as mentioned in the original post).

On 6/7/2022 at 2:53 AM, Rs92ks said:

You need to convert dec to hex for get 0xFF like address

Thanks bro! Would I just have to mode https://www.rapidtables.com/convert/number/decimal-to-hex.html into a lua algorithm?
So yes, the problem was not understanding the functions!

On 6/5/2022 at 6:20 PM, MAARS said:

simple way to get value from address
 

local address = 0xF458

local value = gg.getValues({{
  address = address,
  flags = gg.TYPE_DWORD,
}})

print (value)

 

get values. Another command I did not know! I think I should just read the whole scripting documentary like a novel lol.

On 6/7/2022 at 2:53 AM, Rs92ks said:

You need to convert dec to hex for get 0xFF like address

Thanks bro! Would I just have to mode https://www.rapidtables.com/convert/number/decimal-to-hex.html into a lua algorithm?
So yes, the problem was not understanding the functions!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.