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 


Help creation hotkeys

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

Joined: 25 Apr 2025
Posts: 1

PostPosted: Fri Apr 25, 2025 2:55 am    Post subject: Help creation hotkeys Reply with quote

Hi all,

I am just starting with Cheat Engine and LUA scripting based on Stephen Chapman videos. Really instructive. Didn't watched everything yet but it's planned.

So, I made a small camera for a game called Ghostwire Tokyo. It works.
At one exception. If I want the full character I have to open the photo mode and that's where my problem lies.

I use the arrows up , down, left and right for the pitch and yaw. But they interfere with the photo mode commands.

This is how it is done. It's really a copy/paste from Chapman way.

Code:

  --Pitch Up
  if isKeyPressed(VK_UP) then
   writeFloat("[pCamStruct]+0C", campitch + (speed * 0.5))
  end
    --Pitch Down
  if isKeyPressed(VK_DOWN) then
   writeFloat("[pCamStruct]+0C", campitch - (speed * 0.5))
  end
      --Yaw Right
  if isKeyPressed(VK_RIGHT) then
   writeFloat("[pCamStruct]+10", camyaw + (speed * 0.5))
  end
    --Pitch Left
  if isKeyPressed(VK_LEFT) then
   writeFloat("[pCamStruct]+10", camyaw - (speed * 0.5))
  end


I did try with 2 isKeyPressed but then it does some kind of forward roll.

So, I have absolute no idea how I could by example use VK_ADD and VK_NUMPAD8/5 and 4/6 to do a pitch up and down and yaw left and right.

If you could point me to some examples or explain me how I could change and optimize all of this it would be kind.

Many thanks in advance.
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1069
Location: 0x90

PostPosted: Fri May 02, 2025 4:06 am    Post subject: Re: Help creation hotkeys Reply with quote

AnticOwl wrote:
Hi all,
...


It's because you have to set the VK key codes to the respective constant value. You can find more VK key codes here https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes

But here, we have defined a table of hotkeys and then set them in the respective function
Code:

  local hotkeys = {
    up = VK_NUMPAD8,
    down = VK_NUMPAD2,
    left = VK_NUMPAD4,
    right = VK_NUMPAD6,
  }

  --Pitch Up
  if isKeyPressed(hotkeys.up) then
   writeFloat("[pCamStruct]+0C", campitch + (speed * 0.5))
  end
    --Pitch Down
  if isKeyPressed(hotkeys.down) then
   writeFloat("[pCamStruct]+0C", campitch - (speed * 0.5))
  end
      --Yaw Right
  if isKeyPressed(hotkeys.right) then
   writeFloat("[pCamStruct]+10", camyaw + (speed * 0.5))
  end
    --Pitch Left
  if isKeyPressed(hotkeys.left) then
   writeFloat("[pCamStruct]+10", camyaw - (speed * 0.5))
  end
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