Key : value vertical form variadic input (proof of concept)

since i just cant help waiting for anymore updates, ive been throwing together different parts and pieces and am surprised to say ive got something functional (technically...)

untitled script pic(3)
untitled script pic(4)

untitled script pic(5)

each row | [key] : [val] | is one click of the arrow keys, so they get grouped together. there is still just one multi arg input though, and aside from reshaping the contents to span two columns, it is basically the list [] block. buutttt it would be pretty sweet to have more stuff like this to build objects / classes / dictionaries etc.

DO NOT use this block in your own projects, it doesnt quite make the save / load jump and may lock you out it you try. just stay in a new one if you want to check it out. javascript needs enabled. link

That's pretty cool! I really hope this sparks an idea for jens to come up with a better way to do it (unless you do it...)

Ingenious method of doing this :slight_smile:

I don't think there would be a lot of demand for it but it made me think about if we could get close to it in pure Snap! and I came up with this


It handles the case of someone making a little mistook and not putting in an even number of items

yeah associative lists are totally possible in snap now but I've found in practice it really slows things down. Ive been trying to make a ball physics engine for a pool game and doing ~6 variables per ball (position velocity acceleration, x and y) for 15 balls is just too much to have to look up values test and change each frame.

Might be worth trying using 2 lists - one for the keys and another for the values


might be fast enough for your use case?

i dont really like how you made it require javascript to just get the block

ive tried methods like that and thats usually how i do on smaller projects it but it takes extra juice to run through the blocks and that starts to show when you put too many instances of so many variables at once. some of the blocks can be compiled to run quicker 'under the hood' but that doesn't cover basic key -> value searching with the index or item # blocks like replace.

that's because once the block is in the project it give an error when you try to save / load it. i would love if it would work on its own but I just haven't made it that far yet. by all means, feel free to modify it and fix it yourself. I thought I made it clear that it wasn't flushed out and perfect but oh well what can you do

oh, nvm

Oh man, I would use this so much. In fact, with this, we can finally make an if statement have an infinite amount of else if parts. Another thing is that you can make something expand that has different inputs. This would actually give a lot more possibilities than you think.

an if statement have an infinite amount of else if parts

oh yeah been meaning to try that one out too. the only extra thing about that is how to choose whether to put another if else segment or just a final else one. might have to be two blocks like theyve got now. or, I could probably get it to where one arrow click adds on just an else part, then another click turns that else into if else, and so on. I've got a couple ideas to work around the save / load thing too, possibly.

By "it" I mean this particular block

We all want the ability to have customised multiple variadic inputs :slight_smile:

This block was just a proof of concept, not meant to be used for anything.

I treated the post at face value - sorry if I got it wrong (again) :slight_smile: