2025-07-12 03:59 PM
Looking for a way to gracefully notify user if they don't have the necessary macro loaded in the library.
Solved! Go to Solution.
2025-07-12 08:50 PM
As you probably found out already if you directly call a macro and it's not available the whole object "crashes". Sadly there is no direct way to handle this gracefully, but I found a workaround:
rrr = LIBRARYGLOBAL("object name", "name_of_some_param", value)
If you use the LIBRARYGLOBAL command/request you its result will either be 0 or 1, and if it's 0 it means the object is not in the loaded library (GDL does not actually know beforehand if an object is a true library global or not, that's why this will work without complains!).
2025-07-12 08:50 PM
As you probably found out already if you directly call a macro and it's not available the whole object "crashes". Sadly there is no direct way to handle this gracefully, but I found a workaround:
rrr = LIBRARYGLOBAL("object name", "name_of_some_param", value)
If you use the LIBRARYGLOBAL command/request you its result will either be 0 or 1, and if it's 0 it means the object is not in the loaded library (GDL does not actually know beforehand if an object is a true library global or not, that's why this will work without complains!).
2025-07-13 06:19 AM
Thanks Lucas, that works perfect!
2025-08-18 09:17 AM - edited 2025-08-19 04:50 AM
Thanks for this Runxel,
An interesting limitation I found is I can't use A,B, or ZZYZX. It seems to get a return value from somewhere? so rrr = 1 in this case. Any other parameter is ok, if missing rrr returns 0.
2025-08-19 03:25 AM - edited 2025-08-19 03:26 AM
Probably due to A and B being default parameters for all object types and are hence always discoverable even if the placed object is not loaded. For science, what happens if you query ZZYZX for a missing 2D object?
Ling.
AC22-28 AUS 3110 | Help Those Help You - Add a Signature |
Self-taught, bend it till it breaks | Creating a Thread |
Win11 | i9 10850K | 64GB | RX6600 | Win11 | R5 2600 | 16GB | GTX1660 |
2025-08-19 04:50 AM
returns 1 for rrr and 1.000 for the value of the non-existent ZZYZX....
2025-08-19 08:32 AM
My guess is that there is a "flaw" in how this works internally. MVOs never have these parameters (since they make no sense in this context).
Placeable objects however do. The "result" may come from the subtype, where the A, B and ZZYZX values are set to 1.0.
2025-08-20 05:52 AM
Most likely, although I managed to get a value of 4.4 for A in one instance, for a non existent library part, but couldn't repeat.