Define custom views in Xplane

How can be this controlled in that simulator? Can HIDmacros be used with this application?
Post Reply
admin
Site Admin
Posts: 735
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Define custom views in Xplane

Post by admin » 28 Oct 2011, 13:05

Just played a little bit to set overhead view in DreamFoil's Bell206 by single key.
Here are the scripts I have used (this time in Jscript).

Script global section:

Code: Select all

function init() {
  acf = HIDMacros.GetXplVariable("sim/aircraft/view/acf_ICAO");
  HIDMacros.Debug("Aircraft: " + acf);
}

function log_view() {
  HIDMacros.Debug("Current view:");
  HIDMacros.Debug("X: " + HIDMacros.GetXplVariable("sim/graphics/view/pilots_head_x"));
  HIDMacros.Debug("Y: " + HIDMacros.GetXplVariable("sim/graphics/view/pilots_head_y"));
  HIDMacros.Debug("Z: " + HIDMacros.GetXplVariable("sim/graphics/view/pilots_head_z"));
  HIDMacros.Debug("Psi: " + HIDMacros.GetXplVariable("sim/graphics/view/pilots_head_psi"));
  HIDMacros.Debug("The: " + HIDMacros.GetXplVariable("sim/graphics/view/pilots_head_the"));
}
I use init to setup some global variables for aircraft (not only one, the code above is simplified) and log_view I use when I set up the view manually and want to see current values. So I use it just to find out values for macro definition.

Code for overhead panel view macro:

Code: Select all

//log_view();
HIDMacros.XPLCommand("sim/view/3d_cockpit");
if (acf = "B06") {
  HIDMacros.SetXplVariable("sim/graphics/view/pilots_head_x", 0.008);
  HIDMacros.SetXplVariable("sim/graphics/view/pilots_head_y", 0.05);
  HIDMacros.SetXplVariable("sim/graphics/view/pilots_head_z", -1.03);
  HIDMacros.SetXplVariable("sim/graphics/view/pilots_head_psi", 0);
  HIDMacros.SetXplVariable("sim/graphics/view/pilots_head_the", 90);
}
Petr Medek
LUAmacros author

Post Reply