Temp Variables in Inline Variable Assignment

I'm trying to go a little bit farther with some generators that I built out of this thread - https://forum.nbos.com/discussion/1927/variable-inline-variable-assignment-help#latest

jdale's Dec 2020 reply at the top of Page 2 is the basic function I'm using. I'd like to know if it's possible to call the temp variables for the table calls separately?

I'm basically doing two output formats in one generator because I want the random NPC to match in both. One is the normal generator output in the linked thread. I want to be able to copy and paste it into Word or something and save the character. Easy.

The other that I want to do is try and get it into proper XML format so I can copy/paste into Notepad++ and save it for upload into VTTs. In those, each skill/item is given an individual ID number with the appropriate formatting. I don't think I can just put a big grouping in it and it work correctly.

So in the linked example, Items does 5 table calls and then sorts them alphabetically and implodes them with commas. I assume there is some temp variable Item1, Item2, Item3, etc. that gets abandoned after the table is called.

Is that correct? And is it possible to keep them separately?

Comments

  • If I understand correctly, you're hoping you can take a formulation like this:
    [!5 Items >> sort >> implode]
    and capture each result in a different variable, such as item1, item2, etc.

    Something like this:
    [!stuff=5 Items >> sort >> implode]
    puts the entire list into one variable.

    You could use this:
    [!item1=Items], [!item2=Items], [!item3=Items], [!item4=Items], [!item5=Items]
    but that wouldn't sort them.

    If you want each item captured separately, and if you also want the list sorted, you could do something like this:

    Table: x
    [@5 Items >> sort >> implode]
    
    Table: Items
    {i==i+1}[!item{i}=Pick One]
    
    Table: Pick One
    Alpha
    Beta
    Gamma
    Delta
    Epsilon
    Zeta
    Eta
    Theta
    

    That creates a sorted list and gives you a series of variables named item1, item2, etc.
    The variables are numbered in the order picked, which generally won't be the same as the sorted order. For example, item1 could be Gamma, even if Gamma isn't the first in the sorted output.

Leave a Comment