So I’m working on adding some customization onto my generator and was wondering if there was a way to set it up so if something is checked, it can roll more.

For example, if they don’t have the “Druid” box checked, they are only able to roll 0-4 druid upgrades but if they have the druid box checked, they are able to roll more than 4.

Another question related this - in the future, all the subspecies will be under/rolled on the same list, is their a way to make it so they are still able to roll different amounts of upgrades without having different subspecies lists? (I.e they have “druid” checked and can roll 4+ druid upgrades but only 0-4 rogue upgrades)

  • wthit56@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    2 months ago

    A little JavaScript is useful to know. It’s what is used for [code]. I’m guessing you’re doing a .selectMany(1,4), right? And if they have a checkbox checked you want it to be (1,7) or whatever maybe.

    You can reference a html element by its id. If the Druid checkbox has the id “druid” You can access it by using druid.

    You can see if it’s checked by using .checked - it’ll be true if it’s checked, false if it’s not.

    You can use a different value based on if a condition is true or false like this: condition ? value_for_true : value_for_false.

    So for the above, you’d have [druid_stuff.selectMany(1, is_druid.checked ? 7 : 4)]

    I hope that makes sense…