ObjectID = LoadObject( Filename$ )
Assuming you want to do something IF it doesn't load...
If Not( ObjectID )
Message( Filename$ + " Object Not Loaded." )
I would ALWAYS recommend allowing AGK/DBP to Automatically Generate the ID.
The only reason you'd want to manually set ID is when you want to keep specific objects in a given order., but it still remains a better practise to simply create an Array that you populate in the order of said objects; then instead of saying "All my Trees are ObjectID 1500 - 1600"., instead you just check your ObjectTree[ ] Array that has all the IDs stored.
This is typically a better practise as well... because let's say we hardcode ID values.
We start with, 10 Trees, 8 Boxes, 3 Barrels, etc. and we then hardcode the Trees 1001 - 1010, Boxes 1011 - 1019, Barrels 1020 - 1023, etc.
Well then what happens if you add another 5 Tree Variations?
You have to either change ALL of the other hardcoded values or move the Tree Range.
If on the other hand you load these into an Array., well the Array can grow and string as you need it to; and we don't even have to specifically change ranges for any IFs or anything because we're just checking ObjectTree.Length - 1 as our "End" and we never need to know the actual ObjectIDs.
You code in this respect is just written once and remains adaptive as things grow and shrink; where-as Hardcoded doesn't, as depening on the number of references can result in A LOT of editing later if you want to add or remove.
Smart Coding is that which is adaptive to Scale., meaning it's just as effective for a simple prototype as it is a final product.
It also will rely more heavily on Simplification.
While of course you should add comments as little reminders as to what is doing what., personally I work to the idea that IF I can't understand what's going on without said comments; my solution is likely needlessly complicated.