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 


How do I set up a speedhack hotkey (please read before reply

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
HitIer
How do I cheat?
Reputation: 22

Joined: 09 Feb 2013
Posts: 0
Location: Location Location Location

PostPosted: Mon Jun 19, 2017 9:32 pm    Post subject: How do I set up a speedhack hotkey (please read before reply Reply with quote

I want to know how to set up a speedhack hotkey. I already have tried going in settings > hotkeys, there I saw options that said:

"Set speedhack to speed 1"

In this case, how do I define "speed 1"? Or does it mean that the hotkey will set the speedhack to a constant 1.0?

Also, when I tried to customize the speedhack speed and ticked "Stop on release", it only changed the speed [/i]while I was holding down the key. I want it to remain at that particular speed until I can change the speed back to 1 again after manually tapping the key. Can anybody help me?

_________________
With self driving cars, CE can work in real life

t328163 wrote:
Your username derives from the fact that this site cannot format special characters lol.


t328163 wrote:

lmfao, on reddit i'd get banned
Back to top
View user's profile Send private message MSN Messenger
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Tue Jun 20, 2017 8:27 am    Post subject: Reply with quote

🌊 &#12775 wrote:
Or does it mean that the hotkey will set the speedhack to a constant 1.0?
This unfortunately.

Though it is still really simple, add a script to your table and use this lua code, changing 15 to whatever you want.

Code:
{$lua}
oldspeed=1 -- a variable to remember the previously set speed
[ENABLE]
-- set the new speed
oldspeed=speedhack_setSpeed(15)
[DISABLE]
-- restore the previous speed (probably 1 but)
speedhack_setSpeed(oldspeed)


then you can set a hotkey to toggle that script.

If you wanted to change the speed fairly often then you could use allocateSharedMemory to create a place for the user to change the value and read from it. Something like this in theory
Code:
{$lua}
oldspeed=1
[ENABLE]
function getAddrSafe(symbol)
  if getCEVersion() < 6.7 then
    local oldLookup=errorOnLookupFailure(false)
    local addr = getAddress(symbol)
    errorOnLookupFailure(oldLookup)
    return addr ~= 0 and addr or nil
  else
    return getAddressSafe(symbol)
  end
end

if syntaxcheck then return end
local addr = getAddrSafe("user_speedhack")
if not addr then
  addr = allocateSharedMemory("user_speedhack", 4)
  if not addr then error("failed to allocate memory") end
  registerSymbol("user_speedhack",addr,true)
  writeInteger(addr, 5) -- default speed
end

local mr = getAddressList().createMemoryRecord()
mrid = mr.ID
mr.Description = "Speedhack"
mr.Address = "user_speedhack"
mr.DontSave = true
--[[
no idea why these aren't working (tested in 6.7)
mr.createHotkey({VK_1}, mrhIncreaseValue, 2)
mr.createHotkey({VK_2}, mrhDecreaseValue, 2)
]]
hk1 = createHotkey(function() writeInteger("user_speedhack",  2+readInteger("user_speedhack")) end, {VK_1})
hk2 = createHotkey(function() writeInteger("user_speedhack", -2+readInteger("user_speedhack")) end, {VK_2})

timer = createTimer()
timer.Interval = 100 -- 100 milliseconds
timer.OnTimer = function()
  oldspeed=speedhack_setSpeed(readInteger("user_speedhack"))
end

[DISABLE]
if syntaxcheck then return end
if timer then timer.destroy() end
speedhack_setSpeed(oldspeed)
local mr = getAddressList().getMemoryRecordByID(mrid)
if mr then
  for i=1,mr.HotkeyCount do
    mr.Hotkey[i].destroy()
  end
  if hk1 then hk1.destroy() end
  if hk2 then hk2.destroy() end
  mr.destroy()
  mr = nil
end


https://www.dropbox.com/s/yen7mnvkvnfw72c/speedhack_script.ct?dl=0

except that for some reason using the hotkey to active this script freezes CE (both 6.6 and 6.7)... works if you activate it manually though. There's also a small error when disabling it manually caused by removing the record (not sure why) that doesn't really seem to affect anything, but in separate testing that doesn't happen when you do use a hotkey... lol
Back to top
View user's profile Send private message
HitIer
How do I cheat?
Reputation: 22

Joined: 09 Feb 2013
Posts: 0
Location: Location Location Location

PostPosted: Tue Jun 20, 2017 2:15 pm    Post subject: Reply with quote

Thanks for the help, I've got it now Smile
_________________
With self driving cars, CE can work in real life

t328163 wrote:
Your username derives from the fact that this site cannot format special characters lol.


t328163 wrote:

lmfao, on reddit i'd get banned
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine 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