It looks like you're new here. If you want to get involved, click one of these buttons!
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)
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.
Yeah, well, that's part of the problem. I'm having trouble even starting.
I have something like this:
And, I'm getting this when I run it:
+", Maragaram"
Fixed it:
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.