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 


lua tutoriail script

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

Joined: 05 Mar 2024
Posts: 8

PostPosted: Sun May 19, 2024 7:00 am    Post subject: lua tutoriail script Reply with quote

Hello! everyone can anyone guide me how can i make this scripte a infinte loop cause when ever i try it! works only once Sad

{$lua}
[ENABLE]
local hlt = ('["Tutorial-x86_64.exe"+00325AA0]+818')
if readFloat(hlt) <= 5000 then writeFloat(hlt,5000)
end
[DISABLE]
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 143

Joined: 06 Jul 2014
Posts: 4382

PostPosted: Sun May 19, 2024 9:24 am    Post subject: Reply with quote

Code:
{$lua}
if syntaxcheck then return end

if not uniqueTimerName then
  uniqueTimerName = createTimer()
end

[ENABLE]

uniqueTimerName.OnTimer = function(t)
  local hlt = getAddressSafe'["Tutorial-x86_64.exe"+00325AA0]+818'
  if not hlt then
    t.Enabled = false
    error'Bad pointer'
  end

  if readFloat(hlt) < 5000 then
    writeFloat(hlt, 5000)
  end
end

uniqueTimerName.Enabled = true

[DISABLE]
uniqueTimerName.Enabled = false

_________________
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
beatzzz23
How do I cheat?
Reputation: 0

Joined: 05 Mar 2024
Posts: 8

PostPosted: Thu May 23, 2024 9:14 am    Post subject: Reply with quote

local h = ('["Tutorial-x86_64.exe"+00325AA0]+818')
local b = ('["Tutorial-x86_64.exe"+00325AA0]+820')
if readFloat(h) <= 5000 then writeFloat(h,5000) end
if readDouble(b) <= 5000 then writeDouble(b,5000) end
if readFloat(h) == 5000 then
repeat
writeFloat(h,5000)
until isKeyPressed(VK_7)

if readDouble(b) == 5000 then
repeat
writeFloat(h,5000)
until isKeyPressed(VK_7)
end
end


Can anyone tell what i did wrong in this couse when ever i try to enable the script CE stops responding
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 460

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

PostPosted: Thu May 23, 2024 10:53 am    Post subject: Reply with quote

This code runs in the main thread.
Window messages get handled when the function exits, which it never does.

you can either run the code in a different thread using
Code:

createThread(function()
..your
code...
end)


or call processMessages() in your loop

_________________
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
beatzzz23
How do I cheat?
Reputation: 0

Joined: 05 Mar 2024
Posts: 8

PostPosted: Fri May 24, 2024 3:13 am    Post subject: Reply with quote

-- Can anyone tell what's wrong here cause the code works for hlt & not for bullets when i press the (VK_8) it dose not break and keeps running? some times it dosen't work for bullets & keeps going down Confused
local h = ('["Tutorial-x86_64.exe"+00325AA0]+818')
local b = ('["Tutorial-x86_64.exe"+00325AA0]+820')

createThread(function()

if readFloat(h) <= 5000 then writeFloat(h,5000)
if readDouble(b) <= 5000 then writeDouble(b,5000)

while readFloat(h) == 5000 do
repeat
writeFloat(h,5000)
until isKeyPressed(VK_7)
break


while readDouble((b) == 5000) do
repeat
writeDouble(b,5000)
until isKeyPressed(VK_8)
break
end
end
end
end
end
)
Back to top
View user's profile Send private message
beatzzz23
How do I cheat?
Reputation: 0

Joined: 05 Mar 2024
Posts: 8

PostPosted: Sat Jun 01, 2024 1:10 pm    Post subject: Reply with quote

Dark Byte wrote:
This code runs in the main thread.
Window messages get handled when the function exits, which it never does.

you can either run the code in a different thread using
Code:

createThread(function()
..your
code...
end)


or call processMessages() in your loop


Can you please tell how to use this processMessages() in your loop
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