I've found asset_get_index to be an invaluable feature within Game Maker Studio, and one that - after discovering it - stopped me from going back to 8.1.
Essentially the syntax is:
With the option of a variable as the value. It's very handy when dealing with dynamic content such as clothes, by naming various indexed sprites like shirt01 and then simply doing something like:
_get_name() functions are implemented and functional.
resource_get_id sadly isn't - that is the ENIGMA's equivalent which apparently turned into asset_get_index in GMS. The plugin must be changed to implement it though (not the engine), as it would have to be implemented in IDE_EDIT_resourcenames.h as is _get_name() functions.
Line 1, position 14 (absolute 13): Unknown function or script `room_get_name' Line 2, position 16 (absolute 38): Unknown function or script `object_get_name' Line 3, position 16 (absolute 64): Unknown function or script `sprite_get_name'
If you do a search for them you can see that they're all defined, hence why they get highlighted by jedit, but they're not implemented.
They are implemented in IDE_EDIT_resourcenames.h. I have used them in ENIGMA. I guess it is just another thing that broke.
In fairness it should be noted that
asset_get_index()function could be implemented in GM 8.1.
var temp, result; temp = variable_local_get(argument0); variable_local_set(argument0, -1); result = execute_string("return "+argument0); variable_local_set(argument0, temp); return result;
That's a frightening design pattern, but it shows up more frequently than you might think.
Anyway, the compiler writes those files, not the engine, so it's an easy task. I may do it this weekend (for
I just did
show_message(room_get_name(room));in a single object in a new game and it showed me the name of the room just fine. How were you calling those functions @faissaloo?
We are also missing asset_get_type:
@RobertBColton I've tried both a room creation event and the draw event with
show_message(room_get_name(rm_0))it worked in neither.
Uhm, wow that's weird. Are you sure you are on the latest master and testing a blank project?
show_message(room_get_name(rm_2)); works fine for me too creating a couple of empty rooms... room create works too...
It shows me a popup with "rm_2" in it. Those functions are all implemented:
Yep, I reinstalled and created a brand new project. Same issue, maybe that file isn't being included on Linux or something? Maybe it has something to do with the version of GCC?
This is really weird then, does
room_restartwork? Because it is declared just above
room_get_namewhich is definitely implemented... in universal_system too.
Can you also look in this file and see if its actually there in your copy?
room_restart()works and both the header and source file are present.
However, it just occurred to me what is probably happening, room_get_name() returns string right? And when I clone master the hotfix for the string issue is no longer present, so it must be caused by #978
Oh boy, that sounds like it maybe? Try applying the hotfix again and see if it works? We really need to figure that bug out.
Cool beans! So what we are missing then is