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 


why is my speedhack in luascript not working?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Thu Nov 05, 2020 7:55 am    Post subject: Reply with quote

because you're constantly switching between a high speed (3/10) and then back to 1, if it even starts to begin with as it will only run when the key is down at the same time the button gets clicked. afterwards nothing will happen
_________________
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
ByTransient
Expert Cheater
Reputation: 5

Joined: 05 Sep 2020
Posts: 240

PostPosted: Thu Nov 05, 2020 10:51 am    Post subject: Reply with quote

Press the relevant key; It will be Speed 3.
When you press it again 1. This cycle will continue.

Code:
lastspeed=1
function chkspd1()

    if lastspeed==1 then
      speedhack_setSpeed(3)
      lastspeed=2
      print("speed: "..speedhack_getSpeed())
  else
      speedhack_setSpeed(1)
      lastspeed=1
      print("speed: "..speedhack_getSpeed())
    end
  end
  if speedKey then speedKey.Destroy() end
speedKey=createHotkey(chkspd1, 0xA0)
Back to top
View user's profile Send private message
ByTransient
Expert Cheater
Reputation: 5

Joined: 05 Sep 2020
Posts: 240

PostPosted: Thu Nov 05, 2020 12:11 pm    Post subject: Reply with quote

Code:
local keyc = false

function Gspd()
 if keyc == true then
sleep(300)
 speedhack_setSpeed(iso.Gv.Text)
 else
sleep(300)
 speedhack_setSpeed(1)
 end
end

iso.Gspdhk.OnChange=function()
if sender.Checked==true then
keyc = true
--Gspd()
else
keyc = false
--Gspd()
end
end

if keyh then keyh.destroy(); keyh=nil end
keyh = createHotkey(Gspd, 0x47)
Back to top
View user's profile Send private message
ByTransient
Expert Cheater
Reputation: 5

Joined: 05 Sep 2020
Posts: 240

PostPosted: Sat Nov 07, 2020 10:56 am    Post subject: Reply with quote

Code:
local keyc = true

function Gspd()
 if keyc == true then
sleep(300)
 speedhack_setSpeed(iso.Gv.Text)
keyc = false
print("speed: "..iso.Gv.Text)
 else
sleep(300)
 speedhack_setSpeed(1)
 keyc = true
print("speed: 1")
 end
end

iso.Gspdhk.OnChange=function(sender)
if sender.Checked==true then
keyc = true
if keyh then keyh.destroy(); keyh=nil end
keyh = createHotkey(Gspd, VK_1)--0x47)
else
if keyh then keyh.destroy(); keyh=nil end
keyc = false
Gspd()
end
end

--if keyh then keyh.destroy(); keyh=nil end
--keyh = createHotkey(Gspd, 0x47)
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