GameMaker [SOLVED] Finding one value of a set of numbers in a single ds_list position

P

PepticPaladin

Guest
I've set up a ds_list with each position of the list being coordinates. It looks like this:
Code:
global.grad3 = ds_list_create();

ds_list_add(global.grad3, [1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],
                          [1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],
                          [0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]);
using ds_list_find_value(global.grad3, 0) returns {1,1,0}. I only want the 1 at the start. How would I get just the first number in each position of the list?
 

FrostyCat

Redemption Seeker
Either pull it into a temporary variable and index it from there:
Code:
var grad3_0 = global.grad3[| 0];
show_debug_message(grad3_0[0]); //1
Or if you need it as a single expression, use this workaround and simply do:
Code:
Get(global.grad3, 0, 0);
 
Top