PDA

View Full Version : Can I store an object in a text description?



alloowishus
August 15th, 2023, 03:16
Basically I want to store an object that I parse in object notation in the "notes" section of an item. For example something like:

{spell : {spelllist:"Spirit Mastery",spellname:"Sleep V"}}

so I can reference by something like spell.spelllist

I think this would easier than complicated string parsing. Is this possible? Thanks.

Trenloe
August 15th, 2023, 10:38
It's possible if you code for it. You'll have to specifically look for the format you decide one (hopefully a format that won't be used by something else) and then write code to parse the text in that format.

However, if the notes section is a formatted text field, you can store links to other FG records directly in the field, see the formattedtext control "linklist" and "link" internal representation: https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996645025/formattedtextcontrol

To see the exact format, drag a record to a formattedtext field and look in the database. For example:


<text type="formattedtext">
<p>This is a link:</p>
<linklist>
<link class="imagewindow" recordname="image.id-00011@FG Battle Maps">Image: BattleMap04</link>
</linklist>
</text>

https://www.fantasygrounds.com/forums/attachment.php?attachmentid=58554