Not built in, but Matrix 1 provides some useful commands to help:
find free object() /find free image() / find free {whatever}()
And
generate guid$()
I set up a custom media module that will handle locating an available resource number, determine if the object should be loaded, cloned, or instanced, or for images, if it is already loaded just return the existing image number, and will generate a guid string to identify it.
Basically, everything that is loaded gets tracked in media arrays storing file name, guid, object/image/sound etc number.
I then have getter functions which return a reference to the data along these lines:
Media_loadObject (filepath, canInstance)
Media_getObjectByID (guid)
Media_getObjectByNum (objNum)
Media_getObjectsByFile (filepath)
Media_replaceObject (oldguid, newFilepath)
The actual module/functions/data returns are a bit more detailed,but that should give you an idea of the work flow
Ideally, you should never need to know specifically what image number, object number etc a resource is using, just store them to more abstract variables and only worry aboot the actual value when viewing a log or debug output for trouble shooting
A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.