Amaniera Posted March 19, 2020 Report Posted March 19, 2020 Hello Pete, I'm trying to read variables of GSX but the values return always 0 (sometimes it's work). This is my code : GSXNumPassengers = ipc.readLvar("L:FSDT_GSX_NUMPASSENGERS_BOARDING") ipc.display(GSXNumPassengers) I also test : GSXNumPassengers = ipc.readLvar("FSDT_GSX_NUMPASSENGERS_BOARDING") but have the same result. ipc.display(GSXNumPassengers) How can I read GSX variables correctely and that the values are updated ? Thank you in advance.
Pete Dowson Posted March 19, 2020 Report Posted March 19, 2020 34 minutes ago, Amaniera said: I'm trying to read variables of GSX but the values return always 0 (sometimes it's work). Sorry, but I don't know anything about GSX L:Vars, nor therefore how they behave. Why don't you use the FSUIPC assignable control to list all L:Vars and their current values, or, possibly better, runthe supplied Lua plug-in called "Log LVars.lua" which will display them as they change. This way you can double-check your own Lua plug-in. Pete
Amaniera Posted March 19, 2020 Author Report Posted March 19, 2020 Thanks a lot Pete. I study Log LVars.lua It will be a great help for me. Best regards. Patrice
spokes2112 Posted March 19, 2020 Report Posted March 19, 2020 Don't have GSX either but have read that, and also experienced in other modules, that the L:Var isn't created in the gauge system until ready to use for the first time. Wish I knew how they did that. )) In any case the lua may fail if dealing with strings, or keep running and return zero. You could try something like this: GSXNumPassengers = ipc.readLvar("FSDT_GSX_NUMPASSENGERS_BOARDING") if GSXNumPassengers = 0 or GSXNumPassengers = nil then ipc.display("Passenger loading hasn't started") else ipc.display(tostring(GSXNumPassengers) .. " passengers are boarding on this flight.") end Roman
Amaniera Posted March 19, 2020 Author Report Posted March 19, 2020 Thanks a lor spokes. I'll try this. Best regards, Patrice
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now