Variable Tables Training

Im stuck on the beginning testing of a pokemon encounter generatior. OnPath doesnt print anying with no Console info.

Test Cod:
Prompt: RouteInfo {OffPath|OnPath} OffPath

Define:Route={$prompt1}

Table: Main
Type: Lookup
Roll: {1d2}
1:{[Define: Pokemon=pidgey]}[when]{$route}=OffPath[do][@Check1][else][@Check2][end]
2:{[Define: Pokemon=seedot]}[when]{$route}=OffPath[do][@Check1][else][@Check2][end]
Endtable

Table: Check1
Type: Lookup
Roll: {1d2}
1:[Define: Pokemon=wurple]
2:[Define: Pokemon=wooloo]
Endtable

Table: Check2
Type: Lookup
Roll: 1
1: {$Pokemon}

If you could please explain to me what I'm doing wrong that would be great. This is only going to get more complicated and I'm tripping on an early hurdle

Comments

  • Don't use Define for things inside a table. That's only for definitions at the top, before your tables start.

    [Pokemon=pidgey]

    will assign the Pokemon variable a value of "pidgey", and also display "pidgey".

    [Pokemon==pidgey]

    with a double equals sign will assign the value without displaying anything, which is probably what you want for the assignments in Main. You also don't need the Endtable lines. So you could just have:

    Prompt: RouteInfo {OffPath|OnPath} OffPath
    
    Define:Route={$prompt1}
    
    Table: Main
    Type: Lookup
    Roll: {1d2}
    1:[Pokemon==pidgey][when]{$route}=OffPath[do][@Check1][else][@Check2][end]
    2:[Pokemon==seedot][when]{$route}=OffPath[do][@Check1][else][@Check2][end]
    
    Table: Check1
    Type: Lookup
    Roll: {1d2}
    1:[Pokemon=wurple]
    2:[Pokemon=wooloo]
    
    Table: Check2
    1: {$Pokemon}
    Type: Lookup
    Roll: 1
    

Leave a Comment