Selective dropdowns

Be sure to read and follow the guidelines for our forums.

Mar 6, 2023 2:15 am
Hi,

Is there a way to use checkboxes to decide what populates into a dropdown menu?
or;
I'd like a checkbox to determine what gets into the dropdown menu.

Example from character sheet
https://i.imgur.com/lIdf2kL.jpg

creates this dropdown for posts
https://i.imgur.com/mDtvzVC.jpg
Mar 6, 2023 5:07 am
You could try some eleporate if statements, but it's gonna get messy
Mar 6, 2023 9:23 am
Are there if statements in this "character sheet language" ?!? I would really like to know how they work and I haven't seen them at the guides.
Mar 6, 2023 10:08 am
Hmmm.... I can't find it either. Perhaps @adam forgot to add it to his guide?

Anyway the if statement works as follows (logic?'True':'False')
In this example if dt is 1 then it will retun 1 else it will return 0.5

(dt==1?'1':'0.5')


So for the spelllist example one could have a list of all spells with a checkmark and when druidcraft is 1 enter the text else it is blank. Something like this. I dont know how it will handle extra formatting linebrakes ect.
('Druidcraft'==1?'#Druidcraft
Cantrip Transmutation
Casting Time: 1 action
Range: 30 feet
Target: See text
Components: V S
Duration: Instantaneous
Whispering to the spirits of nature, you create one of the following effects within range:
You create a tiny, harmless sensory effect that predicts what the weather will be at your location for the next 24 hours. The effect might manifest as a golden orb for clear skies, a cloud for rain, falling snowflakes for snow, and so on. This effect persists for 1 round.
You instantly make a flower blossom, a seed pod open, or a leaf bud bloom.
You create an instantaneous, harmless sensory effect, such as falling leaves, a puff of wind, the sound of a small animal, or the faint odor of skunk. The effect must fit in a 5-foot cube.
You instantly light or snuff out a candle, a torch, or a small campfire.':'')
Last edited March 6, 2023 10:26 am
Mar 6, 2023 10:10 am
Interesting, thanks! Hope someone will add it to the guide. Cause I may forget it before I will need it again.
Mar 6, 2023 11:22 am
runekyndig says:
Perhaps @adam forgot to add it to his guide?
Not amnesia - apathy.

But if someone wants to update the guide, this is where it was originally discussed.
Mar 6, 2023 2:01 pm
Unfortunately, using the ternary operator (logic?true:false) as an if statement won't work to control the flow of the code in the character sheet. It can change the calculation of a variable (number or string), but any BBcode in the statement will not be evaluated by the character sheet. It will either throw an error or just be stored as an un-evaluated string.
Mar 8, 2023 5:27 am
Hmmmm ... so you CAN do it with the "if" operator (Logic?True:False), well I should say many "if" operators, BUT it's very complicated.

@Eyes, I made a "proof of concept" version for a spellbook containing 3 spells. It gives two dropdown menus: one for the entire spellbook and one for the spells that are "checked".

https://i.imgur.com/DulfCyv.jpg

Here's the code, but I'll warn you, it's more of a hack rather than a user friendly template, so it might be a challenge to understand and it'll probably be a pain in the butt to expand to an entire spellbook. Not trying to dissuade you, but just wanted to give you a heads up it might take a lot of work to implement at full scale. Let me know if you have questions.
[ +- ] Spellbook
Mar 8, 2023 3:07 pm
Thanks, I see how it works but OMG that would make this thing much bigger.
The last edits I made to it, I created a table to clean up a spell i copied from ddb. i'd highlight 5 rows click the table & compact, it would cause that windows notification to pop up telling me it was taking longer than it should and did i want to wait

You do not have permission to post in this thread.