PDA

View Full Version : table rows creating a formatted story entry



skj310
January 28th, 2019, 11:50
Hello FG support peoples. I'd like to create rows within a table generator that will allow me to output chat bubbles (i.e. <frame></frame> to a story entry).

As it stands now I can format the table's row to do most things

<p></p>
<h></h>
<b></b>
<i></i>

All the above work and give me alot of flexibility to create an easy to read story entry, the only missing part is the chat bubble.

Am currently thinking this isn't possible as I've tried to make it so from a variety of fronts, but am hoping there's a way i've not explored.

Zacchaeus
January 28th, 2019, 14:12
You want to do this with a story template. A story template will allow you to output entries generated from tables in a chat bubble. See this video for further help (https://www.fantasygrounds.com/forums/showthread.php?37400-Video-on-Story-Templates).

skj310
January 28th, 2019, 16:27
You want to do this with a story template. A story template will allow you to output entries generated from tables in a chat bubble. See this video for further help (https://www.fantasygrounds.com/forums/showthread.php?37400-Video-on-Story-Templates).


a good thought, but no. I know about that and it isn't what I'm looking to do. I have a table of riddles, and I want results to output to a story entry, with a chat bubble around the riddle and the answer outside the bubble. so I can read the riddle as a cool sphinx NPC, let the players stew over it for a few minutes then press the chat bubble trigger to throw it into the chat window.

this is just 1 example of what I do with tables, and so having formatted story entry results, makes life easier.

make more sense now?

Talyn
January 28th, 2019, 16:38
Tables won't contain the custom tags that have functions, such as <frame>.

There are two solutions I've seen:
1) Just put the text in the table results like normal. When you roll the table, grab the text result and drop it right back into the chat window and it outputs to the players.
2) Make a separate Story page for each section of text, and put the text in a <frame>, and link each Story page in the table results.

skj310
January 28th, 2019, 16:51
Nice!

1, yup doing that now
2, ack! that's alot of work!

was hoping there was a secret I didn't yet know.

ProNobis
January 28th, 2019, 17:19
There is another way, but it is highly advanced. If you are not comfortable editing XML you can corrupt the database really easy doing this. Due to your posts in the Discord server... I think you can handle it so I'll post it here.

All FG rollable tables default to type "string" for the results. If you change this to type "formatted text" then it becomes capable of letting you put other things inside of it (such as the frame comment). Here is a working example:
<storytemplate>
<id-00001>
<name type="string">Temporary</name>
<text type="formattedtext">
<p>[000 Temporary]</p>
</text>
</id-00001>
</storytemplate>
<tables>
<id-00001>
<dice type="dice"></dice>
<hiderollresults type="number">0</hiderollresults>
<mod type="number">0</mod>
<name type="string">000 Temporary</name>
<notes type="formattedtext">
<p></p>
</notes>
<resultscols type="number">1</resultscols>
<table_positionoffset type="number">0</table_positionoffset>
<tablerows>
<id-00001>
<fromrange type="number">1</fromrange>
<results>
<id-00001>
<result type="formattedtext">
<frame>What goes up but not down?</frame>
<frame>Answer</frame>
</result>
<resultlink type="windowreference">
<class></class>
<recordname></recordname>
</resultlink>
</id-00001>
</results>
<torange type="number">1</torange>
</id-00001>
</tablerows>
</id-00001>
</tables>
Please remember that FG has a simple way of fixing data corruption... deleting all entries of the story type. As such do NOT attempt this if you are not comfortable with XML. Also always make a backup before attempting.
If you are distributing this content to others, I highly recommend that you start each formattedtext table name with "Debug - " as it will let them know that they are not supposed to be editing it directly.

Bidmaron
January 29th, 2019, 00:36
My generators extension did what you want, but alas it is not compatible with 3.3.7, and I have not yet had time to fix it.

skj310
January 29th, 2019, 08:51
ok here i go with explaining what i have in place ...
Module 1 talks about an encounter with a sphinx NPC that the players may visit various times for various reasons. This sphinx loves to test adventurers mettle with her riddles, as many times as she can get away with (the ancient turd)! So I have a story entry as follows (thank you Kobold Press "Southlands" campaign setting):
https://www.fantasygrounds.com/forums/attachment.php?attachmentid=26145&d=1548750913

As you can see there's a link in that story, which in turn opens a story template:
https://www.fantasygrounds.com/forums/attachment.php?attachmentid=26146&d=1548750932

This story template is simply calling a table, where each row calls another nested table (thank you Raging Swans "So What's the Riddle Like Anyway?"):
https://www.fantasygrounds.com/forums/attachment.php?attachmentid=26147&d=1548750949

The end result of clicking the Story Templates Generate button is a formatted story like this:
https://www.fantasygrounds.com/forums/attachment.php?attachmentid=26148&d=1548751016

As you can see the riddle portion is within a comment/chat/story bubble that I can share with the players, after I let them stew for a bit after putting on my very best mysterious, female, sphinx voice. Notice the answer is in bold below the bubble, thus private from the player's eyes.

So what to do? Well you need XML tweaking savviness, as mentioned by the goodly ProNobis above. Savvy cause messing with db.xml for a module can have dire consequences, so BACKUP MATE, backup!

Here's a tweaked portion for one of the nested tables referenced in the 3rd image above.

<id-00004>
<description type="string"></description>
<dice type="dice"></dice>
<hiderollresults type="number">0</hiderollresults>
<locked type="number">1</locked>
<mod type="number">0</mod>
<name type="string">Riddles-Elements</name>
<notes type="formattedtext">
<p></p>
</notes>
<output type="string">story</output>
<resultscols type="number">1</resultscols>
<table_positionoffset type="number">0</table_positionoffset>
<tablerows>
<id-00001>
<fromrange type="number">1</fromrange>
<results>
<id-00001>
<result type="formattedtext">
<frame>
I am always hungry, I must always be fed.<br>
The finger I lick will soon turn red.<br>
</frame>
<p></p>
<p><b>A: Fire</b></p>
</result>
<resultlink type="windowreference">
<class></class>
<recordname></recordname>
</resultlink>
</id-00001>
</results>
<torange type="number">1</torange>
</id-00001>
<id-00002>
<fromrange type="number">2</fromrange>
<results>
<id-00001>
<result type="formattedtext">
<frame>
Three lives have I.<br>
Gentle enough to soothe the skin,<br>
Light enough to caress the sky<br>
Hard enough to crack rocks.<br>
What am I?<br>
</frame>
<p></p>
<p><b>A: Water</b></p>
</result>
<resultlink type="windowreference">
<class></class>
<recordname></recordname>
</resultlink>
</id-00001>
</results>
<torange type="number">2</torange>
</id-00002>

skj310
January 29th, 2019, 08:53
oh and ignore the <br> in the post above's bubble ... that was just me trying to see if i could format even further with a bubble (i.e. <frame>) ... clearly it didn't work.

Bidmaron
January 30th, 2019, 11:48
Thanks for sharing, skj310