I’m making a random generator that takes a bunch of customizable info, runs some random numbers, and then tosses out some random scenarios based on those. “What percent of the population is affected?” “What are they affected by?” Those things. I’ve learned how to make textboxes (I haven’t learned how to make info not temporary and I just live in constant errors, now, because it shows an error every time there’s an “undefined” box) and I’ve learned how to make multiple dropdown lists. However, when I try to attach outputs to them, it doesn’t work. Attaching a button to it will randomize the output. I want to add a description, so when someone chooses “Option One” they get a short dialogue beside it to give them a feel of what it may be like. Currently, if I have “Option One” chosen and I press the button, the dialogue for Option Eight could appear or Option Three or Option Five just as easily as Option One.
Here’s what the code itself looks like (BTW this is my first generator. I’ve used very basic HTML like embedding links and formatting for years and I’m getting into game design and learning how to use minor C++/Unreal Engine, but I’ve never used JS before)
Did you put the
Death_Chance
andIllness_type
variables into a parent list like this?someListName Death_Chance = Moral Blow Illness type = Whitecough
If so, you’d need to change the
aListName
part of the syntax to reference the name of the sublist:<br>Death Chance: <select oninput="someListName.Death_Chance = this.value"> <option value="Moral Blow">Moral Blow</option> ... <br>Illness type: <select oninput="someListName.Illness_type = this.value"> <option value="Whitecough">Whitecough</option>
[someListName.Death_Chance == "Moral Blow"]