#Basic array help

5 messages · Page 1 of 1 (latest)

frigid hemlock
#

Having problems with arrays as always
I guess I set them up wrong

Variable Index [0] out of range [0]
at gml_Script_path_algorithm (line 174) - show_debug_message(open_nodes[PATH_VARS.NODE][0]);

This is how I set the array up:

var open_nodes = array_create(PATH_VARS.PARENT+1);
for (var i = 0; i < array_length(open_nodes); ++i;) {open_nodes[i] = array_create(1,0)}

open_nodes[PATH_VARS.NODE][0] = 0;
open_nodes[PATH_VARS.G_COST][0] = 1;
open_nodes[PATH_VARS.H_COST][0] = 2;
open_nodes[PATH_VARS.F_COST][0] = 3;
open_nodes[PATH_VARS.PARENT][0] = 4;

show_debug_message(open_nodes);
        
show_debug_message(open_nodes[PATH_VARS.NODE][0]); //IS THROWING ERRORS HERE <<<< INDEX OUT OF RANGE```
 
I know this is basic but I can't wrap my head where I am wrong
plush kite
#

what is the value of PATH_VARS.PARENT and PATH_VARS.NODE

#

and what did show_debug_message(open_nodes); show

frigid hemlock
frigid hemlock