Fragtality / PilotsDeck

Directly control the FlightSim from your StreamDeck!
Other
93 stars 6 forks source link

Unable to run lua functions with built-in engine #74

Closed markhlam closed 3 days ago

markhlam commented 1 week ago

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!!

Fragtality commented 1 week ago

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?

markhlam commented 6 days ago

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

markhlam commented 6 days ago

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:

(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

Fragtality commented 6 days ago

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. 🤷‍♂️

markhlam commented 5 days ago

Nice to know the update strategy, thank you for the info.

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.

Regarding the las issue, my fault was, as you say, I didn't read the realmente, or at least not in this case. Because I used some working scripts I had, but I didn't realized they were made when the FSUIPC7 engine was in use (infortunately the only one I had composed for your engine was lost during a plugin update). So I trusted my scripts instado of going again to the referente.

Anyway, thank you for your reply!!

El jue, 24 oct 2024, 11:47, Fragtality @.***> escribió:

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 https://learn.microsoft.com/en-us/dotnet/api/system.io.filesysteminfo.lastwritetime?view=net-8.0 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 https://letmegooglethat.com/?q=lua+concatenation) Besides that: what is the Reasoning to do a simple Increment with a Lua Script instead of using the Value Manipulation https://github.com/Fragtality/PilotsDeck?tab=readme-ov-file#212---command-option? (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 https://github.com/Fragtality/PilotsDeck?tab=readme-ov-file#351---standard-scripts. 🤷‍♂️

— Reply to this email directly, view it on GitHub https://github.com/Fragtality/PilotsDeck/issues/74#issuecomment-2434803623, or unsubscribe https://github.com/notifications/unsubscribe-auth/BIPW5ZUDJLDCTEMLGJONMO3Z5C6ZJAVCNFSM6AAAAABQPI74X6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMZUHAYDGNRSGM . You are receiving this because you authored the thread.Message ID: @.***>

Fragtality commented 5 days ago

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 😉 )

markhlam commented 3 days ago

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)

Fragtality commented 3 days ago

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.

markhlam commented 3 days ago

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

Fragtality commented 3 days ago

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?!)

markhlam commented 3 days ago

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.

markhlam commented 3 days ago

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)

Fragtality commented 3 days ago

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?