Sorry if this should be in scripting forum but since TRS19 is in early release and more people see this thread....... Please could someone from N3V answer? Chris?
I am using the new World.GetGameObjectByID() call to see if an asset still exists in the world and has not been deleted. (I mean deleted not just unloaded).
The call seems to produce the desired result but only if the asset I am checking has something typed into the ‘name’ box. If that box is blank then no result will be returned even if the asset is in plain view.
My question is, why if I have a reference to the GameObjectID does the asset also need to have had a previously typed in name for GetGameObjectByID to work? Could this change in a future version?
I am using this in Surveyor Mode to check if any ATLS Controllers have been deleted. The default for most ATLS assets is a blank name box. The implications are that all existing Routes with ATLS in them will have to be edited and a ‘name’ typed in to all the existing ATLS assets. (New ones can use autoname).
To clarify, in the following bit of Library script, ‘ControllerIds[]’ is an array of Controller assets which have contacted the Library.
If the asset still exists ‘results.size()’ will equal 1. If deleted it will be 0. However, if any asset has a blank name, ‘results.size()’ stays 0 even if that asset still exists! Is this by design?
Thanks
Mike.
thread void CheckChannels() {
int i;
Message msg;
for (i = 0; i < ControllerIds.size(); i++) {
deleted = false;
AsyncObjectSearchResult searchObj = World.GetGameObjectByID(ControllerIds,false);
Sniff(searchObj, "ObjectSearch", "AsyncResult", true);
wait()
{
on "ObjectSearch", "AsyncResult", msg:
if (msg.src != searchObj) continue;
break;
}
NamedObjectInfo[] results = searchObj.GetResults();
if (results.size() == 0) deleted = true;
}
for (i = 0; i < deleted.size(); i++) {
if (deleted) {ControllerIds[i,i+1] = null;Channels[i,i+1] = null;deleted[i,i+1] = null;break;}
}
}
I am using the new World.GetGameObjectByID() call to see if an asset still exists in the world and has not been deleted. (I mean deleted not just unloaded).
The call seems to produce the desired result but only if the asset I am checking has something typed into the ‘name’ box. If that box is blank then no result will be returned even if the asset is in plain view.
My question is, why if I have a reference to the GameObjectID does the asset also need to have had a previously typed in name for GetGameObjectByID to work? Could this change in a future version?
I am using this in Surveyor Mode to check if any ATLS Controllers have been deleted. The default for most ATLS assets is a blank name box. The implications are that all existing Routes with ATLS in them will have to be edited and a ‘name’ typed in to all the existing ATLS assets. (New ones can use autoname).
To clarify, in the following bit of Library script, ‘ControllerIds[]’ is an array of Controller assets which have contacted the Library.
If the asset still exists ‘results.size()’ will equal 1. If deleted it will be 0. However, if any asset has a blank name, ‘results.size()’ stays 0 even if that asset still exists! Is this by design?
Thanks
Mike.
thread void CheckChannels() {
int i;
Message msg;
for (i = 0; i < ControllerIds.size(); i++) {
deleted = false;
AsyncObjectSearchResult searchObj = World.GetGameObjectByID(ControllerIds,false);
Sniff(searchObj, "ObjectSearch", "AsyncResult", true);
wait()
{
on "ObjectSearch", "AsyncResult", msg:
if (msg.src != searchObj) continue;
break;
}
NamedObjectInfo[] results = searchObj.GetResults();
if (results.size() == 0) deleted = true;
}
for (i = 0; i < deleted.size(); i++) {
if (deleted) {ControllerIds[i,i+1] = null;Channels[i,i+1] = null;deleted[i,i+1] = null;break;}
}
}