PDA

View Full Version : CTRL+k - Camera Edit Mode - Try these AutoHotkey Macros



Richard83945
11-07-2016, 19:34
CAMERA EDIT MODE
Camera Edit Mode (ctrl+k) works well in pCars, but unfortunately the settings are lost at the end of each track session.
I've created an AutoHotkey script with four macros for my Thrustmaster TX which will set favourite Camera Mode settings at the start of every track session.
These should work with other wheels, although I cannot test them.
If you've never used AutoHotkey, I would advise you to try out my script and then gradually modify it for your wheel buttons, cars and camera settings. I've only included macros for ctrl+k, forward(d), up(w) and reset(numpad5), but the other commands should work.


ATTACHED SCRIPT (ZIPPED)
234965


SCRIPT LISTING
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

; ______________________________________________________________
; Joy button 11 will simulate pressing ctrl+k
; ______________________________________________________________
Joy11::

Send {Control down}
Send, {k Down}
Sleep, 50
Send, {k Up}
Sleep, 50
Send {Control up}

SoundBeep, 750, 500

return


; ______________________________________________________________
; Joy button 10 will simulate pressing d and w for LOTUS 49
; ______________________________________________________________
Joy10::

; This resets camera before adjustment
Send {Numpad5 down}
Sleep, 50
Send {Numpad5 up}

MyForward = 1350
Send {d down}
Sleep MyForward
Send {d up}

MyUp = 150
Send {w down}
Sleep MyUp
Send {w up}

return

; _____________________________________________________________
; Joy button 9 will simulate pressing d and w for LOTUS 72D
; ______________________________________________________________
Joy9::

; This resets camera before adjustment
Send {Numpad5 down}
Sleep, 50
Send {Numpad5 up}

MyForward = 1000
Send {d down}
Sleep MyForward
Send {d up}

MyUp = 200
Send {w down}
Sleep MyUp
Send {w up}

return

; ______________________________________________________________
; Joy button 12 will simulate pressing numpad5 - RESET
; ______________________________________________________________
Joy12::

Send {Numpad5 down}
Sleep, 50
Send {Numpad5 up}

return


MACRO VARIABLES
For clarity, I created two variables in the script - MyForward and MyUp. These are how long the Camera Edit Mode shortcuts are held down.
You don't actually need to use variables. You could just put the amount of camera movement straight into the macro e.g.
Send {d down}
Sleep, 1350
Send {d up}


GETTING THE SCRIPT WORKING
Install AutoHotkey
https://autohotkey.com/
Read the AutoHotkey tutorial to learn about creating and running scripts.

You can automatically run the script at Windows startup.
If you put your script.ahk file in the "startup" folder it will run automatically. To access the startup folder you need to go to:
Computer --> Local Disc C: --> Users --> "yourusername" --> AppData (hidden folder) --> Roaming --> Microsoft --> Windows --> Start Menu --> Programs --> Startup
***** I keep my script in Documents, but I've pasted a shortcut into the Startup folder.


USING THE SCRIPT IN pCars
1. Run pCars.
2. Load Solo, Free Practise, Time Trial, etc.
3. Press your ctrl+k wheel button when you are on the track/in the pits. ***** ctrl+k only needs to be used once every pCars program load - not every track session. If you accidently press it twice - press it twice more to continue using your macros.
4. Press a camera change wheel macro button.


TO MODIFY THE SCRIPT
Right click on the script file and choose "Edit Script"
After you have edited and saved the script, left click on the script file to run the modified script. You will see this message:
"An older instance of this script is running. Replace it with this instance?"
Click YES

You don't need to close pCars to modify a script. Just Alt+TAB to leave pCars - edit and save your script - run the script - then return to pCars and Resume to test your changes.


PCars CAMERA EDIT MODE SHORTCUTS
I found them here:
http://www.projectcarsvideos.com/2014/12/project-cars-keyboard-shortcuts-for.html
Thanks to GamingVideoOnPC

Here's the ones to use in your macros:
Camera Edit Mode (Build 159+)
To enter the mode you press Ctrl-K.
Then the following keys become active:
Numpad 2: increase pitch
Numpad 3: switch lights on/off
Numpad 8: decrease pitch
Numpad 4: increase yaw
Numpad 6: decrease yaw
Numpad 7: increase radius
Numpad 9: decrease radius
Numpad 1: increase roll
Numpad 3: decrease roll
Numpad -: increase FOV
Numpad +: decrease FOV
D: forward
A: backward
W: up
S: down
Q: left
E: right
Numpad 5: RESET to original settings for current camera


WHEEL BUTTON NUMBERS
These can be found in Windows - Games Controllers - Properties.

234966

Clear your chosen macro wheel button assignments in pCars preferences to avoid conflicts.


OTHER INFORMATION
I've tried using AutoHotkey to simulate pressing a shortcut key a certain number of times, but I get more consistent results when the macro simulates pressing the shortcut for a certain time.

I've used numpad5 to RESET the camera. This seems to change the "default" view in some cars so, to get consistent results, I decided to put a RESET command at the start of every macro.

The macros work quite fast so you will have time to use them while waiting for the race Green Lights or "Manual Control" in a Time Trial.


LIMITED NUMBER OF WHEEL BUTTONS
People have a limited number of unassigned buttons on the wheel.
I've tried assigning keyboard shortcuts instead of wheel buttons, but I can't get these to work in pCars.
Perhaps someone can modify the script to get keyboard shortcuts working, or use the same wheel button for different camera settings.


FEEDBACK
I'm a beginner at using AutoHotkey, so I would welcome any modifications, etc.