muchimi / JoystickGremlinEx

Modified version of Joystick Gremlin to add features I wanted to have but were difficult to do as just a plugin, plus I wanted to run this as 64 bit and on a more current version of Python/QT.
GNU General Public License v3.0
35 stars 6 forks source link

Python Scripts #166

Closed Lucarrrrr closed 3 days ago

Lucarrrrr commented 1 week ago

Is is possible to integrate an action to execute any Python code by simply choosing it under PlugIns? Eg for starting programs and batchfiles like starting and stopping Helios Virtual Cockpit.

muchimi commented 1 week ago

Yes, you can easily hook up a button that kicks off a Python routine. The user plugins make all Python features are available to you which is used for more complex logic hard to do in actions/containers/condition or execute arbitrary Python code.

Python decorators are used for the hookup and there is a feature in GremlinEx that will will output the correct Python headers for your particular hardware inputs for the decorators to work.

Under the device information dialog, there is a "generate plugin script header" button that will create a python header and store that to the clipboard for this purpose.

This creates the correct definitions to use in Python for the decorators you need.

image

Hope this helps,

muchimi commented 1 week ago

Here's a simple example of an axis merge operation using a user plugin in Gremlin. The device GUID and names are extracted from the generated data above.

image

muchimi commented 1 week ago

This is exactly the same as doing a merger inside GremlinEx.

This is applicable to buttons as well as in this example:

image

Sorry the above code is missing the line (before line 14):

left_vpc = gremlin.input_devices.JoystickDecorator(LEFT_VPC_Stick_WarBRD_NAME, LEFT_VPC_Stick_WarBRD_GUID, "Default")

muchimi commented 1 week ago

image Only executes the code if the button is pressed.

Lucarrrrr commented 6 days ago

Thanks for your quick answer! Since I'm 60 years old, beeing a German from Berlin and my programming skills are from 1978 in BASIC and a little bit Pascal (first computer course in my school!) and VBA, I'm not familiar with sophisticated structures in Python. Nevertheless I'm just learning it by books. I'am an great fligt simulator fan since decades and hope now to have enough time for MsFs 2020/2024 and DCS. In the 90th I already owned the first HotAs from Thrustmaster incl. rudder and I boughjt my first PC only for "Strike Commander", a Intel DX2/66. Now I have 13 WinWing devices, a Quest 3 (my 4th VR glasses), a touchscreen for Helios Virtual Desktop, Open Kneeboard for Mixed Reality and an high-end-PC especially for flying. Upto now configure since months. The main program I use is indeed "JSG EX" in combination with 9 vJoy devices and HidHide. I already donated some money to the developer of Helios and want to donate for your great program, too unable to know how :( . For the A10-C 2 in DCS I configured >480 actions alone, for the F-16C >450. All the actionare documented in a really big Excel-Sheet. Now I have the need for Python to extend the possibilities to reach an new level in customization like with TARGET from Thrustmaster. At first, I have to start and stop Helios to reach the menues in DCS.

I only guess what an decorator is and never really programmed in Python before. If I understood the mechanism, the PlugIn I add will run first when JSG EX is started and is looking for action all the time it is running then. Is it right? Please help to complete my script I begun. I want to use button 50 of the F-15 throttle in "normal" mode to start Helios and want to stop it in "Option" mode. It would be cool if you could show the way to "press" a button of my vJoy devices, too. I understand that I'm begging for a big favor, but it would be a big help for me to finish my flight seat software Kindly regards from Berlin from Lucas Script

muchimi commented 3 days ago

Closing discussion for now. If you have questions on usage for Python user modules, we can discuss on Discord.

Lucarrrrr commented 3 days ago

Thanks for your time. I try to learn to program on my own and with help from a friend and ChatGPT.Slowly I understand how it’s working.It was the wrong place for my request, sorry.I still want to donate for your work because JG EX is my main solution for my devices and it’s great!I’ll report errors as much as I can since I’m updating to the new releases all the time.May be see you at Discord.Greetings!Lucas LehmannWeimarische Straße 6a10715 BerlinTel: +49 30 8225189Mobil: ‭+49 176 @. 12.11.2024 um 22:56 schrieb muchimi @.>: Closing discussion for now. If you have questions on usage for Python user modules, we can discuss on Discord.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>