Dropdown menus via list variables

yeah.

That's unfortunate :slight_smile:

I'm thinking (without trying to code something) that this is going to be a bit awkward (nothing is usually impossible so I won't say that word) :slight_smile:

The basic issue is that, at the moment, my JS code can read the displayed contents of another slot.

So slot 2 can determine what slot1 is displaying. But it would be very hard to try and determine the contents of the the list variable that produced the slot 1 output

This is because that Snap isn't actually running when you choose a menu item so it is very difficult to find that information out before the script has run.

What is your end requirement for this as there may be another way to achieve your goal

what if slot 3 checks both slot 1 and slot 2 to determine the menu?

I am also gonna be using inputs that don't repeat in variables, so I could have each list hardcoded into the block.

Anything/everthing is possible once you mix hard-code with a bit of JS :slight_smile:

The "hard" bit is avoiding having to do hard-coding :slight_smile:

I'd REALLY like to know why/what this is for :slight_smile:

wait, how can I use your
menuFromLists4 script pic
block with values that are numbers? I can't make a javascript variable called "1", and I certainly can't make javascript variables with spaces.

I only did that block for Brian's benefit so it doesn't contain later code that treats numbers as strings as the other blocks do

And the general answer is that a JS menu produces an object and not simple variables and object keys and values can be string representation of numbers

Also, I'm really bad at JS so the above explanation might be wrong but my other blocks handle number menus fine, so I must have done something right :slight_smile:

image

Edit
e.g this example bit of my code sticks "" at start of concatenation so that JS treats everything as strings and not numbers

output["" + prefix + hasEquals[0]] = hasEquals[1];

ok. I've sort of given up on this, so I'll just use an existing input.

Me too. It's hard to talk about this without knowing what problem you're trying to solve.

I found out another way to do it, and it was also for a mock-up for a program I am going to make. idk why I was trying to make it act exactly how my program is going to be like.