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 


I need help with isKeyPressed And CE not respond

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

Joined: 18 Aug 2020
Posts: 4

PostPosted: Tue Aug 18, 2020 1:08 am    Post subject: I need help with isKeyPressed And CE not respond Reply with quote

Im new at scripting and Im trying to make a script like this

if(isKeyPressed(VK_F)) then
print("hi")
end
but it seem not working can u guys show me where Im wrong in this script ?

and btw when I excecute this
while true do
print("hi")
end
it loops for about 5 time and my Ce not respond anymore. How do I fix this?

Sorry for my bad english ;-;

My discord Cater#4959
Back to top
View user's profile Send private message Send e-mail
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Tue Aug 18, 2020 4:31 am    Post subject: Reply with quote

Code:
function checkKeys()
 if (isKeyPressed(VK_F)) then
   print('Hi')
 end
end

t=createTimer()
t.Interval = 50
t.OnTimer = checkKeys
t.Enabled = true


And for infinite loop using while …do:

Code:
while( true )
do
   print("This loop will run forever.")
end


The second script will not stop until stacks overflow.

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
CaterBois
How do I cheat?
Reputation: 0

Joined: 18 Aug 2020
Posts: 4

PostPosted: Tue Aug 18, 2020 10:23 pm    Post subject: Reply with quote

thanks for your information
I tried to make a on off script like this

local stop = 0

while stop == 0 do
print('hi')
sleep (2000)
function checkKeys()
if (isKeyPressed(VK_F)) then
stop = 1
end
end
end

t=createTimer()
t.Interval = 50
t.OnTimer = checkKeys
t.Enabled = true


is this script correct ? and my CE always not respond after I execute this script
Back to top
View user's profile Send private message Send e-mail
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Wed Aug 19, 2020 12:25 am    Post subject: Reply with quote

Code:
if syntaxcheck then return end
if t then t.destroy(); t = nil end
local stop = 0

t = createTimer()
t.Interval = 100
t.OnTimer = function(t)
  if stop then
    print('hi')
    sleep(1000)
   
    if isKeyPressed(VK_F) then
      stop = 1
    else
       stop = 0
    end
  end
end

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Wed Aug 19, 2020 2:10 am    Post subject: Reply with quote

might want to use true/false instead of 0/1 because 0 is true in lua
_________________
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
CaterBois
How do I cheat?
Reputation: 0

Joined: 18 Aug 2020
Posts: 4

PostPosted: Wed Aug 19, 2020 3:00 am    Post subject: Reply with quote

Corroder wrote:
Code:
if syntaxcheck then return end
if t then t.destroy(); t = nil end
local stop = 0

t = createTimer()
t.Interval = 100
t.OnTimer = function(t)
  if stop then
    print('hi')
    sleep(1000)
   
    if isKeyPressed(VK_F) then
      stop = 1
    else
       stop = 0
    end
  end
end



it seem not working it still printing even when I press f
Back to top
View user's profile Send private message Send e-mail
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Wed Aug 19, 2020 5:23 am    Post subject: Reply with quote

So just make it simple:

Code:
while true do
  print('hi')
  if isKeyPressed(VK_F) then
     break
  end
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