View previous topic :: View next topic |
Author |
Message |
Kelso How do I cheat? Reputation: 0
Joined: 20 Mar 2022 Posts: 4
|
Posted: Sun Mar 20, 2022 6:50 pm Post subject: Reading/Writing Index breaks with readString |
|
|
I made a script to increment up a list of specific values in an array, when I use:
Code: | local Alloc = readString("TargetAddr") |
it doesn't work
When I use:
Code: | local Alloc = "7FF3D8981B30" |
it works
I initialize it like so:
Code: | alloc(TargetAddr,12)
registersymbol(TargetAddr) |
What I mean but "it does/doesn't work" I mean while it is incrementing up this array, the index number continues to count up like normal, but the spot in the array gets stuck on the 34th slot and doesn't change.
The script itself works perfectly how I intended it, but when using the readString method it stops working once that 34th slot is reached. Any suggestions?
|
|
Back to top |
|
|
YoucefHam Cheater Reputation: 5
Joined: 19 Mar 2015 Posts: 39 Location: Algeria
|
Posted: Sun Mar 20, 2022 8:51 pm Post subject: Re: Reading/Writing Index breaks with readString |
|
|
Kelso wrote: | I made a script to increment up a list of specific values in an array, when I use:
Code: | local Alloc = readString("TargetAddr") |
it doesn't work
When I use:
Code: | local Alloc = "7FF3D8981B30" |
it works
I initialize it like so:
Code: | alloc(TargetAddr,12)
registersymbol(TargetAddr) |
What I mean but "it does/doesn't work" I mean while it is incrementing up this array, the index number continues to count up like normal, but the spot in the array gets stuck on the 34th slot and doesn't change.
The script itself works perfectly how I intended it, but when using the readString method it stops working once that 34th slot is reached. Any suggestions? |
Hi, use getAddress("TargetAddr")
Code: | local Alloc = readString(getAddress("TargetAddr")) |
|
|
Back to top |
|
|
Kelso How do I cheat? Reputation: 0
Joined: 20 Mar 2022 Posts: 4
|
Posted: Sun Mar 20, 2022 9:46 pm Post subject: |
|
|
Ok I actually went ahead and used that but I guess I should have mentioned this other quirk:
Code: | local Alloc = readString("TargetAddr") |
Code: | local Alloc = readString(getAddress("TargetAddr")) |
Both of these actually work unless it's using that address, if I use another address like "2AEA88C0038" it magically starts working, and then setting the target address back to "7FF3D8981B30" breaks it again.
Note: Alloc = "7FF3D8981B30" works regardless of region, but if I use the readString function then the 7FF address stops working but the 2AE address will work like normal.
|
|
Back to top |
|
|
TheyCallMeTim13 Wiki Contributor Reputation: 50
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Sun Mar 20, 2022 10:19 pm Post subject: |
|
|
What are you setting "TargetAddr" with? If it's the default (all zeros). readString will return an empty string since it hits a null byte (zero) on the first byte.
_________________
|
|
Back to top |
|
|
Kelso How do I cheat? Reputation: 0
Joined: 20 Mar 2022 Posts: 4
|
Posted: Mon Mar 21, 2022 4:35 pm Post subject: |
|
|
TheyCallMeTim13 wrote: | What are you setting "TargetAddr" with? If it's the default (all zeros). readString will return an empty string since it hits a null byte (zero) on the first byte. |
I have it set up where TargetAddr is addressed in the table like shown in the attached image. The "7FF3D8981B30" address in this example is the one it writes to successfully until it reaches the 34th slot in the index.
If I use another address like "2AEA88C0038" as the target address in that header it will count past the 34th slot just fine and works normally endlessly, so something about the address or how readString works or how it's stored is causing an issue.
Description: |
|
Filesize: |
16.69 KB |
Viewed: |
1388 Time(s) |
|
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 138
Joined: 06 Jul 2014 Posts: 4275
|
Posted: Mon Mar 21, 2022 4:48 pm Post subject: |
|
|
You need to include a null byte if you're storing a string.
Code: | assert(autoAssemble[[
globalalloc(TargetAddr,13)
TargetAddr:
db '7FF3D8981B30',0
]])
assert(readString'TargetAddr' == '7FF3D8981B30') |
Or just store the address as an integer like you should be doing in most cases.
Code: | assert(autoAssemble[[
globalalloc(TargetAddr,8)
TargetAddr:
dq 7FF3D8981B30
]])
assert(readPointer'TargetAddr' == 0x7FF3D8981B30) |
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
Kelso How do I cheat? Reputation: 0
Joined: 20 Mar 2022 Posts: 4
|
Posted: Mon Mar 21, 2022 5:03 pm Post subject: |
|
|
Quote: | You need to include a null byte if you're storing a string. |
Ok, this was the issue, the script works normally now. Thank you, I wasn't aware this was necessary for it to work.
|
|
Back to top |
|
|
|