FlyWithLua

Et quels sont les cas d'usage. pas tout bien compris.
 
En dehors de pouvoir faire soi-même des petits scripts , il est obligatoire ou conseillé pour un paquet de plugins dont FDStoXP , X-Atc Chatter , XSaitekPanels , 3jFPS-wizard1 , xVision , OCUsbMapper (This plugin lets you control Opencockpits devices using X-Plane custom datarefs .This means you can use XLUA, FlyWithLua, Python, C or C++ to customise the devices for any aircraft.) ect...



FlyWithLua offers a rapid development system to get in deep into X-Plane. An easy to understand, detailed manual is included.
FlyWithLua will support all platforms, Windows, Linux and Mac, and it will support X-Plane 9 and X-Plane 10. A script can be used on all platforms by default, without the need of re-editing. This let's you share scripts with friends using other systems.
FlyWithLua uses LuaJIT as a compiler. This results in very fast code execution, much faster than the original Lua interpreter.
FlyWithLua is ready to be used by anybody, no matter if you are a beginner or an experienced Lua developer.


en français :
FlyWithLua offre un système de développement rapide pour entrer en profondeur dans X-Plane. Un manuel détaillé et facile à comprendre est inclus.
FlyWithLua supportera toutes les plateformes, Windows, Linux et Mac, et il supportera X-Plane 9 et X-Plane 10. Un script peut être utilisé sur toutes les plateformes par défaut, sans avoir besoin de le rééditer. Cela vous permet de partager des scripts avec des amis utilisant d'autres systèmes.
FlyWithLua utilise LuaJIT comme compilateur. Il en résulte une exécution très rapide du code, bien plus rapide que l'interpréteur Lua original.
FlyWithLua est prêt à être utilisé par tout le monde, que vous soyez un débutant ou un développeur Lua expérimenté.
 

un exemple de code pour attribuer plusieurs fonctions sur un seul switch , le choix des fonctions se fait par les prefs joysticks de XP :

function AceKEY
Lua:
-- Check if we're in the B738 aircraft, you can have multiple of these for different aircraf inside a single script
if (PLANE_ICAO == "B738") then
   
    -- Create a callback function that we will call with our button
    function AceKEY_Transponder_Up()
        -- This is where the magic happens - command_once() will call whatever Xplane command you need.
        command_once("laminar/B738/knob/transponder_mode_up")
    end
    -- Register the command into Xplane
    create_command("FlyWithLua/AceKEY/Transponder_Up", "Transponder_Up", "AceKEY_Transponder_Up()", "", "")  

    -- This is the same thing for the Down action
    function AceKEY_Transponder_Dn()
        command_once("laminar/B738/knob/transponder_mode_dn")
    end
    create_command("FlyWithLua/AceKEY/Transponder_Dn", "Transponder_Dn", "AceKEY_Transponder_Dn()", "", "")  
end
 
Dernière édition:
Un autre script pour allumer external landing lights + retractable landing lights sur Zibo toujours avec un seul switch :

Lua:
    -- LAND LIGHTS
    function AceXSP_Switch_Land_On()
        command_once("laminar/B738/switch/land_lights_ret_left_dn")
        command_once("laminar/B738/switch/land_lights_ret_left_dn")
        command_once("laminar/B738/switch/land_lights_ret_right_dn")
        command_once("laminar/B738/switch/land_lights_ret_right_dn")
        command_once("laminar/B738/switch/rwy_light_left_on")
        command_once("laminar/B738/switch/rwy_light_right_on")
        set_array("sim/cockpit2/switches/landing_lights_switch", 0, 1)
        set_array("sim/cockpit2/switches/landing_lights_switch", 3, 1)
        return
    end
    create_command("FlyWithLua/AceXSP/Switch_Land_On", "Switch_Land_On", "AceXSP_Switch_Land_On()", "",
 
Une petite précision pour les avions qui ne proviennent pas de Laminar :

FlyWithLua recherche les datarefs avant qu'ils n'aient été créés.
Il faut donc examiner ces deux scripts et voir comment ils attendent que l'avion ait créé les commandes ou les datarefs avant de les rechercher.

Les 2 scripts se trouvent dans le dossier Resources/plugins/FlyWithLua/Scripts (désactivé) et s'appellent XPLMFindCommand_Test.lua et WaitForCommandToBeCreated.lua . (les 2 fichiers en pièces jointes)
 

Fichiers joints

  • xplmfindcommand+waitforcommands_lua.zip
    4 KB · Affichages: 7
FlyWithLua v2.7.30

6 juin 2021
v2.7.30 :Thanks_to_Steven L. Goldberg , added global varables PLANE_AUTHOR and PLANE_DESCRIP. Also fixed bug if you used the reload pluggins function. There is also a ChangeLog.txt in the Documentation folder.
 
FlyWithLua v2.7.33


v2.7.33 (11 mars 2022)
  • Added support for LuaJIT 2.1.0 beta3
  • Updated to sol v3.2.1
  • Updated OpenAL to v1.21.1.
v2.7.32
  • Thanks to Patrick Lang Fixed Debug output for sound elements so it is written directly to the debug file and added sound buffer to the debug output and load_wave function now receives a sound pointer.
  • Added OpenAL_Test.lua and OpenAL_Test2.lua to the Scripts (disabled) folder.
 
FlyWithLua v2.8.0 pour XP12 !

 
Retour
Haut