I have to think I'm doing this wrong. I'm making a file that generates human names. It prompts the user if they want a name for a male or female, civilized or uncivilized, and in both cases, it gives them opportunity not to care (in other words, I don't care so long as it's a male name). Alright, the obvious thing to do here is to make a number of checks: is $prompt1 male? No. Okay, is $prompt1 female...and so on. However, when I put it on a table, it would randomly pick one of the when-do statements, check it against that and then move on. In other words, it wouldn't move through the chain of when-dos. I had to, therefore, put in table calls and do the whole thing through a bunch of tables. Basically this:

Table: Start_Name
[when] {$prompt1} = Male and Civilized [do] [#{1d3} Human_Name_Male_Get] [else] [@promptcheck2] [end]

Table: promptcheck2
[when] {$prompt1} = Male and Uncivilized [do] [#{1d3+3} Human_Name_Male_Get] [else] [@promptcheck3] [end]

Table: promptcheck3
[when] {$prompt1} = Female and Civilized [do] [#{1d3} Human_Name_Female_Get] [else] [@promptcheck4] [end]

Table: promptcheck4
[when] {$prompt1} = Female and Civilized [do] [#{1d3+3} Human_Name_Male_Get] [else] [@promptcheck5] [end]

Table: promptcheck5
[when] {$prompt1} = Male and civilization uncertain [do] [@Human_Name_Male_Get] [else] [@promptcheck6] [end]

Table: promptcheck6
[when] {$prompt1} = Female and Civilization Uncertain [do] [@Human_Name_Female_Get] [else][@promptcheck7] [end]

Table: promptcheck7
[when] {$prompt1} = Gender and Civilization Uncertain [do] [@Human_Name_Gender_Get] [else] prompt failed [end]

It works, but it seems ridiculously cumbersome. Is there another way to write that as one table?


  • Here's a solution using a dictionary table. It's not too much shorter, but maybe a bit more straight forward. I'd have to do a little work to see how to use dictionary tables with spaces in the text string instead of the underscores that i used here. I'm sure there are other ways as well.

    ; Test When-do.ipt
    ; created 10/10/2017 8:10:43 AM
    Prompt: Choose Name {M_and_C|M_and_U|F_and_C|F_and_U|M_and_Any|F_and_Any|G_and_Any} G_and_Any

    Table: Main
    ;A veriable set [name] to be used in the essential command line of this table.
    Set: name=[#{$prompt1} Choose]
    The {$prompt1} name is {name}.

    Table: Choose
    Type: dictionary
    Default: 117 //debug value
    M_and_C: [#{1d3} Human_Name_Male_Get]
    M_and_U: [#{1d3 +3} Human_Name_Male_Get]
    F_and_C: [#{1d3} Human_Name_Female_Get]
    F_and_U: [#{1d3 +3} Human_Name_Female_Get]
    M_and_Any: [@Human_Name_Male_Get]
    F_and_Any: [@Human_Name_Female_Get]
    G_and_Any: [@Human_Name_Gender_Get]

    Table: Human_Name_Male_Get
    Type: Lookup
    1: Joe
    2: Bob
    3: Larry
    4: Zappa
    5: Krull
    6: Devestator

    Table: Human_Name_Female_Get
    Type: Lookup
    1: Cindy Lou
    2: Mary
    3: Theresa
    4: Sheara
    5: Teeran
    6: Lucandera

    Table: Human_Name_Gender_Get
    Cindy Lou

  • Thanks. Yeah, I just figured out dictionary tables.

Leave a Comment