Starfinder Playlist
  1. #1

    Create a link for recordname and send it via Comm package

    Hey everyone,

    I am trying to create a message via the Comm package (https://fantasygroundsunity.atlassia...996644567/Comm) that is supposed to have a link to a record from a module.

    I am aware that I could drag an item/object inside Fantasy Grounds into the chat box for everyone or on a character portrait to share it individually.
    However I specifically want to include the link in a message.

    It can be assumed that I am the GM and that I own and have shared the module/data in question.

    Up to this point I am able to send messages with the Comm package successfully. When trying to send a link it ends up as a string in the chat box but not as a link to the data.

    When scrolling through modules and their xml files the most promising entry I have found yet would be:
    Code:
    <link class="template" recordname="reference.data.nameOrID@moduleName" public="true">
        <b>Type of Template: </b>Full Written Name of Module</link>
    Is there any chance or trick that I could add that reference/link in a chat message?

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    Sorry, this is super quick as I'm short on time.

    The comm message structure has a "shortcuts" LUA table. Here's some code I have in development for the PFRPG2 ruleset:

    Code:
    		local msg = ChatManager.createBaseMessage(ActorManager.resolveActor(nodePower.getChild(".......")));
    		msg.text = "Activity used = " .. sactivitySymbolText .. " " .. getDescription();
    		msg.font = "reference-r";
    		
    		-- Add a shortcut to the activity in chat.
    		msg.shortcuts = {};		
    		table.insert(msg.shortcuts, { description = "", class = "reference_activity", recordname = nodePower.getPath() });
    		-- Make the node public so that non-owning players can click the shortcut in chat.
    		if Session.IsHost then
    			DB.setPublic(nodePower, true);		
    		else
    			PCActivitiesManager.notifySetActivityPublic(nodePower);		
    		end
    		
    		Comm.deliverChatMessage(msg);
    There's additional code in there to share the link record if it's not available to all players, but the main thing you want to look at is the table.insert(msg.shortcuts... code.
    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
    Hey Trenloe,

    perfect answer and remarkable flawless for being short on time!

    It literally was exactly what I needed!

    Thank you so much!

    MOD: Thread moved to Workshop
    Last edited by LordEntrails; January 27th, 2023 at 22:42.

  4. #4
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    Quote Originally Posted by Waylander322 View Post
    Hey Trenloe,

    perfect answer and remarkable flawless for being short on time!

    It literally was exactly what I needed!

    Thank you so much!
    Great! Glad it worked.
    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!

  5. #5
    Could such a link be used to automate a roll, like a parry or evasion to an attack?

  6. #6
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    Quote Originally Posted by Mephisto View Post
    Could such a link be used to automate a roll, like a parry or evasion to an attack?
    The link opens a window with a specific FG windowclass and a FG database record. In theory you could put code in a custom windowclass to carry out a FG action and then close the window. But this would have to be done in an extension, it's not like a drag/drop action in the hotkey bar.
    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
  •  
DICE PACKS BUNDLE

Log in

Log in