Weird question maybe... I'd like to "chain" two generators together in sequence, via a button that passes a bunch of variables from the first one to the second one. Is this doable?

all 6 comments

sorted by: hot top controversial new old
[–] 2 points 1 year ago (5 children)

You can import the other gen into the main gen.

  • source
  • hideshow 5 child comments
  • [–] [S] 2 points 1 year ago (4 children)

    True. But both are pretty big, so I'd like to break it into steps.

  • source
  • parent
  • hideshow 4 child comments
  • [–] 2 points 1 year ago (3 children)

    Maybe explain the process that you want to achieve and have some test generators? It should simply be something like:

    // gen-1
    genTwo = {import:gen-2}
    
    output
      [genTwo(something)]
    
    // gen-2
    genThree = {import:gen-3}
    
    $output(input) =>
      genThree(input)
    
    // gen-3
    $output(input) =>
      // process code here
    
  • source
  • parent
  • hideshow 3 child comments
  • [–] [S] 1 point 1 year ago* (last edited 1 year ago) (2 children)

    Okay the process I am trying to achieve:

    1. generator 1 generates a random Planet and displays a printout plus an image, followed by a few buttons/links allowing you to drill down, choosing the next generator you want: "EXAMINE LIFEFORM" or "EXAMINE GEOLOGY" or "EXAMINE FLORA" etc.
    2. so generator 2 is a big printout of content (plus image) as well, but it is based on stuff we got from generator 1. That's why I want to pass some of the content output by generator 1 (gravity, atmosphere, etc) as input to generator 2. Variables from the primary generator will affect the secondary generators (e.g.: if the planet's atmosphere is methane, then the random lifeform must breathe methane).
  • source
  • parent
  • hideshow 2 child comments
  • [–] 2 points 1 year ago* (last edited 1 year ago) (1 child)

    You can do something like this on the second generator:

    importInputs
      gravity = default
      atmosphere = default
    
    output
      [lifeform] // output of the second generator
    
    lifeform
      lifeformOne ^[importInputs.gravity == "something"]
      lifeformTwo ^[importInputs.atmosphere == "methane"]
    
    

    Then on the first generator:

    genTwo = {import:gen-2}
    
    generateGenTwo
      [genTwo.importInputs.gravity = selectedGravity, genTwo.importInputs.atomsphere = selectedAtmosphere, ''] [genTwo.output]
    

    This way, you set the variables of the second generator from the first generator, so that the lists used have the correct odds used.

    Here are also some references from previous threads:

  • source
  • parent
  • hideshow 1 child comment