PDA

View Full Version : Script add to Description Linklist?



pr6i6e6st
January 12th, 2021, 18:56
Hey guys. Small question. I'm working on an extension that generates a list of spells from your campaign. I want to take that list of generated shortcuts/links and have it automatically added to an "Item" in the description field of the item. Is there a function I can call upon to do this already? Getting the path of the "description" fields "linklist" and adding nodes or creating windows in it doesn't appear to be working out for me. There must be an "addLink()" function or something for formattedtext fields, no?

thanks for any help, in advanced!

Trenloe
January 12th, 2021, 19:05
As formattedtext controls can have all sorts of markup and formatting, there is no API calls available to do what you want. All you can do is get the current value, modify that with the FG formattedtext markup as required, and then setValue with the modified data. This is only possible when using a formattedtextfield (not the base control which isn't tied to a database field) as getValue and setValue is only possible against the database node the control is tied to.

pr6i6e6st
January 12th, 2021, 19:15
As formattedtext controls can have all sorts of markup and formatting, there is no API calls available to do what you want. All you can do is get the current value, modify that with the FG formattedtext markup as required, and then setValue with the modified data. This is only possible when using a formattedtextfield (not the base control which isn't tied to a database field) as getValue and setValue is only possible against the database node the control is tied to.

ok. so, could this be edited via script then? much like how one could put a <p> to create a new paragraph?



<text type="formattedtext">
<p>Pugilists in the Arena Royale fight club travel the world earning their keep as equal parts performer and gladiator. Whether performing in staged physical competitions, or fighting it out in unscripted brawls, pugilists in the Arena Royale care as much about the theatrics of a fight as they do its outcome. Pugilists in this fight club also care deeply about their reputation and work to build up local and regional legends about their performing personas.</p>
<p />
<linklist>
<link class="reference_classfeature" recordname="class.id-00002.features.id-00021">Bonus Proficiency</link>
</linklist>


Edit: so I’d create the description string like “This is a spellbook with x number of spells <p><linklist><link class=reference_classfeature" recordname="” .. sPath ..”">” .. sName ..”</link>
</linklist>” and set the value.

Trenloe
January 12th, 2021, 20:01
I’d create the description string like “This is a spellbook with x number of spells <p><linklist><link class=reference_classfeature" recordname="” .. sPath ..”">” .. sName ..”</link>
</linklist>” and set the value.
Kinda of (your tags aren't fully correct - you have an unclosed <p> ) - so make sure that the tags are 100% valid, and the whole data is within <p> </p> tags.

pr6i6e6st
January 12th, 2021, 20:48
got it! beautiful! thank you again Trenloe!