View previous topic :: View next topic |
Author |
Message |
pottan How do I cheat? Reputation: 0
Joined: 22 Nov 2011 Posts: 2
|
Posted: Wed Jan 11, 2012 10:12 am Post subject: Using Loop Variable as Offset With Multilevel Pointers |
|
|
Hi,
I need to write a specific value to memory addresses pointed by
[["ABC.exe"+ ]+730]+100
[["ABC.exe"+ ]+732]+100
[["ABC.exe"+ ]+734]+100
..................................................
[["ABC.exe"+ ]+750]+100
i.e. where the base address and Offset 1 remains constant but Offset 0 varies from 730 to 750 in steps of 2.
I tried to use this code, but it didn't work
Code: | for i=1,11 do
pValue = '[["ABC.exe"+ ]+730+(i-1)*2]+100'
writeInteger(pValue,20)
end |
I am new to LUA. I searched the web but I didn't find much information regarding the usage multilevel pointers in LUA. Can somebody help me?
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8517 Location: 127.0.0.1
|
Posted: Wed Jan 11, 2012 12:18 pm Post subject: |
|
|
Not really sure what you mean with:
[["ABC.exe"+ ]+730]+100
Since you have a + with no right-side value. This would be an error.
Perhaps you meant this?
[["ABC.exe"+730]+100
If so you could do:
Code: |
for i = 1, 11 do
writeInteger( string.format( "[ABC.exe+%x]+100", ( 0x730 + ( ( i - 1 )* 2 ) ) ) ), 20 );
end
|
_________________
- Retired. |
|
Back to top |
|
|
pottan How do I cheat? Reputation: 0
Joined: 22 Nov 2011 Posts: 2
|
Posted: Wed Jan 11, 2012 9:43 pm Post subject: |
|
|
Wiccaan wrote: | Not really sure what you mean with:
[["ABC.exe"+ ]+730]+100
Since you have a + with no right-side value. This would be an error.
Perhaps you meant this?
[["ABC.exe"+730]+100
If so you could do:
Code: |
for i = 1, 11 do
writeInteger( string.format( "[ABC.exe+%x]+100", ( 0x730 + ( ( i - 1 )* 2 ) ) ) ), 20 );
end
|
|
I'm sorry but there was a number on the right side of +. It somehow disappeared when I submitted the post! I can still see it when I click on 'Edit Post'.
But the string.format actually worked. Thank you very much.
|
|
Back to top |
|
|
|