Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Using Loop Variable as Offset With Multilevel Pointers

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
pottan
How do I cheat?
Reputation: 0

Joined: 22 Nov 2011
Posts: 2

PostPosted: Wed Jan 11, 2012 10:12 am    Post subject: Using Loop Variable as Offset With Multilevel Pointers Reply with quote

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
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8517
Location: 127.0.0.1

PostPosted: Wed Jan 11, 2012 12:18 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
pottan
How do I cheat?
Reputation: 0

Joined: 22 Nov 2011
Posts: 2

PostPosted: Wed Jan 11, 2012 9:43 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites