Fragtality/PilotsDeck

Unable to run lua functions with built-in engine

Closed this issue · 20 comments

Hi

I cannot tell you which "latest" version I have, but I can't update because Windows rejects to install current "latest" However, I have written a really simple lua file called "cl415_functions.lua" which has been stored at
C:\Users\Usuario\AppData\Roaming\Elgato\StreamDeck\Plugins\com.extension.pilotsdeck.sdPlugin\Scripts
image

My current lua code is as simple as:
function TEST() log("Module recognized") end
And the command assigned to my SD button is lua:cl415_functions:TEST

But the log I'm getting is

2024-10-23 19:01:10.927 - [ cl415_functions.lua ] Neo.IronLua.LuaRuntimeException: Can not call nil value.

every time.

For sure it's a really silly mistake, but I can't see it!!

Lua (like most other Languages) is case sensitive - it is Log

I would be more interested in the Topic that it can not be installed?! How/Where exactly does it fail? Is there a log File left-over?

Lua (like most other Languages) is case sensitive - it is Log

Yeah, I was starting to think on that, I even tried with the change, but probably the plugin didn't recognized the change and didn't load it

I would be more interested in the Topic that it can not be installed?! How/Where exactly does it fail? Is there a log File left-over?

I just download the .exe (allow to keep it and execute it) but Windows shows me this message:

image

Never happened to me before

I checked the case problem, and you were right, it was that, and again I was having issues with the update of the lua file for the plugin (it takes some time for the SD plugin to use the new saved .lua content).

But I haven't progressed much because again I'm finding difficulties:

  • First a syntax use, I have a root name "LIGHTING_PANEL_3" which I would like to use to read a Lvar ("LIGHTING_PANEL_3") and also to write a value using SimWrite("B:LIGHTING_PANEL_3",currentLightStatus + 5), so I would need to concat "B:", which is the syntax for doing that?

(Or better, which lua language should we use? because I haven't been able to find commands like Log)

-And second: as I was telling you, there is an Lvar called LIGHTNING_PANEL_3
image

...I'm actually able to read:
image

However, If I try to read it in .lua by
local lightController = "LIGHTING_PANEL_3"
local currentLightStatus = ipc.readLvar(lightController)

When I try to execute I get:

2024-10-24 08:21:24.201 - [ cl415_functions.lua ] Neo.IronLua.LuaRuntimeException: Object is nil.

EDIT using local currentLightStatus = ipc.readLvar("LIGHTING_PANEL_3") wouldn't work either

I checked the case problem, and you were right, it was that, and again I was having issues with the update of the lua file for the plugin (it takes some time for the SD plugin to use the new saved .lua content).

The Plugin checks the last write time every 5 Seconds for every Lua File.


First a syntax use, I have a root name "LIGHTING_PANEL_3" which I would like to use to read a Lvar ("LIGHTING_PANEL_3") and also to write a value using SimWrite("B:LIGHTING_PANEL_3",currentLightStatus + 5), so I would need to concat "B:", which is the syntax for doing that?

Why would you do that - this isn't a B-Var?! (and generally: Google)
Besides that: what is the Reasoning to do a simple Increment with a Lua Script instead of using the Value Manipulation? (I guess it is because of the next Answer)


(Or better, which lua language should we use? because I haven't been able to find commands like Log)

However, If I try to read it in .lua by
local lightController = "LIGHTING_PANEL_3"
local currentLightStatus = ipc.readLvar(lightController)

When I try to execute I get:

2024-10-24 08:21:24.201 - [ cl415_functions.lua ] Neo.IronLua.LuaRuntimeException: Object is nil.

EDIT using local currentLightStatus = ipc.readLvar("LIGHTING_PANEL_3") wouldn't work either

Because you refuse to read the Readme. 🤷‍♂️

The reason I'm using Lvars and Bvars is because while I can read and write
the first ones, writing them has no effect in the sim, so I need to read
the Lvar and write the Bvar, and that's algo the reason I can't use simple
value manipulation provided by the plugin.

That is not true and if it should be true, that would be a Bug.
B-Vars can be handled as a Variable and there for can use these Value Manipulations - IF you tell the Plugin to NOT treat is as Command only Type (without Value).
image
(Also explained in the Readme 😉 )

OK,

Back home now, with access to Github :)

Lots of info in your last post. I didn't know that you had updated the readme, which now has a lot of new instructions I wasn't aware. I will read them in order to get all new content knowledge.

However, I'm not seeing that CheckBox you mentioned, and I fear it is because I have an outdated "lastest-version" installed. And as I told you in one of my previous comments I can't install current latest.

(I have realized I posted the Windows message in Spanish, but essentially what it says is I can't run the program -that is the installer- in my PC because it is compiled for "another equipment", and to contact the author to get one for mine)

And as I told you in one of my previous comments I can't install current latest.

Yes, and that was all you did. In the mean Time I translated the Error Message myself and even tested the Installer in a Windows 11 VM: Works normally.

And as I told you in one of my previous comments I can't install current latest.

Yes, and that was all you did. In the mean Time I translated the Error Message myself and even tested the Installer in a Windows 11 VM: Works normally.

Well, actually I'm on Windows 10, but I don't think that may be a problem. I googled a bit and I guess the problem may be on my side, so I will try to solve it on my side. In case I'm not able, I will wait till the official release on 0.8.0, and see if that works for me.

I didn't have any problems with previous ones but may be in the meantime I installed something conflicting.

As always, thank you for your quick support

I'm also on Windows 10, but I did not know on which Version you are ;)

Maybe you did some form of "optimization" which lead to that? The Installer is compiled against the .NET 4.7.2 Framework - which is installed by Default from Windows 10 and up. But it can be removed by adding/removing OS Features, so maybe that is the Issue because some rather aggressive Tool removed that "bloat". (That would not interfere with the Plugin itself, since it runs on the .NET 8.0 Runtime which is not part of the OS)

When I remember correctly one Change to the Installer was that I set it to "x64" as Target Platform - but I guess that is not the Reason for this Message since you have a Windows 10 x64 Installation, right? (Does MSFS even run on 32 bit Systems?!)

Nope, it's x64, I have .NET Framework 4.8.09037 installed and just installed and I updated my W10 Pro to 22H2 version earlier today.

I'm not aware of having installed anything strange lately, I have a laptop for experiments and a desktop PC nearly 100% dedicated to the Sim (I even don't have Office here). I have also tried disabling antivirus (with no result, as I expected as the message seems to be quite Windows Core), and I'll so try disabling Defender.

Just to make sure, I'm using the file following the link https://github.com/Fragtality/PilotsDeck/blob/master/Install-PilotsDeck-latest.exe, is that correct?

I'll keep you informed if you are interested. Meanwhile I think I will be able to implement my light control through luas

EDIT:
Something strange happens when I try to run it as Administrator, in that case, the message changes to "System cannot find the specified path", or whatever it is in English.

OK I give up for today.

I couldn't make it run on any of the three computers I tried to download and run, on every case I got the same message. For sure I'm doing something terribly wrong, but after getting up before sunrise and driving 500Km many of them under the rain, my degugging capacity is totally ran out.

If you have any idea I'll be glad to hearing (maybe another link to the readme, sorry I haven't re-read it)

