GameMaker [Solved] Unable to run script with list item as condition (+ script/arg/array)

Hi,

I'm trying to get a script with arguments as arrays to run based on the action condition variable accessed in another list. There doesn't seem to be any errors, but I can't actually get the scripts to trigger even though the action condition shows me that it has accessed the action condition variable in that list.

Setup as follows:

Create:

Code:
big_list=ds_list_create(); //action condition list

list_a=ds_list_create(); //list containing script/array
list_b=ds_list_create();

arr_entry[0] = scr_debug_msg;
arr_entry[1] = ["A1","A2","A3"];

arr_entry2[0] = scr_debug_msg;
arr_entry2[1] = ["B1","B2","B3"];

ds_list_add(list_a,
arr_entry,
);

ds_list_add(list_b,
arr_entry2,
);

ds_list_add(big_list,
"move", //a items
"mel" //b items
)
Step:

Code:
if keyboard_check_pressed(220)
{
ai_do=ds_list_find_value(big_list,0) //position adjusted thru shuffle
}

if ai_do=="move"
    {   
    var script_arr = list_a[| 0];
    script_execute(script_arr[0],script_arr[1]);
    }
  
else if ai_do=="mel"
    {
    var script_arr = list_b[| 0];
    script_execute(script_arr[0],script_arr[1]);
    }
I can see that ai_do becomes "move" or "mel", but the scripts above don't seem to run. Should this not work? Note that I also tried replacing the strings above with numbers just to be on the safe side, but still no triggering.

Thanks in advance!
 
Do you know how to use the debug mode and set break points?

This would be the ideal time to learn if you haven't used it before. The code looks fine to me at first glance. So you would want to use debug mode, and step through the code to see exactly what is happening, and where it is going wrong.
 

Slyddar

Member
With the script scr_debug_msg being passed an array, how are you handling that in the script?

Something like this should output them correctly. Does that not work?
Code:
//scr_debug_msg()
var a = argument[0];
show_debug_message(a[0]);
show_debug_message(a[1]);
show_debug_message(a[2]);
 
Thank you both.

Also, please forgive my stupidity. I just noticed I forgot about a runner variable that needed to be on, which was commented out, but forgot to uncomment. So I assumed something was wrong with the way the list was being read. Issue is resolved.
 
Top