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 


while loop with pointer+counter

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

Joined: 21 Feb 2018
Posts: 2
Location: France

PostPosted: Wed Feb 21, 2018 2:53 pm    Post subject: while loop with pointer+counter Reply with quote

Hello,

I would like create a loop as this:

Code:

local i=0

while i<30 do
  writeBytes("[process.exe+836F88]+5C6F0+i",1)
  i=i+1
end


But I have an error: "Failure determining what [process.exe+836F88]+5C6F0+i means
'i' is problematic. Thanks for your help.


Last edited by Masa on Wed Feb 21, 2018 3:12 pm; edited 1 time in total
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Wed Feb 21, 2018 3:01 pm    Post subject: Reply with quote

Code:
local addr = getAddress('[game.exe+836F88]+5C6F0')
for i = 0, 29 do
  writeBytes(addr + i, 1)
end

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Wed Feb 21, 2018 3:04 pm    Post subject: Reply with quote

Code:

local i=0

while i<30 do
  writeBytes(string.format("[process.exe+836F88]+5C6F0+%d",i),1)
  i=i+1
end


or (faster):
Code:

local i
local buf={}
for i=1,30 do
  buf[i]=1
end
writeBytes("[process.exe+836F88]+5C6F0", buf)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Masa
How do I cheat?
Reputation: 0

Joined: 21 Feb 2018
Posts: 2
Location: France

PostPosted: Wed Feb 21, 2018 3:10 pm    Post subject: Reply with quote

It works, thank you very much.
Sorry for the inconvenience ...
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