Don't really have a Clue, you're the first one reporting that the Installer doesn't run because it is "blocked" by Windows :/

Maybe there is something in the Windows Event Log?

Hi!

Finally I had time to check the Event Log, and I got the following:

"El programa o característica "??\C:\Users\Usuario\Desktop\Plugin.exe" no se puede iniciar o ejecutar porque no es compatible con versiones de 64 bits de Windows. Consulte con el fabricante de software si existe una versión disponible que sea compatible con Windows de 64 bits"

Or in English (just a Google Translation, as I wasn't able to find the original message):

"The program or feature "??\C:\Users\User\Desktop\Plugin.exe" cannot start or run because it is not supported on 64-bit versions of Windows. Check with the software manufacturer if a version available that is compatible with 64-bit Windows"

And the properties associated (just in case they are useful):

image

Although I think the only relevant information here is the source of the event (Origen) and the ID (Id. del).

*Plugin is just a name I gave the installer in one of my tests

Ok, that is the Question/Issue you have to solve: why does a Windows x64 Installation doesn't run a x64 Application?
The Installer (as the Plugin itself) is compiled for x64, so I have no Idea why Windows would say it is not compatible to x64.
(You may find Solutions explaining that is because an App was compiled with "Debug" - that is also not the Case)

Maybe it is "just" some form of File Corruption - with all that testing: you did download a fresh copy of the Installer, right?

Ok, that is the Question/Issue you have to solve: why does a Windows x64 Installation doesn't run a x64 Application? The Installer (as the Plugin itself) is compiled for x64, so I have no Idea why Windows would say it is not compatible to x64. (You may find Solutions explaining that is because an App was compiled with "Debug" - that is also not the Case)

Maybe it is "just" some form of File Corruption - with all that testing: you did download a fresh copy of the Installer, right?

Yep, I downloaded it again on my sim PC, but also I downloaded from GitHub on each of the installations I tested in my other PCs, is it possible that the copy of the installer may be corrupted in the GitHub server and not after I downloaded it?

I have a test pending, consisting of installing a VM on VirtualBox, but currently I only have Linux installers and it seems I can't download an evaluation copy from Microsoft (apparently they have "technical problems". Because it really blows my head that I had the same problem on three different PCs, where the only thing in common is the Spanish language (two of them are Pro, the other is Home, current version is different in the Pros, AV SW is also from different vendors...)

And just one more thing.

I finally managed to prepare a control for my lights based on built-in lua. As there are 10 different light controls, placing a plus and less buttons for each light was too space consuming, so what I did is that pushing each of the gauge indicators which displays current intensity (you can see them in the figure above) you "select" one light, then you press + or - to brighten or dim that "selected" light. This is working.

What I would like to have some kind of indication of which light is selected at each time, ideally by change the outer rectangle colour, but I don't know if that would be possible. I find several problems:

  • Reading the selected option; ok I can make a function returning the value and update it using a Global LUA, but may I use it to change any format?
  • Changing the format; I'm using gauges, and the only format depending gauges I saw is "Switch Gauge Color On Value", but I don't think is what I'm looking for.

Any idea?

What I forget to ask: Did you check if the .NET Framework is installed (minimum 4.7.2)?


and it seems I can't download an evaluation copy from Microsoft

Didn't hear that the Media Creation Tool was discontinued?

is it possible that the copy of the installer may be corrupted in the GitHub server

no


Any idea?

Lua, X/Internal Variables, Composite Action.

Apparently you already have some Form of Knowledge to determine which Light is selected in the Lua-Script (which is global for unknown Reasons). This Knowledge or rather State could be shared plugin-wide with an X Variable. A Composite Action with Primitive Element + different Color Manipulators and a Gauge Element + different Indicator Manipulators with Conditions could use that Variable to indicate the selected Light.

Version 0.8 solved all problems :)

Didn't really change anything important, but great to hear the Problem is resolved ^^