I’m working on a very simple t2i generator with simple radio button input for creating a prompt (choose an accessory).

Almost everything is working as expected, but I’m not sure if I’m doing it the best way.

I have an accessory list, and can output any of the accessories correctly… but I want NULL (wearing NO accessories) to be included if “Random” is chosen.

I’m sure there is something simple that I’m missing or maybe there’s a better way to do this?

Thanks for any help!

  • BlackYT@lemmy.world
    link
    fedilink
    English
    arrow-up
    3
    ·
    9 months ago

    There are many ways, one simple is to use .replace(“and wearing random”, “”), so when the random is selected, “wearing random” will be replaced by an empty string “” (nothing). you put it in wAcc in the prompt, like: wAcc.replace(“and wearing random”, “”)

    • Ashenthorn@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      9 months ago

      Thanks so much for the reply!

      I never would have thought of this solution, and it will probly do the job. 👍 I was hoping for something a little more portable… like somehow setting a null value list item, or maybe a better if/else for the list item output.