--- English Description Below ---
Hier eine Schritt für Schritt Anleitung für FlyWithLua in Kombination mit unseren Boards (und allen anderen Joysticks):
1. FlyWithLua Plugin installieren (Nutzer anlegen notwendig):
XP 9 / 10:
http://forums.x-plane.org/index.php?/files/file/17468-flywithlua-for-xp9-and-xp10/
XP 11:
Hier eine gute Einführung im Umgang mit FlyWithLua (Installation etc.)
http://forums.x-plane.org/index.php?/forums/topic/71006-howto-first-steps-using-flywithlua/
2. X-Plane starten und Flugzeug auswählen
3. Hardware anschließen und im normalen X-Plane Menü die Funktionen den Buttons des Joysticks oder des Joystick Boards zuweisen.
Wichtig ist es sich zu merken welche Funktionen auf welchem Button sind. Somit kann man später den Joystick identifizieren und anpassen.
4. X-Plane beenden und neu starten. Dasselbe Flugzeug auswählen.
5. Jetzt sollte in dem FlyWithLua Plugin Ordner die datei "initial_assignments.txt" liegen. X-Plane kann ab hier geöffnet bleiben.
...
set_button_assignment( (0*40) + 0,"sim/lights/landing_lights_on")
set_button_assignment( (0*40) + 2, "sim/view/forward_with_hud" )
...
7. Ändern von Buttons auf Switches.
Offensichtlich wird hiermit ein Button (Momentary) zugewiesen:
set_button_assignment( (0*40) + 0,
"sim/lights/landing_lights_on"
)
Soll daraus ein switch werden (Kippschalter oder ähnliches) wird es folgendermaßen adaptiert:
create_switch((0*40) + 0, "sim/cockpit/electrical/landing_lights_on")
Wie man hier gut sieht, sind die Datarefs für den create_switch Aufruf anders als die assignments in den Button Assignments. Wo man die Datarefs findet, steht weiter unten.
Unter Umständen reicht es aber noch nicht "nur" den Switch zuzuweisen. Eventuell benötigt man manchmal auch Button Events:
function button_check() -- This assigns a function
if button((0*40)+0) and last_button((0*40)+1) then
command_once("sim/cockpit/electrical/landing_lights_on")
end
end
do_every_frame("button_check") -- This is the "main" function that is called permanently and executes the function
8. die geänderte Datei als .lua Datei in den script Ordner von flywithlua speichern.
9. in X-Plane im Plugin Menü von Flywithlua das Script reloaden. Jetzt sollten die Belegungen aktualisiert sein.
Aber Achtung! das script hebt erst alle X-Plane Belegungen auf und macht sie dann wie in dem script neu. Es müssen jetzt also alle Belegungen im script gemacht werden. Alles was im normalen X-Plane Menü belegt wird, wird ignoriert. Oft ist es allerdings am aufwendigsten erstmal das richtige dataref für die gewünschte Funktion zu finden.
Dazu kann ich die folgenden link empfehlen: http://www.xsquawkbox.net/xpsdk/docs/DataRefs.html
Sehr hilfreich ist auch ein Plugin welches in X-Plane alle datarefs mit werten anzeigt. Hier kann man auch nach geänderten werten filtern: https://github.com/leecbaker/datareftool
Unbedingt zu empfehlen ist das Fly With Lua Manual, dort bekommt man Einblick in alle Funktionen und Fähigkeiten von FlyWithLua:
https://github.com/X-Friese/FlyWithLua/blob/master/FlyWithLua/Documentation/FlyWithLua_Manual_en.pdf
----------------------------------------------------------------------------------------------------------------------------
ENGLISH Version
This is a step by step guide to enhance your X Plane Flight Simulator with FlyWithLua and assign Joystick Functions with our boards (or any other Joystick Hardware)
1. Install FlyWithLua Plugin (account required):
XP 9 / 10:
http://forums.x-plane.org/index.php?/files/file/17468-flywithlua-for-xp9-and-xp10/
XP 11:
A good introduction and installation hints can be found here:
http://forums.x-plane.org/index.php?/forums/topic/71006-howto-first-steps-using-flywithlua/
2. Start X-Plane and select your desired aircraft
3. Connect your hardware and assign your Joystick Buttons as you normally do. Now when you assign, try to keep track of which function you assign on which board and which button. It will simplify the work later. Run the simulation with your Joystick.
4. Restart X-Plane and choose the same aircraft again.
5. FlyWithLua created the "initial_assignments.txt" file (Check the FlyWithLua path -> XP11/Resources/Plugins/FlyWithLua/). In the file you find the assignments, that X Plane detected from your hardware.
...
set_button_assignment( (0*40) + 0, "sim/lights/landing_lights_on" )
set_button_assignment( (0*40) + 2, "sim/view/forward_with_hud" )
...
7. Change from Button to Switch.
Obviously the assignment is a button assignment (momentary):
set_button_assignment( (0*40) + 0,
"sim/lights/landing_lights_on"
)
Now we dont want it to be a button, but a switch (maybe we have a hardware switch installed):
create_switch((0*40) + 0, "sim/cockpit/electrical/landing_lights_on")
Obviously the dataref path (and sometimes even the name) for the create switch is a different one, than the normal "button assignment" reference. To find your dataref, a link is provided below to identify the needed item.
Maybe it is not enough to assign a switch and a button, but you need some logic behind a button / switch:
function button_check() -- This assigns a function
if button((0*40)+0) and last_button((0*40)+1) then
command_once("sim/cockpit/electrical/landing_lights_on")
end
end
do_every_frame("button_check") -- This is the "main" function that is called permanently and executes the function
8. Now save the changed file in the Scripts folder with a .lua extension (otherwise it will be ignored).
9. In the FlyWithLua Menu within XP you can now reload the script and it will set the inputs accordingly.
Caution! The Script deletes the X Plane Menu assignments (There is a line of code stating "ResetAllAssignments"). All Assignments need to be done using the script now. Configurations of the normal XP Menu will be ignored. If you are tired of this, you can just deleted the script from the script folder in the FlyWithLua path.
Sometimes the hardest work is to find an assignment. There is a good reference documentation to be found here:
http://www.xsquawkbox.net/xpsdk/docs/DataRefs.html
Helpful is also the tool that generates datarefs for you:
https://github.com/leecbaker/datareftool
Highly recommended is also the FlyWithLua Manual in English:
https://github.com/X-Friese/FlyWithLua/blob/master/FlyWithLua/Documentation/FlyWithLua_Manual_en.pdf
Comments powered by CComment