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 


Looping a script. And reversing changes on disable.

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

Joined: 16 Sep 2016
Posts: 3

PostPosted: Wed Sep 16, 2020 4:04 pm    Post subject: Looping a script. And reversing changes on disable. Reply with quote

So basically I want to loop this script so that it constantly replaces bytes if found. At the moment it replaces them but only once, if new instances are created I have to re-enable the script. I tried adding a timer but I couldn't figure out how to loop it properly. Can anyone who is more versed in lua help?

Code:

{$lua}
if syntaxcheck then return end

[ENABLE]
resultList = AOBScan(" ")
if not resultList then error("Failed to find AOB") end
lngt = resultList.getCount()
bytes = {}

for x=0, lngt-1 do
   bytes[x] = readBytes(resultList[x], 10, true)
   writeBytes(resultList[x], 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)
end
[DISABLE]
for x=0, lngt-1, 1 do
  writeBytes(resultList[x], bytes[x])
end
resultList.Destroy()
Back to top
View user's profile Send private message
ProB1
Advanced Cheater
Reputation: 0

Joined: 20 Jul 2019
Posts: 77
Location: At Home

PostPosted: Wed Sep 23, 2020 10:05 pm    Post subject: Reply with quote

i did make like getAddressList().getMemoryRecordByDescription

but i think you can make like same loop


Code:

{$lua}
[ENABLE]
if syntaxCheck then return end
(lol) = createThread(function(Thread)
  while true do
    if Thread.Terminated then break end -- breaks loops and allows function to end
    sleep() -- interval



memrec = getAddressList().getMemoryRecordByDescription
memrec(" ").Value =
sleep(    )
memrec = getAddressList().getMemoryRecordByDescription
memrec(" ").Value =

  end
end)

[DISABLE]
(lol).terminate()

_________________
Hitler Hey im Back Smile
Discord: ProB1#0100
Back to top
View user's profile Send private message Visit poster's website
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Thu Sep 24, 2020 12:52 am    Post subject: Reply with quote

Why I am fell ever seen this same topic somewhere before?

Add flags (i.e: "+W*X-C"), example:

Code:
resultList = AOBScan("00 FF 00 FF", "+W*X-C")
if (resultList) then
   lngt = resultList.getCount()
   for x=0, lngt-1, 1 do
      writeBytes(resultList[x], 0x90, 0x90, 0x90, 0x90)
   end
   resultList.Destroy()
   resultList = nil
end

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
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