Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / how to check if all 3d objects were loaded correctly to perform a loading screen?

Author
Message
SkinK4ir3
9
Years of Service
User Offline
Joined: 25th Aug 2015
Location:
Posted: 27th Feb 2023 19:15
Hello everyone, I'm making a loading screen, however, I don't know how to check if the 3d objects were properly loaded (they are objects to compose a map) .
Can anyone give me a light ?
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 1st Mar 2023 00:06
Well unfortunately there is not a return on the load of object if it fails for succeeds. So the only thing u can do is check if object getobjectexists(I'd).

blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 1st Mar 2023 02:44
You could seterromode(0) and use getlasterror()
Raven
19
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 19th Mar 2023 00:13
ObjectID = LoadObject( Filename$ )

Assuming you want to do something IF it doesn't load...
If Not( ObjectID )
Message( Filename$ + " Object Not Loaded." )
EndIf

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.


Login to post a reply

Server time is: 2024-11-21 09:38:05
Your offset time is: 2024-11-21 09:38:05