V
Vitalii Lukyanov
Guest
Hello, I have a problem. I don't know how to access a specific element in the array that is inside of ds_map.
I add coordinates to map like this: "ds_map_add(coords, 1, [533.3, 10456]);" and I want to access to access 1st and 2nd coordinates in array somehow, but I don't understand how to do it, every time I get compilation error or nothing happens. Last time I tried do something like this "ds_list_add(global.pl_instances, instance_create_layer(coords[? i][0], coords[? i][1], "Players", player_blue));" but I get chars_spawn at line 22 : got '[' expected ',' or ')' and chars_spawn at line 22 : wrong number of arguments for function instance_create_layer.
Thanks in advance!
UPD: sadly, now when I use jo-thijs's solution, this array that I try to access is undefined.
UPD2: changed everything to arrays and now it works fine.
I add coordinates to map like this: "ds_map_add(coords, 1, [533.3, 10456]);" and I want to access to access 1st and 2nd coordinates in array somehow, but I don't understand how to do it, every time I get compilation error or nothing happens. Last time I tried do something like this "ds_list_add(global.pl_instances, instance_create_layer(coords[? i][0], coords[? i][1], "Players", player_blue));" but I get chars_spawn at line 22 : got '[' expected ',' or ')' and chars_spawn at line 22 : wrong number of arguments for function instance_create_layer.
Thanks in advance!
UPD: sadly, now when I use jo-thijs's solution, this array that I try to access is undefined.
UPD2: changed everything to arrays and now it works fine.
Last edited by a moderator: