marko
New Member
Posts: 4
|
Post by marko on Jan 16, 2021 14:55:27 GMT
Dear All,
Getting value from an array at a particular position does not seem to work. This code:
task test set &&my_area 4 5 2 10 set &x &&my_area use 2 show text &x delay 10000
block blok tasklist test 1 end
write 0 whatever position I try. Does anyone know anything about this? Maybe I don't understand something properly.
Thank you very much,
Maliković Marko
|
|
|
Post by PsyToolkit on Jan 18, 2021 11:16:05 GMT
Sorry, the documentation is not so clear. I fixed the feedback. Compile this code again and you will be explained how you can use "use". The solution
task test set &&my_area 4 5 2 10 set &x &&my_area use position 2 show text &x delay 10000
block blok tasklist test 1 end
Or you can do this:
task test set &&my_area 4 5 2 10 set &x &&my_area[2] show text &x delay 10000
block blok tasklist test 1 end
- Note that "array" indices start with 1 (unlike in many programming languages where they start with 0).
Here are the use options:
set &x &&my_area use first
set &x &&my_area use last
set &x &&my_area use random
set &x &&my_area use position <number>
|
|
marko
New Member
Posts: 4
|
Post by marko on Jan 18, 2021 18:45:35 GMT
Great!
Thank you very much!
Marko
|
|