Hi!

I need a consumable list where two items are picked, but only the first is a random selection, and the second item is not at random but always a specific item based on the random first item.

Say, if item one is “A”, then item two always has to be “X”, and if item one is “B”, then item two always has to be “Y”.

To complicate things: “X” and “Y” should not be eligible for the random first item, they can only be the second, non-random item.

To complicate things further: none of the items are numbers, I’m sorry.

What I tried was to do something like a consumable list with dynamic odds, where I used == instead of != in mad hopes it’d work, but of course it didn’t. (Is this something that could work if I changed it up a bit?)

A friend suggested I could use key/value pairs, but that would be so incredibly unwieldy and I’d rather not. I want to use this for long lists (plural) and for multiple possible outcomes. If key/value pairs are the most reasonable way to do this, how would I do this? Could I define the pairs in my list?

I’d really, really appreciate if someone could point me in the right direction.

Sorry if my question and/or explanation is confusing, I had too much coffee and I’ve been staring at code >24 hours now. Please let me know if I need to rephrase my question to make it make sense to people who are not in my brain.

Thank you!

(Not linking the generator in question because it’s almost 3,000 lines of code and what I want to do is currently not in it anyway lol.)

  • VioneTM
    link
    English
    4
    edit-2
    1 year ago

    I think dynamic odds with consumable list should work fine.

    randomList
      A
      B
    
    specificList
      X^[selected == 'A']
      Y^[selected == 'B']
    
    item
      [selected = consumableRandomList.selectOne] [specificList]
    
    output
      [consumableRandomList = randomList.consumableList, ''] [item] <br> [item]
    

    If you want key-value pairs, you could do Hierarchical sub listing like so

    list
      A
        X
      B
        Y
    
    item
      [selected = consumable.selectOne.getName] [list[selected]]
    
    output
      [consumable = list.consumableList, ''] [item] <br> [item]
    
    • Diana47OP
      link
      English
      2
      edit-2
      1 year ago

      Thank you so much, you’re the true MVP here!

      So, if I wanted to use the results for a list that is not the outcome, could I do it like this?

      Let’s say I want to create sentences like “the mouse is in the barn” or “the cat is in the fridge” or something (not the actual sentence lol), would this be the right approach? Just making sure I understand what I’m doing.

      Sorry if this is very obvious, I hadn’t expected my generator to become this complex when I started two years ago and I’m still learning as I go…

      output
        sentenceList
      
      sentenceList
        [consumable = randomList.consumableList, ''] The [item] is in the [item].
      
      item
        [selected = consumable.selectOne.getName] [list[selected]]
      
      randomList
        A
        B
      
      specificList
        X^[selected == 'A']
        Y^[selected == 'B']
      • VioneTM
        link
        English
        31 year ago

        It should be:

        output
          [sentenceList]
        
        sentenceList
          [consumable = list.consumableList, ''] The [selected = consumable.selectOne.getName] is in the [list[selected]].
        
        list
          A
            X
          B
            Y
        

        if you want to use Dynamic Odds:

        randomList
          A
          B
        
        specificList
          X^[selected == 'A']
          Y^[selected == 'B']
        
        output
          [consumableRandomList = randomList.consumableList, ''] The [selected = consumableRandomList.selectOne] is in [specificList].
        
        • Diana47OP
          link
          English
          3
          edit-2
          1 year ago

          Thank you so much!!!

          Edit to add: The Dynamic Odds version did not work, but it’s like 3am for me and that could very well be the reason. I’ll look into it again later because it could still be useful to figure out. :D The key-value version works like a charm! That was exactly what I was going for but didn’t know how to translate to code, thank you so much for your help!