Hi again, all!
Well, I found the time, even though I had to change my fundamental approach twice to get the behaviour of the code right:
Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;; ;;;;;;;;
;;;;;;;; GUNCAMERA (NTRK recording Script) ;;;;;;;;
;;;;;;;; ;;;;;;;;
;;;;;;;; Tom "JudgeMingus" Martin, 2008 ;;;;;;;;
;;;;;;;; Free for non-commercial use :D ;;;;;;;;
;;;;;;;; ;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Version 0.1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; VARIABLE DECLARATION ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
GunCam = 0
GunCamRecordingTime = 20000 ;20 seconds
NTRK_key = R ;the key assigned to "stop/start recording" NTRKs
return
;;;;;;;;;;;;;;;;;;;
;;; HOTKEYS ;;;
;;;;;;;;;;;;;;;;;;;
; For the first trigger I have used Joystick 1, button 2 as an example
; replace with your joystick trigger button (look it up in control panel\game ontrollers)
; eg, Joystick 3, button 12 would become ~3Joy12::
~1Joy2::
if GunCam=0
{
GunCam=1
Send {%NTRK_key%}
}
; set a timer to run once after delay
SetTimer, CameraCutOff, -%GunCamRecordingTime%
Return
; you probably want it triggered by both MG and Cannon, so here is a second 'trigger' button
; replace the button ID with your own...
~1Joy1::
if GunCam=0
{
GunCam=1
Send {%NTRK_key%}
}
SetTimer, CameraCutOff, -%GunCamRecordingTime%
Return
;;;;;;;;;;;;;;;;;;;
;;; FUNCTIONS ;;;
;;;;;;;;;;;;;;;;;;;
CameraCutOff:
GunCam=0
Send {%NTRK_key%}
Return
How to use this script:
1. Download AutoHotkey from
http://www.autohotkey.com and install it.
2. Copy and paste the code into notepad and save (plain text).
3. Make sure that you insert your own Joystick trigger/button IDs and the key assigned to "stop/start recording" in the appropriate locations (read the comments within the script. Comments begin with a semicolon ";" ). You may also, if you wish, change the default 20 second recording/overlap time to whatever you like.
4. Rename the file to something like NTRK-Guncam.AHK and make sure the .txt extension is gone. The file should change appearance to have a large "H" on the icon to show that it is a script associated with AutoHotKey.
5. Run the AHK script (it will pop up in the system tray, where you can right click to exit it)
You may do whatever you like with this script, but please don't sell it...
Please note, there are some IMPORTANT caveats:
- Each burst of fire more than 20 seconds apart will create a new, separate track. This is inherent in the IL-2 NTRK system, and would require serious coding within the game engine to alter.
- If you are already recording a track, this script will STOP THE RECORDING when you fire, and start a new track 20 seconds after you stop (I may address this in a future revision).
- This records a track in the normal manner - from the point of view you were using when recording. If you want to see a different view, you need to enable manual view control before replaying the track, and pause the track as soon as it starts so that you have time to choose your point of view.
- Finally, I have tested this and it seems to work pretty much flawlessly (within the above limitations). I cannot, however, guarantee that it will work fine on any other computer, or that it won't eat your hard drives and release the 'magic smoke' from your CPU.