PDA

View Full Version : Affecting Clients



Nickademus
March 23rd, 2017, 11:03
How do you have the GM host cause a change in all of the player clients. For instance, say there is a button in a window on the GM host client. When it is clicked, a change should occur in the window of a different windowclass on each of the player's clients. Interface.findWindow could get the window of the specific windowclass, but I think that would only be on the GM client. How do I cross over to the scope of the player's clients?

Trenloe
March 23rd, 2017, 13:40
You can't suddenly directly control/access the GUI from code running on the GM side. The best way is to change a database field that is public and available to all players, and have an onUpdate event registered on all player instances that will trigger some code.

Or, you could look at using OOB messaging to trigger code running on other instances.

Either way, nothing will be passed back to the GM and the GM code will not pause to see if anything has happened on the client side. All you can do is write further handlers or OOB code. You've moved into the real of asynchronous code which can get very complex.

Nickademus
March 23rd, 2017, 20:55
I don't need anything passed back to the GM client. Just need to fire a function on the clients.

I looked at the Comm package which tells how to do OOB messaging, but I'm not really sure what it is still. Is there another page that talks about it on the wiki or in these forums?

My fallback plan was indeed to put an onUpdate function on the players' list of data that the GM button would be interacting with. I was hoping for something more direct and built in like the Comm.deliverChatMessage.

Trenloe
March 23rd, 2017, 21:00
If you just want to initiate something on the clients then OB messaging is fine.

You're best bet is to look at examples within the current code. A lot of the action managers in the scripts directory use OOB messaging.

Moon Wizard
March 24th, 2017, 04:40
The OOB messages are a way to pass any arbitrary messages between clients without it being displayed in the chat box. As Trenloe mentioned, there are several examples in the Action scripts used in 3.5E and 5E.

Regards,
JPG