Copy an array within a dictionary to another array?

So lemme try to explain this as best as I can, look at the pictures to understand better, but here are my variables:

Current Code = An array that contains an index of 1-4, all decimal types.
Morse Code = A dictionary that contains an index from A-Z which are all arrays, the same as the other which contains an index of 1-4, all decimal types.
Current Letter = A string variable with a value of X.

So my question is why doesn't "Current Code: Morse Code[{lv=Current Letter}]" work in a set variable action when trying to copy an array within "Morse Code" to "Current Code" simply by using the string value of "Current Letter"? It ends up just clearing all indexes within "Current Code".

It's nothing to worry about though since doing "Current Code[1]: {lv=Morse Code[{lv=Current Letter}][1]}" manually along with 2, 3, and 4 works, was just wondering since you'd think it'd be that easy.

Hope I explained this well.
1000190587.png1000190588.png1000190589.png1000190590.png1000190591.png
 

RSF

Well-known member
Manipulating multi-dimensional arrays and dictionaries (dictionaries of arrays, or arrays of arrays, etc.) can be tricky; sometimes maddening; maybe even glitchy in some cases.

For your example, you might want to use an Action Block to effect the copy of the array. It seems to work, when a straight Set Variable action doesn't, to copy an array from a "Morse Code" dictionary entry into your "Current Code" array.

Action block:
1705728365617.png

Calling it from a macro:
1705728456159.png
where the Action Block call is configured like so:
1705728502720.png
 

Dm114

Well-known member
Manipulating multi-dimensional arrays and dictionaries (dictionaries of arrays, or arrays of arrays, etc.) can be tricky; sometimes maddening; maybe even glitchy in some cases.

For your example, you might want to use an Action Block to effect the copy of the array. It seems to work, when a straight Set Variable action doesn't, to copy an array from a "Morse Code" dictionary entry into your "Current Code" array.

Action block:
View attachment 8265

Calling it from a macro:
View attachment 8266
where the Action Block call is configured like so:
View attachment 8267
Well done (if it really works: I didn't try it)!

You must not clear output_arr as its default value is 0 entries i.e. empty
 
  • Like
Reactions: RSF
Manipulating multi-dimensional arrays and dictionaries (dictionaries of arrays, or arrays of arrays, etc.) can be tricky; sometimes maddening; maybe even glitchy in some cases.

For your example, you might want to use an Action Block to effect the copy of the array. It seems to work, when a straight Set Variable action doesn't, to copy an array from a "Morse Code" dictionary entry into your "Current Code" array.

Action block:
View attachment 8265

Calling it from a macro:
View attachment 8266
where the Action Block call is configured like so:
View attachment 8267
Wow thanks, I'll try doing this real quick and see what happens.
 
Top