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.34+] view_camera is not an array

A topic by Terry DuBois created Sep 21, 2020 Views: 295 Replies: 3
Viewing posts 1 to 3

Hello! I just switched to GM 2.3 and was setting up GMLive again. When using the view_camera as an array, as in view_camera[0], GMLive throws an error claiming "view_camera is not an array". Although, it does not throw any errors when the variable is used just as view_camera. I have not encountered this problem before switching to GM 2.3. Do you know why that is?

Developer

Hello! As odd it sounds, you get that error because it really isn't an array - this bunch of built-in variables (alarm[], view_*, few others) are a special case (v = alarm[i] calls alarm_get, alarm[i] = v calls alarm_set), trying to access them as-is accesses the first item instead, and thus when GMLive does an equivalent of

var value = variable_global_get("view_camera");
var result = value[index];

that doesn't work out because we get view_camera[0] in value.

For 2.2.5 I had a giant (10K lines) file for accessing every built-in function/variable, which I had mostly trimmed down now (thanks to introduced ability to reference built-in functions in 2.3)... except I forgot about view_ variables. I'll fix that for the next release.

Developer

This is fixed in 1.0.34+

Ha, I never realized those arrays were a facade in a way. Thank you for fixing that in the new release nevertheless!