Spyke
perchance·Perchance - Create a Random Text GeneratorbyCalibanStorm

Chaining + Preloading Generators in Sequence?

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?

View original on lemmy.world
VioneTreply
lemmy.world

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
2
lemmy.world

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).
1
VioneTreply
lemmy.world

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:

2

You reached the end

Chaining + Preloading Generators in Sequence? | Spyke