Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

GMLive.gml

Livecoding for GameMaker: Studio / GameMaker Studio 2 · By YellowAfterlife

"DoSub :2: illegal array use" - Reloading some live scripts that contain ds_lists can cause problems. Workaround found..

A topic by Fawf_art created Jul 20, 2022 Views: 336 Replies: 2
Viewing posts 1 to 2

There seems to be an issue with reloading scripts where lots of data is added to a ds_list, thankfully I've found a workaround so hopefully this is useful to someone.

Was getting this error when reloading the create event of a particular object

[live][20/07/2022 10:23:23] Runtime error: [error] { line : 534, script : "gml_Script_vm_group_field_on_field_set", message : "DoSub :2: illegal array use", longMessage : "ERROR in action number 1 of Other Event: User Defined 10 for object obj_bedeBoss:

DoSub :2: illegal array use  at gml_Script_vm_group_field_on_field_set (line 534) -     var l_z=l_st[0]-1; ", stacktrace : [ "gml_Script_vm_group_field_on_field_set (line 534)","gml_Script_anon_gml_thread_gml_GlobalScript_GMLive_thread_3298_gml_thread_gml_GlobalScript_GMLive_thread (line 109) -                     var l_ar1=l_handler(l__gthis,l_act); ","gml_Script_anon_gml_program_gml_GlobalScript_GMLive_program_1897_gml_program_gml_GlobalScript_GMLive_program (line 58) -             l_th.h_exec(); ","gml_Script_live_proc_call_impl (line 33) -     var l_th=l_pg.h_call_v(l_scriptName,l_args1,false); ","gml_Script_live_call (line 74) -                 return live_proc_call_impl(l_data,l_vals,l_def); ","gml_Object_obj_bedeBoss_Other_20 (line 2) - if (live_call()) return live_result; ","gml_Object_obj_bedeBoss_Step_0 (line 3)" ] }  called from game:gml_std_haxe_Exception_caught:1235  called from game:anon_gml_thread_gml_GlobalScript_GMLive_thread_3298_gml_thread_gml_GlobalScript_GMLive_thread:119  called from game:anon_gml_program_gml_GlobalScript_GMLive_program_1897_gml_program_gml_GlobalScript_GMLive_program:58  called from game:live_proc_call_impl:33  called from game:live_call:74  called from game:obj_bedeBoss_Other_20:2  called from game:obj_bedeBoss_Step_0:3  called from 0  called from obj_bedeBoss:Other_20[L221,c36]

Tracked the culprit down to this particular piece of the script

ds_attack_sequence[4] = ds_list_create();
ds_list_add(ds_attack_sequence[4],
"set pdata",0,1.5,260,24,14,
"starfan1","wait15",
"set pdata",0,1.5,265,24,14,
"starfan1","wait15",
"set pdata",0,1.5,270,24,14,
"starfan1","wait15",
"set pdata",0,1.5,275,24,14,
"starfan1","wait15",
"set pdata",0,1.5,280,24,14,
"starfan1","wait60",
"set pdata",0,1.5,280,24,14,
"starfan1","wait15",
"set pdata",0,1.5,275,24,14,
"starfan1","wait15",
"set pdata",0,1.5,270,24,14,
"starfan1","wait15",
"set pdata",0,1.5,265,24,14,
"starfan1","wait15",
"set pdata",0,1.5,260,24,14,
"starfan1","wait60"
);
Commented out, it would reload fine and not throw the error. When I split the data between two different ds_list_add functions I no longer got the error.

ds_attack_sequence[4] = ds_list_create();
ds_list_add(ds_attack_sequence[4],
"set pdata",0,1.5,260,24,14,
"starfan1","wait15",
"set pdata",0,1.5,265,24,14,
"starfan1","wait15",
"set pdata",0,1.5,270,24,14,
"starfan1","wait15",
"set pdata",0,1.5,275,24,14,
"starfan1","wait15",
"set pdata",0,1.5,280,24,14)
ds_list_add(ds_attack_sequence[4],
"starfan1","wait60",
"set pdata",0,1.5,280,24,14,
"starfan1","wait15",
"set pdata",0,1.5,275,24,14,
"starfan1","wait15",
"set pdata",0,1.5,270,24,14,
"starfan1","wait15",
"set pdata",0,1.5,265,24,14,
"starfan1","wait15",
"set pdata",0,1.5,260,24,14,
"starfan1","wait60"
);
Don't know why this happens but I hope this is helpful. This is on runtime v2022.5.2.13
Developer

GMLive supports up to 80 arguments per call (so you’re barely exceeding the limit), although it is unclear as to why you’re not getting the intended show_error message and instead seeing a completely unrelated call stack.

OK, interesting good to know!