Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics


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

[GM bug 😮] Arrays in script as arguments work only if GMLive enabled???

A topic by Mirza_H created Jul 23, 2019 Views: 137 Replies: 1
Viewing posts 1 to 2
(2 edits)


I'd like to preface this query by highlighting that I am aware of the copy-on-write limitation with GMLive. That said, its strange that the array and script setup I have works correctly if GMLive is enabled. When GMLive is disabled, the arguments passed end up as undefined.

My setup is as follows:

Create ev:


Alarm[0] ev:

var script_arr;
script_arr[0] = scr_debug_msg;
script_arr[1] = ["msg1","msg2","msg3"];

Step ev:

if keyboard_check_pressed(192)
var script_arr = list[| 0];

Inside scr_debug_msg:

if (live_call(argument0,argument1,argument2,argument3)) return live_result; 
var script_args = argument[0];
for (var i=1;i<=array_length_1d(script_args);i++) {
   argument[i] = script_args[i-1];

When scr_debug_msg is run, the first message I get is the one that script_arr[1] refers to (i.e. { { msg1, msg2, msg3 } }). The next three dialogue boxes show undefined. This is when the "live_enabled" macro is set to 0. If the live_enabled macro is set to 1, the script works perfectly fine and the three dialogue boxes after the first correctly show msg1, msg2 and msg3 respectively. 

I'm confused since I thought the opposite should have been the case, where the script would work fine with GMLive disabled, but not work when enabled. 

Any help is appreciated. Thanks!


Modifying the script's arguments is not something that is promised to work at all, and only happens to work in GMLive because the current implementation stores them in an array (so writing past the end of it expands the array and argument_count/argument# reflect that).

I'd suggest to see if you can rearrange code to not overwrite script arguments because this will definitely fail in HTML5 export as well.