Jump to content
The simFlight Network Forums

Reading GSX datas


Recommended Posts

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.

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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
 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.