5E Character Create Playlist
Page 1 of 2 12 Last
  1. #1

    Is this possible with an extension?

    Can an extension add this functionality to story templates? I am just wondering if it is even theoretically possible?

    Basically, I want to roll once on a main table, and then reference the previously rolled columns individually a-la-carte afterwards.

    Table Extention Query.JPG

  2. #2
    Not sure what your trying to achieve? But I think it could be done.

    Remember You can nest tables too, if that would help??
    "When questing once in noble wood of gray medieval pine, I came upon a tomb, rain-slicked, rubbed cool, ethereal, its inscription long vanished, yet still within its melancholy fissures."

  3. #3
    Nope- nesting tables doesn't work for recalling usable data within a story template.

    I want to call a table with several columns, then individually use the results of that initial table roll's individual column results later. The implications of being able to achieve this would blow the roof off my story templates! In the attached picture from the first post, you can see the table, the story template, and the generated result. I am wondering if an extension COULD be made which makes the <Star Type|2> reference work as I want it to in this example picture. Namely, if it worked the way I am looking for then the generated story would replace that reference with "AIII" in this instance, since that was the result from column 2 when the entire table was previously rolled.

  4. #4
    LordEntrails's Avatar
    Join Date
    May 2015
    Location
    -7 UTC
    Posts
    17,151
    Blog Entries
    9
    Sure, but you would have to re-write the table functionality. Paramaterize everything, and write the LUA so that all those parameters can be stored. And determine how long they should be stored for.

    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.

  5. #5
    I figured it had more to do with the output of the tables themselves than the story templates (though I assume story template code would have to be altered some too, in order to parse the altered output of the tables). I am thinking the values shouldn't be stored past the generation of the result from the template? Once the story is successfully generated, the storage locations get cleaned out? I can't imagine needing them past that point, and that could free up the space for the next table's data. Also, only table output when requested from story template needs to be altered, all others can stay the same.

    WAIT! Normally, when a table with several columns outputs to a story, the result ends up with semi-colons between column data! Maybe it's possible to keep table output as-is, but have the story template store the output into "columns" using the semicolons as a de-limiter!? This would mean using semicolons in your text would be off limits, but that's a teeny price to pay. So, here's the idea (tell me if I am crazy!):

    Within the story template, you type: [Test Table] The Test Table has two columns that say: Column one: ONE Column two: TWO. Normally, when generated this would output in the resulting story entry as: ONE; TWO. So, we alter the story template to take the results of a given table's output, in this case [Test Table], and look for semicolons in the output. If it finds it, it stores each in a location that can be called with <Test Table|1> and <Test Table|2>. In this case, thereafter calling <Test Table|2> would output only: TWO. The storage solution for this could be very similar to how the data for previously rolled tables is already handled.

  6. #6
    LordEntrails's Avatar
    Join Date
    May 2015
    Location
    -7 UTC
    Posts
    17,151
    Blog Entries
    9
    You're crazy.
    But your idea is sane
    Still would require an extension though!

    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.

  7. #7
    Unless you expect to need to regularly change the table data you might do better to just build an extension with the options you want rather than monkey with the table system.

  8. #8
    Anyone here know where I should start looking in the FG code for the Story Template sections?

    Sadly, the only thing I only ever learned to code poorly was C++, so looking at the lua code confounds me. I think this is something I would have to look into commissioning someone to do on my behalf... lua looks so confusing to me

  9. #9
    OK so... I enrolled in a lua class for this.

    I am already picking it up quickly enough to cause trouble, but I am also only just getting started. I have located the lua code that handles the tables in FG, but now I need to find the lua that handles the story templates and I am coming up empty handed.

    Can anyone point me to the right filename? EDIT: After looking for ages, I Found it right after posting this...

    ALSO OF NOTE HOWEVER... I found this little ditty in the FG code, which might be useful to gaze at while I figure out how to capture the incoming data from a table headed towards the story template output, and then de-limit it based on the semicolons to be stored as separate column data for later retrieval:

    Code:
    -- SPLIT CLAUSES
    --
    -- The source string is divided into substrings as defined by the delimiters parameter.  
    -- Each resulting string is stored in a table along with the start and end position of
    -- the result string within the original string.  The result tables are combined into
    -- a table which is then returned.
    --
    -- NOTE: Set trimspace flag to trim any spaces that trail delimiters before next result 
    -- string
    --
    
    function split(sToSplit, sDelimiters, bTrimSpace)
    	if not sToSplit then
    		return {}, {};
    	end
    	
    	-- SETUP
    	local aStrings = {};
    	local aStringStats = {};
    	
      	-- BUILD DELIMITER PATTERN
      	local sDelimiterPattern = "[" .. sDelimiters .. "]+";
      	if bTrimSpace then
      		sDelimiterPattern = sDelimiterPattern .. "%s*";
      	end
      	
      	-- DEAL WITH LEADING/TRAILING SPACES
      	local nStringStart = 1;
      	local nStringEnd = #sToSplit;
      	if bTrimSpace then
      		_, nStringStart, nStringEnd = trim(sToSplit);
      	end
      	
      	-- SPLIT THE STRING, BASED ON THE DELIMITERS
       	local sNextString = "";
     	local nIndex = nStringStart;
      	local nDelimiterStart, nDelimiterEnd = sToSplit:find(sDelimiterPattern, nIndex);
      	while nDelimiterStart do
      		sNextString = sToSplit:sub(nIndex, nDelimiterStart - 1);
      		if sNextString ~= "" then
      			table.insert(aStrings, sNextString);
      			table.insert(aStringStats, {startpos = nIndex, endpos = nDelimiterStart});
      		end
      		
      		nIndex = nDelimiterEnd + 1;
      		nDelimiterStart, nDelimiterEnd = sToSplit:find(sDelimiterPattern, nIndex);
      	end
      	sNextString = sToSplit:sub(nIndex, nStringEnd);
    	if sNextString ~= "" then
    		table.insert(aStrings, sNextString);
    		table.insert(aStringStats, {startpos = nIndex, endpos = nStringEnd + 1});
    	end
    	
    	-- RESULTS
    	return aStrings, aStringStats;
    end
    Hmmm... I also just found this inside the story template code:

    Code:
    	sLocalReplace = table.concat(aOutputResults, "; ");
    This seems to indicate that the story templates themselves are adding the column delimiters, and that kind of seems like the place to be fiiddling (but I could be wrong!). I would THINK that if the story template already has the data in column chunks, and then stitches it together with this line of code as glue, then this area of the code might be a good intercept point to store those column chunks into addressable locations BEFORE they get glued together. Also I might remove the stupid semicolon- it's distracting in a story template output anyways!
    Last edited by JimSocks; September 23rd, 2020 at 05:00.

  10. #10
    Ok so I am making some headway, and I have a plan. There are some mysteries yet to figure out, like on the line

    Code:
    for nStartTag, sTag, nEndTag in sOutput:gmatch("())%[([^%]]+%]()")
    I am having a Hell of a time figuring out the pattern being used with "())%[([^%]]+%]()" I get that these are pattern codes used to search the strings, but... what the hell do they actually mean all together like that? The lua reference site I have been using wasn't much help in figuring this out- any of you know?

    Also, where can I find the class defininitions for the "DB" class called here with the getValue tacked onto it:

    Code:
    sText = performTableLookups(DB.getValue(node, "text", ""));
    I'd like to take a look at what is going on under the hood of that function, but I can't find it anywhere. Hints?

    For the record, here is the plan right now: have the story template search for tables with a special character set FIRST, and resolve those tables storing any results into arrays. Next, look the template over for reference links of those tables, using the same special character sets. When a "special character set table" is referenced, insert the data stored in it's array for that location.

    Practical use: A story template has a Table to roll on, but it has a double asterisk at it's beginning, and later there are references to it using the same double asterisk:

    Code:
     [**NPC Table] 
    
    <**NPC Table|4> <**NPC Table|1> <**NPC Table|6> <**NPC Table|4>
    Here, the story template would first roll on the NPC Table, storing it's column results into an array. Next, the references to that table ACTUALLY invoke the stored strings in the array. Now, if I can pull this off it makes story templates WAY cooler. It means we can have storys make SENSE with pronouns and a million other uses. It ALSO means that since I intend to resolve these FIRST, that when the story template resumes business as usual it won't know that what it's reading MAY have been rolled results already, and that is a very cool thing with other implications. It could essentially make the following possible:

    Code:
     [**TableA] [**TableB]
    [<**TableA|1><**TableB|1>]
    In this example, whatever the first columns of TableA and TableB retrieve as results will end up within table brackets THEMSELVES, which would then be evaluated during the normal story template evaluation code. Very cool. I hope I can get it to work. I'll probably need you awesome folks as I bumble through it...
    Last edited by JimSocks; October 7th, 2020 at 05:08.

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
  •  
Starfinder Playlist

Log in

Log in