Lua script question

Announcements, general discussion
Post Reply
bliksimpie
Posts: 7
Joined: 27 Aug 2013, 14:45

Lua script question

Post by bliksimpie » 27 Aug 2013, 15:00

Hello, long time not speaking, but still enjoying the best little addon. Currently running 6 numpads each used for its own unique purpose eg lights, Auto pilot, engine controls etc etc.

Now I am about to endeaver a bit more with this APP.

I refer your comment:
"Main purpose is to execute FSUIPC macros and LUA scripts using offset 0x0D70"
BUT I do not know what you mean with this sentence above :? . (I am a bit slow I know, but I am getting there slowly)

I do use lua scripts that I trigger via FSUIP/controller buttons.
Below a very simple example of a control that I know I can set via FSX commands, but this below is for example only.

Lua script called: gear_down.lua
Inside I have the following one line entry, that set the FSX control: gear down:
ipc.control(66080)

Now what do I need to do to use hidmacro to run this little lua script, or do I need to write some macro. I read through some documents but am am lost in all the technical stuff. Sorry I am seriously handicapped when coming to coding/macros etc.

Would you please tell me what to do for example the above scenario, and I will then duplicate and most probably I will be able to do other simmilar little scripts. Just need one example in monkey see monkey do language.

Much appreciated
JB
Last edited by bliksimpie on 27 Aug 2013, 15:33, edited 2 times in total.

bliksimpie
Posts: 7
Joined: 27 Aug 2013, 14:45

Re: Lua script question

Post by bliksimpie » 27 Aug 2013, 15:16

Maybe I should change my question to also include so called "L" variables.
More and more developers use "L" variables for switches etc.
Eg a developer use a customer "L VAR" for open cowl flaps.
in the lua the script would look like this.
ipc.writeLvar("L:Duke_Cowl_Flaps_Switch_1",2)

How can I get hidmacros to set such an L variable to a specific value. Eg above example need to set the L variable "Duke_Cowl_Flaps_Switch_1" to a value of "2". in this case the cowl flap of left engine of the B60 duke will be set to open 100%.

Currently the only way for me to set such L variables is with a small lua script, that is executed with FSUIP that link the script with a button on a controller.
I would rather like to use hidmacros to set such variables as then I can use specific keyboard key to change such variable. (the other reason, I am running out of controler buttons to execute the lua scripts that is able to set such "L:variables")

Any idea how to accomplish this via hidmacros.

I am thinking along the lines maybe something like this
eg: HIDMacros.LVariable "Duke_Cowl_Flaps_Switch_1", 2

Image

Pretty please: All latest planes last 6 months, have 90% of switches linked to custom L"Variables"
Same as fsx variables but it do not start with the customery A: or K:.



If the above is not possible, what to do in Hidmacro, to run a LUA script that can set these L"Variables"

bliksimpie
Posts: 7
Joined: 27 Aug 2013, 14:45

Re: Lua script question

Post by bliksimpie » 28 Aug 2013, 12:18

Just look at the extended list of L:Vars available for the latest twin otter released :o
http://forum.aerosoft.com/index.php?/to ... available/

admin
Site Admin
Posts: 735
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Re: Lua script question

Post by admin » 29 Aug 2013, 03:10

Anyone using this function to start FSUIPC macro?
I don't have registered version of FSUIPC so I can not test. The String function was added on request seeing this discussion: http://forum.simflight.com/topic/66693- ... or-fsuipc/
So maybe you can find some hints there.

Regarding L-variables: I don't plan any improvements in SimConnect area. What I plan is to open HidMacros sources so maybe some developer can implement it...
Petr Medek
LUAmacros author

bliksimpie
Posts: 7
Joined: 27 Aug 2013, 14:45

Re: Lua script question

Post by bliksimpie » 03 Oct 2013, 21:04

Peter mayeb you can help as I cannot get hold of the one guy that posted that he got it working.

in the reference post you qouted, the "firefly" guy posted the following that he got it working by using a scrips in hidmacros
http://forum.simflight.com/topic/66693- ... or-fsuipc/

can you explain this sentence "HIDMacros.SetFSUIPCString &HD70, 40, "Lua testlua"" where you said you use hidmacros to execute lua file

HIDMacros.SetFSUIPCString ---------------------> I think I understand

&HD70 ------------------------------------? please explain the value

40, -----------------------------------? please explain the value

"Lua testlua" ---------------------> I presume it must be the lua name.

Currently I use a joystick button programmed in fsuip to execute the Lua script.

I would much rather use a keyboard keypress via hidmacros to execute the lua, but I am a bit lost how to do that.

Please can you help just to get ONE simple example working.

If I understand the above string and values I can create others to follow same principle.

Much appreciated.
JB

bliksimpie
Posts: 7
Joined: 27 Aug 2013, 14:45

Re: Lua script question

Post by bliksimpie » 04 Oct 2013, 07:53

I got it working..! with the help of a fellow simmer..!

thanks everybody. I am first off now to test further and then I will write up, what and how, here on the forum.. Whaoo.. the possibilities just became endless...!!!!!


whhhhhhhooooooooo hhhhhhaaaaaaaa..!!

megs8888
Posts: 4
Joined: 23 Feb 2014, 02:18

Re: Lua script question

Post by megs8888 » 28 Feb 2014, 12:43

Please share the fix ?

Lenm
Posts: 1
Joined: 30 May 2014, 09:12

Re: Lua script question

Post by Lenm » 30 May 2014, 09:18

Does anyone now know how to do this?
it sure would be nice if they give the solution after asking in the forums!
Guess i have to continue searching

grizzly
Posts: 6
Joined: 11 Feb 2018, 16:52

Re: Lua script question

Post by grizzly » 12 Feb 2018, 11:50

I'm trying to do the same (multiple keyboards using Airbus PMDG Lvars or something else)

Does somebody knows how to do it (using HidMacros) ??

Thanks

grizzly
Posts: 6
Joined: 11 Feb 2018, 16:52

Re: Lua script question

Post by grizzly » 23 Feb 2018, 11:51

I Found the way to do it
It's possible....

Post Reply