Welll.... there is another possibility here.
When you rez an object with llRezObject, the last parameter is an integer "param" for that object, which the newly rezzed object can get via llGetStartParameter() and in its "on_rez()" event. You could have the newly rezzed object then call llSetRemoteScriptAccessPin() using this parameter as the PIN.
This allows any external object to load a script, provided they know the PIN. Your rezzer could then load a script that simply contains llDie() in default/state_entry.
So you could have the following 3 code snippets. Lets call the two objects rezzer (the object that does the rezzing) and rezzee (the object that is rezzed)...
Code snippet for rezzer :
integer someMagicNumber; // global variable
key rezzedObjectKey; // global variable
...
// code that rezzes the object
llRezObject(objectName, objectPos, objectVel, someMagicNumber);
...
// event handler to get rezzed object's key
object_rez(key id)
{
rezzedObjectKey = id;
}
...
// code that kills the rezzee
llRemoteLoadScriptPin(rezzedObjectKey, "killer", someMagicNumber, TRUE, 0);
Code snippet for rezzee :
// this event handler will set the remote access PIN based on start parameter
on_rez(integer param)
{
llSetRemoteScriptAccessPin(param);
}
Code for "killer" script :
default
{
state_entry()
{
llDie();
}
}
Its not quite as elegant as the C++ code you wrote, but except for the "on_rez()" event that you MUST have inside of rezzee somewhere to setup the PIN, this puts the onus on rezzor to manage everything.
- Ace