Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

GMLive.gml

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

[Fixed in 1.0.48+] Expected an index Error

A topic by Klno created Mar 10, 2021 Views: 187 Replies: 3
Viewing posts 1 to 2
(6 edits)

Ive gotten this error on some pieces of code, the code works whenever it isn't being updated

[live][3/10/2021 11:04:36 AM] Runtime error: [error] Expected an index    called from obj_moving_platform:Other_11[L2,c20]


It might have something to do with me using the user events rather than step.


This is the code that triggers the error

if live_call() return live_result;

if (instance_exists(creator))

{

x=creator.x+xOff*xsMult;

y=creator.y+yOff;

var xdif=x-xprevious;

with par_alive

if (noOneWayTime<=0)

{

if (id!=other.creator && y<other.bbox_top)

{

if (place_meeting(x,y+12,other)) 

{

if (!place_meeting(x+xdif,y,par_unpassable)) x+=xdif;

if (vspd>=0) 

{

vspd=0;

var spr_yoff=sprite_get_yoffset(mask_index);

y=other.bbox_top-spr_yoff;

}

}

}

}

}

else instance_destroy();

Developer

If I were to guess, your creator is an instance struct reference while the manual says that input is an object index or an instance index, meaning that struct ref is either just undocumented or undefined behaviour https://manual.yoyogames.com/#t=GameMaker_Language%2FGML_Reference%2FAsset_Management%2FInstances%2Finstance_exists.htm

didn't clarify that, creator is just an instance id

Developer

I bet not, try doing show_debug_message(creator) and show_debug_message(typeof(creator))