hierarchical geographic locations

I'm trying to write a generator that returns a random geographic location on a world.

Can a table return a string which identifies the next "level" to pick from?

i.e.,

set: continent == [@Maragaram]
set: region == [@{continent}]*
set: subregion == [@{region}]*
...*
set: location = [{subregion}, {region}, {continent}, Maragaram]

*Not all locations have a deep hierarchy, but some could go much deeper than shown here. Obviously, some sort of recursive thing would be good instead of the above, using a generic varname for everything, where at each step we test for a table named {varname} and continue if it exists.

For example, it should be able to produce things like: (stuff in parentheses is just for explanation)

  1. Sunscip Temple (building), Ryune (city), Fyell (region/land/country), Intardûn (large island), Archipelago (continent), Maragaram (world)
  2. Sed's Dungeon (dungeon), Zenpro Mtns. (geo-feature), Intardûn (large island), Maragaram (world)
  3. Kif-Kayanow (town), Karngost (small remote island), Maragaram (world)

All I'm getting is a pick from my first Table: Maragaram, and nothing else..

Comments

  • You'll probably want to post the actual generator as an attachment or use the code formatting here in the forum. The problem can be any number of things, but its difficult to tell from just a non-code formatted bit. For example, there shouldn't be spaces between the variable name, the =, and the value in a SET statement.

  • edited April 2018

    Yeah, well, that's part of the problem. I'm having trouble even starting.

    I have something like this:

    Table: genloc
    [location==[@Maragaram]+", Maragaram"]{location} 
    
    Table: Maragaram
    [location==[@Archipelago]+", Archipelago"]
    [location==[@Karngost]+", Karngost"]
    [location==[@Phenylargyle]+", Phenylargyle"]
    
    Table: Archipelago
    [location=='Arya']
    [location=='Barndthalle']
    [location=='Beo']
    [location=='Forozen']
    [location=='Gerhans']
    [location==[@Intardûn]+', Intardûn']
    [location=='Khastins']
    [location=='Kordûn']
    [location=='Mahar-Tlimë']
    [location=='Slade-Isle']
    [location=='Steppingstone']
    
    Table: Intardûn
    [location=='Ag']
    [location=='Belll']
    [location=='Cilth']
    [location=='Fyell']
    [location=='Imlorr']
    [location=='Irhíq']
    [location=='Morrieol']
    [location=='Sannte']
    
    Table: Karngost
    [location=='Docks']
    [location=='Fields']
    [location=='Kif-Kayanow']
    
    Table: Phenylargyle
    [location=='Byrne']
    [location=='Weymouth']
    [location=='Franz']
    [location=='Harrison']
    

    And, I'm getting this when I run it:

    +", Maragaram"

  • Fixed it:

    Table: genloc
    [location==[@Maragaram], Maragaram]{location} 
    
    Table: Maragaram
    [@Archipelago], Archipelago
    [@Karngost], Karngost
    [@Phenylargyle], Phenylargyle
    
    Table: Archipelago
    Arya
    Barndthalle
    Beo
    Forozen
    Gerhans
    [@Intardûn], Intardûn
    Khastins
    Kordûn
    Mahar-Tlimë
    Slade-Isle
    Steppingstone
    
    Table: Intardûn
    Ag
    Belll
    Cilth
    Fyell
    Imlorr
    Irhíq
    Morrieol
    Sannte
    
    Table: Karngost
    Docks
    Fields
    Kif-Kayanow
    
    Table: Phenylargyle
    Byrne
    Weymouth
    Frantz
    Harrison
    

    Produces:

    Byrne, Phenylargyle, Maragaram
    Irhíq, Intardûn, Archipelago, Maragaram
    Khastins, Archipelago, Maragaram
    Fields, Karngost, Maragaram

  • Note to self: Like a lot of things, IPP3 generators are easier than you might think they are. Coming from a formal coding background I think made it harder for me to realize this.

  • Thats good to hear. Yes, especially if you come from a coding background, the important thing to keep in mind with IPP is that its not code per-se, but a rather its a regular expression (regex) engine.

Leave a Comment