#Conditional Hooks

$Application: FS2_Open
$On Mission Start: 
[
runZoomScript = true
zoomValue = 1.00
normalFOV = 0.60
SensFactor =0.05
]

$Application: FS2_Open
$On Mission End: 
[
runZoomScript = false
]

$State: GS_STATE_GAME_PLAY

$KeyPress: l
$On Key Pressed: [
if runZoomScript then
 if zoomValue >= .20 then
  if #gr.Cameras > 0 then
   cam = gr.getCurrentCamera(true)
   if cam:isValid() then
    zoomValue = zoomValue -.10
    zoom = normalFOV * zoomValue
    cam:setFOV(zoom,.30,.15,.08)
   end
  end
 end
end
]

$KeyPress: k
$On Key Pressed: [
if runZoomScript then 
 if zoomValue <= .90 then
  if #gr.Cameras > 0 then
   cam = gr.getCurrentCamera(true)
   if cam:isValid() then
    zoomValue = zoomValue +.10
    zoom = normalFOV * zoomValue
    cam:setFOV(zoom,.30,.15,.08)
   end
  end
 end
end
]

$KeyPress: o
$On Key Pressed: [
if runZoomScript then 
 if zoomValue < 1.00 then
  if #gr.Cameras > 0 then
   cam = gr.getCurrentCamera(true)
   if cam:isValid() then
    cam:setFOV(normalFOV,2.0,1.0,.50)
	zoomValue = 1.00
   end
  end
 end
end
]

$On Frame: [
if runZoomScript then
 if zoomValue <= .90 then
  local ci = ba.getControlInfo()
  ci.Pitch = ci.Pitch * SensFactor * zoomValue
  ci.Heading = ci.Heading * SensFactor * zoomValue
 end
end
]

#End