Yes that is exactly what I want, although you produce a different rezz ID than me which should be no surprise.
This shows that the first time the script is loaded, the ID is not yet issued by the server and shows all zeros, but as Zappoman said, in this case all zeros is a workable ID as it will be the only object recognized by your script as all zeros.
Then when we call mousePressEvent(event) we get the registered ID.
this will be the same ID as we get when we turn on the (editModels.js) model selector and select an object, I found the ID given by the findRayIntersection mouse touch has changed from the originalProperties, which leads me to believe that the ID retrived by the raytrace is the correct one.
But I think the reason we get another different ID returned when we call doorEntityID is because it is giving us originalProperties, every time, and I think this is the token ID given by the viewer, because as you noted everytime the script is run, even with a different model, it will continue to return that original properties ID (which is no longer valid because we have changed from the original now.)
Delete any old doors and stop the door script.
Have some other object inworld ready to click, with your editModels selector on, click the object and note the ID from the log.
Then run the door script, check the log, note the ID of the object that came in, if the script has changed from last run you will get all zeros. If the script hasnt changed you will get the same ID as last time.
Now click on the door,
What we get will be a click result from the editModels selector, and 3 results from your script, the first 2 IDs (“door” and “rezz”) will be the original properties ID and the last value (“Click”) should be the real ID which should match the ID returned by the editModels selector.
Finally if you click on the other object you will get its ID from the editModels selector
and from your script you will see the same old ID again twice as it returns the original properties of the script, but the last ID is the one from the raytrace which should be the same as the editModels one, proving it to be the correct one.
Please anyone feel free to correct me in any of this because this is not documentation, this is all guesswork, trial and error, perseverance and some faith.