Jump to content
The simFlight Network Forums

Writing to an offset


Recommended Posts

Hi Pete,

I am trying to change the value in offset 66C0, so that I can make a LED switch off or on when it's value changes. Using InterfaceIT(flightdecksolutions input\output board controller) I can make a LED light up when programmed to trigger on the value 66C0 = 0, Data type - byte. I am trying to change the offset's value when a switch is pressed.

I have used a switch which has a custom gauge that is already performing a different operation on a key press. I have simply added the ipc.write command a line below my other instruction which is an L:Var variable change . I have used the FSUIPC logging facility to monitor the offset and I can see that the value is not changing. This is the line I have added to the XML file,

ipc.writeUB(0x66C0, 1)

Any help would be very much appreciated

Thanks, Steve

Link to comment
Share on other sites

I have used a switch which has a custom gauge that is already performing a different operation on a key press. I have simply added the ipc.write command a line below my other instruction which is an L:Var variable change . I have used the FSUIPC logging facility to monitor the offset and I can see that the value is not changing. This is the line I have added to the XML file,

ipc.writeUB(0x66C0, 1)

XML file? I assume you mean Lua?

If so that should work fine. You must have something else wrong. Show me the complete file. did you check the log to see if there were errors listed for the Lua program? Enable button logging as well as your 66C0 monitoring and show me the resulting log, please.

If you are really talking about an XML gauge, then I'm afraid you are mixing up the FSUIPC plug-in Lua facilities with FS's XML facilities. They aren't the same things. FSUIPC doesn't understand XML and FS doesn't understand Lua.

Pete

Link to comment
Share on other sites

Is it possible to call a Lua script from an XML file?

Not that I know of. They are worlds apart. How can FS even understand that FSUIPC accepts Lua plug-ins?

If your XML can send a keypress to the main FS window, then you could program that keypress to execute a Lua file. But of course there's no need to have a Lua file then --- there's an Offset control assignable in FSUIPC which can write 1 to 66C0 in any case.

I'm really not understanding why your XML is processing a button press in any case. Why not program the button in FSUIPC in the first place? It can write your Lvar (e.g. via Lua) and set 66C0. What is the custom XML gauge for?

Regards

Pete

Link to comment
Share on other sites

Hi Pete,

I was using the custom gauge just as a test. I am using an add-on aircraft that does not allow certain critical switches to be operated in the VC cabin by FS or offsets. I got around this by using some custom gauges. What I am trying to do now is quite different. There is a master xml file which seems to be the core program for the aircraft. I can see how the program logic is controlling the pressure system, caution lights etc. I want to be able to communicate between this code and an offset. There are L:vars used in the code but I do not know if these can be accessed by FSUIPC or a lua script?

Thanks

Link to comment
Share on other sites

There are L:vars used in the code but I do not know if these can be accessed by FSUIPC or a lua script?

Yes, FSUIPC can write to L:vars. This is by macros, and is described in the section called

Gauge local variable access (L:vars), by macro

in the FSUIPC4 Advanced User's document -- it is actually listed in the contents.

Lua plug-ins can both read and write L:vars -- see the Lua library documentation (the ipc.readLvar and ipc.writeLvar functions). So, yes, they can be used to communicate between an XML gauge and FSUIPC4. Other Lua functions are supported for L:vars too. These are used in the example Lua plugin provded to log L:vars on screen.

Regards

Pete

Link to comment
Share on other sites

  • 2 weeks later...

Hi Pete,

I have now done everything I wanted to do with a Lua script. When a light on the master warning panel is triggered, the “master warning” lights up. I can reset the master warning which remains off unless the panel is triggered again. I understand now that I can write to L:VARS without the need for custom xml gauges. I am delighted with this result. The ipc debug script that you have included with your plug-in examples came in very useful for a Lua beginner. I am very grateful for FSUIPC.

THANK YOU

Steve

Link to comment
Share on other sites

I have now done everything I wanted to do with a Lua script ...

Great!

Do you think what you've done might be useful to others, even if only by way of a learning experience? If so, perhaps you'd like to post a copy with a few notes on the "User Contributions" subforum?

Thank you for the feedback anyway!

Regards

Pete

Link to comment
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...
 Share

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