Currently it seems to return the first option. I’m working on some UI that allows you to toggle options on and off, by setting the odds. But because of the way it handles this I’m going to have to proxy over it and overwrite the list in the tree… so then I can return “” when there are no possible options. I feel like it would just make sense if it returned an empty string if there are child options but none are possible.

Edit: For all-impossible options, .selectMany() returns the first item multiple times. And .selectUnique() returns each item in order.

  • VioneTM
    link
    English
    14 months ago

    Not sure how you have your list (or if you are using a list with dynamic odds) but here is an example to filter options with 0 odds:

    random = {0-3}
    
    output
      Selected: [x = random.selectOne] | Output: ~[verb]~ // the ~ are just here to show that it returns a blank string
    	
    verb
      $output = [this.selectAll.filter(a => a.getOdds)] // returns a blank string if there isn't any option with odds.
      pat^[x == '1']
      befriend^[x == '2']
      help^[x == '3']
    
    • @wthit56OP
      link
      English
      14 months ago

      Ah I see, that’s clever… I’ve done it another way, as there are other shenanigans I’m up to with lists. But thanks for the idea.

      Still makes more sense to me that it just works this way by default, anyhow. Saying an item has a probability of 0 and getting it every time just seems nonsensical in practical terms. ;p