Variables doesn't work in define manually dialog

SPREEKDOS

New member
Hello, :) i am trying to use variables (global or local) inside "define manually" dialog or the index but it doesn't assign anything

last_element = {size=array} -1
dictionary1 = {lv=array[{v=last_element}]}
dictionary1 is still empty

I'm trying to use them to assign a variable (dictionary) to the last element (dictionary) of an array variable.

Is there any alternative way to get the last element of an array?

Screenshot_2023-04-24-07-37-54-462-edit_com.arlosoft.macrodroid.jpg
 
Last edited:

Endercraft

Moderator (& bug finder :D)
Hello, :) i can't use variables in define manually dialog which I'm trying to use to assign a variable (dictionary) to the last element (dictionary) of an array variable.
Is there any alternative way to get the last element of an array?

View attachment 5378
You can't do that yet unfortunately (dynamic dictionary/array copying), unless someone has a workaround.
 

Andydroid

Member
Do any arithmetic on the required index *before* trying to use it eg the following will display the last element of the array:

Set Variable: n: (size=array_variable) - 1
Popup Message {lv=array_variable[{lv=n}]}

Is that what you mean?
 

Dm114

Well-known member
Hello, :) i can't use variables in define manually dialog ({size=array_variable} -1) which I'm trying to use to assign a variable (dictionary) to the last element (dictionary) of an array variable.

Is there any alternative way to get the last element of an array?

View attachment 5388
The only way to do it is as @Andydroid showed (no calculation inside the indexes, only constants or variables)
 

SPREEKDOS

New member
The only way to do it is as @Andydroid showed (no calculation inside the indexes, only constants or variables)
Welcome
Sorry i think my post was confusing, i already tried that, what i meant in this post is that variables (global or local) doesn't work inside that dialog or the indexes [] ( i checked that that they are an integer), only constants works which are useless for getting the last element of an array.
I edited the post.
 
Last edited:

Dm114

Well-known member
Welcome
Sorry i think my post was confusing, i already tried that, what i meant in this post is that variables (global or local) doesn't work inside that dialog or the indexes [] ( i checked that that they are an integer), only constants works which are useless for getting the last element of an array.
I edited the post.
Be careful with the syntax when using variables. It must be of one of these forms:
[[lv=local_var]][[v=global_var]]
or
[{lv=local_var}][{v=global_var}]
 

SPREEKDOS

New member
I can't beliave i forgot this workaround 🤯
it's pretty easy to do i could just copy the keys inside the array to a variables and then copy those to the dictionary.

IMG_20230426_011708.jpg
 
Last edited:
Top