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 


Uhh... am i doing something wrong with the pause function?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
rog9001
Expert Cheater
Reputation: 2

Joined: 22 Dec 2015
Posts: 211
Location: Jupiter

PostPosted: Wed Apr 05, 2017 3:54 pm    Post subject: Uhh... am i doing something wrong with the pause function? Reply with quote

Code:

function CEButton1Click(sender)
if openProcess("WindowsEntryPoint.Windows.exe")then
CETrainer.CEPanel1.Caption="Starting"
autoAssemble([[
globalalloc(Headshots,4)
globalalloc(Kills,4)
globalalloc(Kill_Streak,4)
globalalloc(Drones_Disabled,4)
mov [Headshots],0
mov [Kills],0
mov [Kill_Streak],0
mov [Drones_Disabled],0
]])
local clock = os.clock
function sleep(n)
  n = 2
  local t0 = clock()
  while clock() - t0 <= n do end
end
CETrainer.CEButton1.Visible = false
CETrainer.CEPanel1.Visible = false
else
CETrainer.CEPanel1.Caption="Game Not Found"
end
end


for some reason the sleep function kicks in before the set caption and I think also the auto assemble. why is it doing that?

what is meant to happen is, after pressing the button it would set the caption to starting then allocate all the stuff and then only pause for 2 seconds but instead it does it from bottom to top, pause, alloc, caption. How do I fix this?
Back to top
View user's profile Send private message
ParkourPenguin
Grandmaster Cheater Supreme
Reputation: 46

Joined: 06 Jul 2014
Posts: 1661
Location: Arcadian Suburbia

PostPosted: Wed Apr 05, 2017 4:16 pm    Post subject: Reply with quote

Your call to autoAssemble fails because you have random instructions put in the middle of the script. I'm pretty sure you meant to do this:
Code:
globalalloc(Headshots,4)
globalalloc(Kills,4)
globalalloc(Kill_Streak,4)
globalalloc(Drones_Disabled,4)

Headshots:
  dd 0
Kills:
  dd 0
Kill_Streak:
  dd 0
Drones_Disabled:
  dd 0


You're not calling that sleep function: you're defining it. Also, CE already has a sleep function. I doubt you need the resolution a busy wait offers (if the resolution of os.clock is even good enough, which I also doubt).

You can call CE's sleep function like this:
Code:
sleep(2000)  -- sleep for 2000 ms (2 seconds)

_________________
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: 332

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

PostPosted: Wed Apr 05, 2017 4:23 pm    Post subject: Reply with quote

the function sleep never even gets called

anyhow, I think you should call CETrainer.CEPanel1.repaint() and CETrainer.repaint() inbetween pauses else the gui will only update after the function has returned

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


Last edited by Dark Byte on Wed Apr 05, 2017 4:24 pm; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
rog9001
Expert Cheater
Reputation: 2

Joined: 22 Dec 2015
Posts: 211
Location: Jupiter

PostPosted: Wed Apr 05, 2017 4:24 pm    Post subject: Reply with quote

ParkourPenguin wrote:
Your call to autoAssemble fails because you have random instructions put in the middle of the script. I'm pretty sure you meant to do this:
Code:
globalalloc(Headshots,4)
globalalloc(Kills,4)
globalalloc(Kill_Streak,4)
globalalloc(Drones_Disabled,4)

Headshots:
  dd 0
Kills:
  dd 0
Kill_Streak:
  dd 0
Drones_Disabled:
  dd 0


You're not calling that sleep function: you're defining it. Also, CE already has a sleep function. I doubt you need the resolution a busy wait offers (if the resolution of os.clock is even good enough, which I also doubt).

You can call CE's sleep function like this:
Code:
sleep(2000)  -- sleep for 2000 ms (2 seconds)


oh ok. I forgot that CE already had a sleep function. Thanks for the reply.
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