Skip Navigation

[Help] Need help fixing an error

Hi,

I have some background in coding (very rusty tho), and I'm trying to create a generator (my first on perchance). I got an error and while I understand why the error is happening, I don't know how to fix and keep everything like I want it.

My (poor attempt at a) generator: https://perchance.org/first-generator-try

I combined a few templates/examples to get the things I want, but of course they don't straight up work together. These are the ones I combined together: https://perchance.org/centered-minimal#edit https://perchance.org/simple-checkbox-example#edit https://perchance.org/importable-color-palette

The error(s):

An error has occurred near line number 8: Your odds declaration: "[animalBox.checked] ^[plantBox.checked]", evaluated to: "true ^true" which contains characters that aren't allowed in odds declarations. The text after the "^" character defines the chance that that item will be selected (the higher the number the greater the chance). Odds declarations should only contain numbers, mathematical/logical operators, and are also allowed to have curly and square bracket blocks which will evaluate to number characters (these will be computed on-the-fly). If you'd like to use the "^" character literally (i.e. not to declare odds), you need to put a backslash character before it like so: "\^"

and

An error has occurred near line number 8: The '^' character is used to specify how likely an item is of being chosen during a random selection. This line appears to have a '^' character, but the text after that character ([animalBox.checked] ^[plantBox.checked]) isn't a number, or didn't evaluate to a number. You're allowed to use square and curly bracket expressions to randomly/dynamically determine the odds, but these expressions must evaluate to a number. In this case your odds expression didn't result in a number.

Please help if you can and thank you in advance if you try to!

1
1 comments
  • Hi, I would suggest taking a look at how to use probabilities. Here are some links, Perchance Tutorial, Probabilities Article from Perchance Hub.

    The problem is that you are declaring two probabilities in one line, ^[animalBox.checked] ^[plantBox.checked]while it should be only one. If you want both of them to be checked before it displays that item it should be ^[animalBox.checked && plantBox.checked].