Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Using Prompt to Set Variable Value based on Lookup Table

Basically I'm asking for the character level through a prompt (I have the prompt working just fine). I want to use that input number to assign a value to a variable based on a lookup table like the one below. But I'm not sure how to set the variable. When I use
set:Input={$prompt1}
it doesn't seem to set the variable value. It would be useful to have this variable set as I am going to use it several times across a few tables.

Also does the lookup type of table support a non-sequential range like this? Instead of rolling can I use the Input given by the user to set a new variable Value using the lookup below?

table:Set_Value
type:Lookup
1,4,7,10,13,16,19:3
2,5,8,11,14,17,20:4
3,6,9,12,15,18:5

For example if the user input 14 through the prompt, I want to set the Value variable to '4'.
Thanks!

Comments

  • Prompt should exist through the whole generator, meaning you shouldn't need to set it to another variable. Your second question is no, I think. Here is an example of Prompting, Setting, and Calling that I think shows how to do what you want as well as showing that Prompt is global.

    Prompt: Level {1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20} 1

    Table: One
    Set: Input={$Prompt1}
    :[Table One: >> Bold] {$Prompt1} [Table Two: >> Bold] [@Two] [Table Three: >> Bold] [#{Input} Set_Value]
    EndTable:

    Table: Two
    Returns {$Prompt1}
    EndTable:

    Table: Set_Value
    Type: Dictionary
    1:3
    2:4
    3:5
    4:3
    5:4
    6:5
    7:3
    8:4
    9:5
    10:3
    11:4
    12:5
    13:3
    14:4
    15:5
    16:3
    17:4
    18:5
    19:3
    20:4
    EndTable:

  • Thanks!
    I read that variables are persistent so good to know the prompts are too.
    I'll have to try this dictionary type instead.

Leave a Comment