Jump to content
The simFlight Network Forums

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.

Share this post


Link to post
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

 

Share this post


Link to post
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
 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • 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.