I just try to detect with my script that is inside entity when you close interface or get out of range etc. I got as advise to use scriptending. That worked in 2014 fine After that not used it much.
Here’s a part of the code,
function scriptEnding()
{
var Avatarinrange=AvatarList.isAvatarInRange (basepos, 10);
print("script end");
}
//-------------
function ParamsEntity()
{
return;
}
ParamsEntity.prototype =
{
preload: function(entityID)
{
Ent = entityID;
parentID = Entities.getEntityProperties(Ent, ['parentID']).parentID;
//print("Parent EntID "+parentID);
initdoor();
},
doorHandleTouched: function()
{
print("DOORhandleTouched");
movedoor()
}
}
Script.scriptEnding.connect(scriptEnding);
return new ParamsEntity();
To make sure i did not do anything wrong i tried the example from the wiki.
(function()
{
print("This script just prints this line and then ends.");
function scriptEnding()
{
print("SCRIPT ENDNG!!!");
}
// register our scriptEnding callback
Script.scriptEnding.connect(scriptEnding);
})
But also this ex ampel does not trigger the scriptending. Bug or do i make a error. or does scriptedning not work inside a entity ? and what would be the right command instead if scriptending not work ?
ADD: I knew that i have seen this problem before , but this forum is hard place to find something. I go try soem suggestions from this topic.