DICE PACKS BUNDLE
Page 1 of 2 12 Last
  1. #1
    LordEntrails's Avatar
    Join Date
    May 2015
    Location
    -7 UTC
    Posts
    18,174
    Blog Entries
    9

    Story Templates not Generating Unique Values

    So I've got a Story template that is trying to make multiple calls to a table, but each time FG returns the same result from the table. The key is that I'm using a callout to an internal reference https://fantasygroundsunity.atlassia...-%5B%3Ca%3E%5D

    i.e. the template calls out a table (Primary Star Class). One of the columns of the first table has a letter in column one (star class). Then there are additional tables (Zone Population x) with the various star class values for x. The intent is that the story should call upon the same zone population table multiple times to get unique values off that table. But, it doesn't do that, each value is the same. And this is repeatable with multiple stories being generated and multiple story templates being used.

    Example;
    Screenshot 2025-02-15 125734.png
    Last edited by LordEntrails; February 15th, 2025 at 20:20.

    Problems? See; How to Report Issues, Bugs & Problems
    On Licensing & Distributing Community Content
    Community Contributions: Gemstones, 5E Quick Ref Decal, Adventure Module Creation, Dungeon Trinkets, Balance Disturbed, Dungeon Room Descriptions
    Note, I am not a SmiteWorks employee or representative, I'm just a user like you.

  2. #2
    tjlee's Avatar
    Join Date
    May 2021
    Location
    Pacific Northwest
    Posts
    39
    I'm able to reproduce using the CoreRPG Story Template engine: CoreRPG_Repro.PNG

    Shameless Plug: My Story Template Enhanced (extension) works as expected: StoryTemplateEnhanced.PNG

    I know why too - the CoreRPG template evaluation performs a global substitution on all matches of the expression under evaluation, so when it evaluates the first [Zone Population #Primary Star Class|1#] table callout, it replaces all of the same expression with the same value. Not an easy fix without rewriting the parser like I've already done.

    A potential work-around is to do something like [2x][Zone Population #Primary Start Class|1#] which tells the story template to roll twice against the table.
    However, CoreRPG doesn't honor the [2x] in this case (didn't investigate why) while my extension does with the results appearing concatenated all on one line: NoWorkAround.PNG

    With my extension, you can modify the story template or table data so that [2x][...] works as expected and the output is on separate lines - more than one way to to solve the problem.

    Here's a potential work-around, but as you can see, CoreRPG still does the unexpected while my extension produces expected results: WorkAround.PNG

    I put the [Zone Population #Primary Star Class|1#] in a new table named Formatted Population and use the [2x] multiple roll directive in the template to call it twice. I've embedded the line item HTML tags surrounding the table callout <li>...</li>, hence the bullet points in the resulting output. We see in the CoreRPG evaluation of the template, it honors the [2x] directive but repeats the same value while my extension once again produces expected results.

    An unsavory work around that works for CoreRPG would be to replicate the [Zone Population X] tables by giving them unique names like [Zone Population X 2], [Zone Population X 3] and then for each time you want to get different results in the story template, you add a line that calls a different version of the same table like so:

    [Zone Population #Primary Star Class|1#]
    [Zone Population #Primary Star Class|1# 2]
    [Zone Population #Primary Star Class|2# 3]
    etc.

    Since the template expressions are different, they won't get replaced with the same values (unless they coincidentally roll the same values).
    Last edited by tjlee; February 16th, 2025 at 22:14.

  3. #3
    LordEntrails's Avatar
    Join Date
    May 2015
    Location
    -7 UTC
    Posts
    18,174
    Blog Entries
    9
    Thanks TJ I appreciate you looking at this and diving in so deep. Since these tables will be for an official conversion I'm trying to use core functions to get as close as I can. I was wondering if the custom name callouts (:a:b) or the internal callout internal rolling [:[a] [b]:c] might provide a work around. But since I don't understand those yet, (lol) I haven't gotten there yet.

    Doug, Moon or Carl, any thoughts if this is some behavior you might look to change/update/fix?

    Problems? See; How to Report Issues, Bugs & Problems
    On Licensing & Distributing Community Content
    Community Contributions: Gemstones, 5E Quick Ref Decal, Adventure Module Creation, Dungeon Trinkets, Balance Disturbed, Dungeon Room Descriptions
    Note, I am not a SmiteWorks employee or representative, I'm just a user like you.

  4. #4
    Much as I would love to use your extension tjlee I am using Story Templates in products for the Store, so I can't use an extension. If your system is less of a mind bender (Lord Entrails seems to think it is) than the current implementation (which is very powerful but requires a lot of though to get your head into) maybe Smiteworks should incorporate your extension into FG and make our lives easier.
    Savage Rifts© on Fantasy Grounds Store
    Ultimate Edition Fantasy Grounds - ONLY ON Linux
    Twitch Channel

  5. #5
    Quote Originally Posted by LordEntrails View Post
    So I've got a Story template that is trying to make multiple calls to a table, but each time FG returns the same result from the table. The key is that I'm using a callout to an internal reference https://fantasygroundsunity.atlassia...-%5B%3Ca%3E%5D

    i.e. the template calls out a table (Primary Star Class). One of the columns of the first table has a letter in column one (star class). Then there are additional tables (Zone Population x) with the various star class values for x. The intent is that the story should call upon the same zone population table multiple times to get unique values off that table. But, it doesn't do that, each value is the same. And this is repeatable with multiple stories being generated and multiple story templates being used.

    Example;
    Screenshot 2025-02-15 125734.png
    I got this way to work...is this what you are looking for?

    For your "ST Test" template:

    Code:
    [Primary Star Class]
    
    [:Zone Population #Primary Star Class|1#:Object1]
    
    [:Zone Population #Primary Star Class|1#:Object2]
    See result in image:
    Table LordEntrails.jpg

    "Object1" and "Object2" can be any unique name you want.

    EDIT:
    To add to the above, using the : commands also holds the rolled value to that name for use on the generated story.
    For example:

    Code:
    [Primary Star Class]
    
    Roll 1 - [:Zone Population #Primary Star Class|1#:Object1]
    
    Roll 2 - [:Zone Population #Primary Star Class|1#:Object2]
    
    This will also hold the value rolled so that you can use it elsewhere in the Generated Story, as any times as you want.
    
    Roll 1 result again = <Object1>
    
    Roll 2 result again = <Object2>
    
    <Object1>
    
    <Object1>
    
    
    
    <Object2>
    
    <Object2>
    See result in image:
    Table LordEntrails2.jpg
    Last edited by Marmus; February 16th, 2025 at 16:53.

  6. #6
    tjlee's Avatar
    Join Date
    May 2021
    Location
    Pacific Northwest
    Posts
    39
    Yes, that’s the work around LordEntrails is looking for.

    The assignment to store into Object1 and Object2 makes the expressions different so they get evaluated separately.

  7. #7
    LordEntrails's Avatar
    Join Date
    May 2015
    Location
    -7 UTC
    Posts
    18,174
    Blog Entries
    9
    Thank you Marmus! Really appreciate you figuring this out for me. Will post the final once I get it updated

    Problems? See; How to Report Issues, Bugs & Problems
    On Licensing & Distributing Community Content
    Community Contributions: Gemstones, 5E Quick Ref Decal, Adventure Module Creation, Dungeon Trinkets, Balance Disturbed, Dungeon Room Descriptions
    Note, I am not a SmiteWorks employee or representative, I'm just a user like you.

  8. #8
    LordEntrails's Avatar
    Join Date
    May 2015
    Location
    -7 UTC
    Posts
    18,174
    Blog Entries
    9
    Here's what it looks like for those who want to see what I was hoping to get to.

    Now to see if I can get FG to multiply two numbers together to populate the Stellar mass value. And after that to see how I want to handle generating the orbital distances from a range of AU's based upon the Star's Stellar Mass.
    Screenshot 2025-02-16 125548.png

    Problems? See; How to Report Issues, Bugs & Problems
    On Licensing & Distributing Community Content
    Community Contributions: Gemstones, 5E Quick Ref Decal, Adventure Module Creation, Dungeon Trinkets, Balance Disturbed, Dungeon Room Descriptions
    Note, I am not a SmiteWorks employee or representative, I'm just a user like you.

  9. #9
    LordEntrails's Avatar
    Join Date
    May 2015
    Location
    -7 UTC
    Posts
    18,174
    Blog Entries
    9
    Well, this is as far as I got. I think I will be happy with it unless someone has some more ideas.
    Screenshot 2025-02-16 175542.png

    The part I don't think can be done with core is to use the results from one of the columns of the first table and use it to populate the call of the second table and return just a specific column from that second table. I can get the column call from the first table to define the name of the second table, but as soon as you try to call a column from the second table which is defined with the previous colum result, FG doesn't return anything. See the couple of example/tries below.
    Screenshot 2025-02-16 180009.png

    If anyone has an idea on that, much appreciated, othersie I will just do some manual reformatting once the results from the first image are done.

    Problems? See; How to Report Issues, Bugs & Problems
    On Licensing & Distributing Community Content
    Community Contributions: Gemstones, 5E Quick Ref Decal, Adventure Module Creation, Dungeon Trinkets, Balance Disturbed, Dungeon Room Descriptions
    Note, I am not a SmiteWorks employee or representative, I'm just a user like you.

  10. #10
    Quote Originally Posted by LordEntrails View Post
    Well, this is as far as I got. I think I will be happy with it unless someone has some more ideas.
    Screenshot 2025-02-16 175542.png

    The part I don't think can be done with core is to use the results from one of the columns of the first table and use it to populate the call of the second table and return just a specific column from that second table. I can get the column call from the first table to define the name of the second table, but as soon as you try to call a column from the second table which is defined with the previous colum result, FG doesn't return anything. See the couple of example/tries below.
    Screenshot 2025-02-16 180009.png

    If anyone has an idea on that, much appreciated, othersie I will just do some manual reformatting once the results from the first image are done.
    You lost me at "the part I don't think.can be done"... 🤣
    Savage Rifts© on Fantasy Grounds Store
    Ultimate Edition Fantasy Grounds - ONLY ON Linux
    Twitch Channel

Page 1 of 2 12 Last

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
  •  
Cosmere RPG Beta Launch

Log in

Log in