DICE PACKS BUNDLE
Page 9 of 9 First ... 789
  1. #81
    Story Templates Order of Operations:
    The "PEMDAS"-like list below might help you to understand the "why" behind why some things work while others may not. This is how Story Templates work to parse your text and give you a beautiful Story Output- in this EXACT order. This could affect you for instance, if you try to put a column reference inside of a cross-template callout, as detailed in the post before this one. The order doesn't allow for that, because cross-template callouts are resolved first. Here is the order, in order:

    *Each of these steps is also resolved TOP to BOTTOM in your text. In other words, lines you write below are affected by/processed after the lines existing above them in your body of text, within each respective step outlined below.

    Cross Template Write in the template title area
    Cross Template Write in the main body of text


    • (so, the first two things it does is look for callouts to store cross-template values you can reference later in this same template, or in another somewhere else. NOTE that from this point on, your template will no longer have ANY cross-template callouts in it until later when a table might dredge one up. Also note how it does the title area FIRST in a lot of these operations- it treats the title almost as an entirely separate entity- and that can be used to your advantage sometimes!)


    perform Callout Storage References in the template title area
    perform Callout Storage References in the main body of text


    • (so, next it looks for references to cross-template data to replace in the text. At this point on, there will now be NO cross-template references left until later when a table might dredge one (or thirty) up.)


    replace Date in the title
    replace Date in the main body


    • (now it's looking for date callouts, and replacing them with what the user wanted)


    perform Internal Callouts in the title
    perform Internal Callouts in the main text


    • (these are looking for callouts nested within callouts, and replacing them first. ie [:a [tableA] and [tableB] inside a parent:StorageName])


    perform Internal References in the title
    perform Internal References in the main body


    • (now it's looking for references nested within any table callouts. ie: [a <tableA> and <tableB> inside a parent] NOTE: It doesn't solve these yet- it can't. Instead, it saves them for later along with the whole table. If you ever get a result like "|!!|!|Table text|!|!!|", you can be sure you are having a syntax issue with either this exact step, or it's brother later on. NOTE: This ALSO is looking for #column|references# that are stored inside table callouts, and does the same thing with them, too- storing the whole enchilada for later solving.)



    perform Table Lookups in the title
    perform Table Lookups in the main body


    • (NOW we get to rolling on regular tables that are left, since the things nested within them (cross-template stuff and internal callouts, at least) should be resolved now, leaving us with regular table names. But what if those tables spit out cross-template callouts or references!? That's why the next things up are...)


    Cross Template Write in the title
    Cross Template Write in the main body text


    • (Again! Here we resolve storing cross-template goodies that came out of our tables. Of note- this is the LAST TIME your text will be checked for things you want to WRITE into a cross-template storage value. If you try to store anything after this into a cross-template storage spot, it won't work.)


    perform Callout Storage References in the title
    perform Callout Storage References in the main body text


    • (And this again too! Because tables can dig up cross-template references too, and this will resolve them. This will NOT be the last check for retrieving cross-template references you stored earlier- we get more chances for that below again.)


    perform Column Reference Links in the title
    perform Column Reference Links in the body


    • (Here it's looking for the #column|References# you might have lying around all by their lonesome, and resolves them. Note that cross-template ones were done way earlier, this is just for regular ones.)


    perform Literal Replacements in the title
    perform Literal Replacements in the text


    • (Don't worry about this step, but it's here. This just cleans up some code so it reads itself correctly. Code doesn't like some symbols, and this makes sure it turns a blind eye to them. The only way this might be an issue for someone, is if they start using really non-normal ascii characters in their table names or callouts. Don't do that.)


    resolve Internal References in the title
    resolve Internal References in the main text


    • (NOW it solves the internal references from earlier. Because of some physics involved, this was the best way to crack this nut. This is the other place you might hunt down an issue where your output has |!!|!| in it, as this is the brother we talked about earlier. Usually issues here have to do with syntax like odd ascii characters.)


    perform Callout Storage References in the main body text
    perform Callout Storage References in the main body text AGAIN


    • (Now it looks for references to cross-template data to replace in the text TWO MORE TIMES. Yes, this is entirely on purpose. When tables start digging deep, you need these additional checks. It comes up more than you might think, and I have had folks ask me for MORE recurses of this so they can have their tables dig even deeper. In the future if I get enough requests for this, I may add the extra recurses as it doesn't cost much processor-wise by this point- but for now it's just two re-looks here. Of note: This is the very last time a table or reference will be resolved anywhere.)


    perform Link Replacements in the main text

    • (Find anything you intended to be a link, or that came out of a table and was supposed to be a link, and well... make it a link)


    perform Indefinite Articles in the title
    perform Indefinite Articles in the main body


    • (Look for areas the user wanted correct articles placed into the output, and make those pesky buggers right!)


    perform Capitalize in the title
    perform Capitalize in the main body


    • (Lastly, look for areas the user thought a table result might start a sentence, and capitalize it if it actually ended up doing so)

  2. #82
    Has anyone figured out a work-around for building a Random Encounter into a Template? That would be one feature that would make these AWESOME!
    Ultimate License Holder- Playin' D&D since '79, GMing since '81 and still rockin' the geriatric crowd.

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (1 members and 1 guests)

  1. Giggles666

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
  •  
FG Spreadshirt Swag

Log in

Log in