PDA

View Full Version : How to give client host privileges



MyGivinOpinion
March 25th, 2019, 15:37
Can I run a single procedure in lua with higher permission than the client has but only for that function(similar to run as admin)?

The code works fine on host side, but returns nil values as a client.

I need help in giving the client permissions as a host within the function.

My buddy says that I need to use OOB, but can't seem to grasp it.

Andraax
March 25th, 2019, 15:40
Yeah, OOB basically has the client send a message to the host, the host then performs the action and sends the result back to the client.

Trenloe
March 25th, 2019, 16:42
Yep, OOB messaging.

Do a find in files search for "OOB" in your chosen ruleset and you'll see some examples.

You'll need
1) Your OOB message name and corresponding function name registered with OOBManager.registerOOBMsgHandler usually in the onInit() function of a LUA script file.
2) Within the client side code that needs to trigger the process, set the data that needs to be passed in the msgOOB LUA table, including the msgOOB.type which ties in the handler name used in step #1. Then call the OOB message handler using Comm.deliverOOBMessage(msgOOB)
3) The handler function registered to the msgOOB.type in #1 then executes on the GM side - use the data stored in msgOOB to do the needed operation.

MyGivinOpinion
March 25th, 2019, 18:26
For step 2 is it possible to send an entire function as the data for the GM to process?

Trenloe
March 25th, 2019, 18:45
For step 2 is it possible to send an entire function as the data for the GM to process?
I'm guessing probably not - I've had issues sending more complex data in the past (for example, a database node object (https://www.fantasygrounds.com/refdoc/databasenode.xcp), and had to send a text reference to a DB node location and then get the database node from that in the handler function).

You'd probably have to control the exact code to run in the handler function.

MyGivinOpinion
March 25th, 2019, 23:23
@Trenloe, May I message you privately about this further?

Trenloe
March 25th, 2019, 23:45
@Trenloe, May I message you privately about this further?
If it’s a general discussion about FG coding I’d prefer it in the forums so others can contribute and also learn. Private messages, for me, should be related to private topics directly addressing me or specific topics that can’t be discussed publicly - see the comment in my signature. Hope you understand. If your need to message me is indeed private, then please go ahead and PM me...