Starfinder Playlist
  1. #1

    Client Side Event Handling

    Hi All,

    I am trying to write one extension to automate staff on Client side, but have couple understanding questions:

    1) Is it true that Server(GM) is handling all rolls / saves / damage application to the PCs/NPCs ?

    2) If yes, when PC (Client) has rolled for damage, does Server notify client that it was HIT/MISS in any other way than just Chat Message ?

    3) If no, is there a way to intercept a Chat Message and execute code on delivery? Something like "onReceiveChatMessage"?

    4) Is there any way to code the Client to react to an event? Can Server request Client to act (e.g. send OOB Message to Client)?


    Thank you in advance!

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,361
    You don't mention which ruleset you're looking at. Some rulesets can do this code differently.

    I'll give some high level answers, and I'll assume the 5E ruleset.

    1) I wouldn't say *all* rolls, but most of them. This is so that data a player (client) side doesn't have access to can be used as needed, and also changes to data the client doesn't own can be made.

    2) It depends on the ruleset and the roll. For an attack it does send, via OOB messaging, the chat results to all the clients. For damage it will apply damage to the targets appropriately and then send chat messages. Effects could also be processed and removed as part of actions, but these might not be via OOB messaging, they could be local.

    3) Look at the OOB messaging events defined here: https://fantasygroundsunity.atlassia...iverOOBMessage You'll also need to look at what OOB messaging is being used in each action - see the ruleset scripts\manager_action_XXXXX.lua files - the OOB messaging is setup in the onInit function of those scripts. Depending what you're trying to do, you may need to override some of the functions in these scripts.

    4) See #3 above.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  3. #3
    Hi Trenloe,

    Thank you for quick and very thorough reply. I was indeed looking into 5E ruleset.

    I would like to try to go the easier route first and intercept "chatwindow.onReceiveMessage" on the Client Side as per (https://www.fantasygrounds.com/refdo...ReceiveMessage)
    However, I do not understand how do I do that. "chatwindow" is not a global variable and non of the ruleset scripts has any mention of "onReceiveMessage".

    Thanks again in advance!

  4. #4
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,361
    That API reference is specific to the chatwindow control. This control is created in the CoreRPG ruleset - which 5E is layered on top of. The template used is basicchatwindow which is in desktop\template_desktop.xml The script attached to the chatwindow control is desktop\scripts\chat_window.lua - you could layer a script on top of this and contain an onReceiveMessage function.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
5E Product Walkthrough Playlist

Log in

Log in