Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hello,

I am curious to know if it's possible to use the IPC.SET() to create a global on a client computer and have it read on the server computer to initiate a macro or lua script without having to use a polling timer.

Looking over the event lua library, I am not seeing one that I can use to monitor globals or any changes to them.

 

Thanks much,

James Twomey

 

 

Posted
1 hour ago, jr2mey said:

I am curious to know if it's possible to use the IPC.SET() to create a global on a client computer and have it read on the server computer to initiate a macro or lua script without having to use a polling timer.

Please see the FSUIPC Lua Library document - the ipc.set finction is documented as follows:

Quote

Stores a Lua value (any simple type -- i.e. numbers, strings, booleans) as a Global with the given name. This can be retrieved by this or any other Lua plug-in by using “ipc.get”. This mechanism provides a way for a Lua plug-in to pass values on to successive iterations of itself, or provide and retrieve values from other Lua plug-ins.

With effect from FSUIPC version 4.958, in combination with WideClient version 6.999z2, the ‘Globalness’ of these values extends between Clients and Server in a WideFS network, so can be used to communicate values and strings over the network without resorting to user offsets. This only works if Server and Clients are in the same workgroup.

Use of this should be sparing – the Windows Mailslot system is used and may not cope with excessive use very well. Also note that there is no backlog – the globals are only broadcast when being set (by ipc.set), so anything set before a client is actually running won’t be seen by it. Also the Network protocol used is not checked – messages are not guaranteed to arrive. Retries, maybe by a system of Acknowledgement values, are up to the plug-in and would be advisable in any “mission-critical” application of this facility.

Note that there are limits on the sizes for network Globalness: the variable names must not be greater than 32 characters, and string values should be no longer than 384 characters. Values outside these limits do not participate.

 

1 hour ago, jr2mey said:

Looking over the event lua library, I am not seeing one that I can use to monitor globals or any changes to them.

Given the above, why not?

John

Posted

Sorry John, I guess that I am not phrasing my question correctly. Or maybe I am and I am missing something in reading the documentation. 

examples:

event.offset(0x2744,"UB","FIRE_APU")  -- I know this monitors offset 2744 at the byte level for any changes and only performs the assigned function when a change has occurred.

For LUA globals, I am not seeing event monitor for changes in globals to perform an assigned function.

I know that i can use ipc.get(global) and do successfully change its value across a network.

But what I would like to do is execute either a macro or lua script function, based on a change in global value, without having to use a polling timer. Or am I being completely dense here.

I hope that makes better sense of what I am wanting to achieve. I do read your manuals at nauseum.... Pete beat that into my head... 🤣 ..

 

Posted
4 minutes ago, jr2mey said:

For LUA globals, I am not seeing event monitor for changes in globals to perform an assigned function.

There is no event function associated to lua globals.

5 minutes ago, jr2mey said:

For LUA globals, I am not seeing event monitor for changes in globals to perform an assigned function.

I know that i can use ipc.get(global) and do successfully change its value across a network.

But what I would like to do is execute either a macro or lua script function, based on a change in global value, without having to use a polling timer. Or am I being completely dense here.

No, you would have to use polling to do this - maybe on a timer, and use this to determine if the lua global variable value changes and then call your function. Otherwise, to use an event callback, you would have to use a free offset, i.e. write the lua variable value to a free FSUIPC offset in the server and monitor that offset in the client with event.offset.

John

Posted

Okay, got it. 

Thanks so much John.

I just wanted to make sure that I wasn't missing a capability in FSUICP LUA library.  I had suspected that I would have to do what you described.

 

Best,

James Twomey

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.