Triggered when an object is rezzed (by script or by user). Also triggered in attachments when a user logs in, or when the object is attached from inventory.
on_rez( integer start_param )
Event ID: 27.
start_param is always zero when an object is not rezzed by llRezObject or llRezAtRoot.
When an object is rezzed by llRezObject or llRezAtRoot, then start_param will be the value given as the last parameter of the rezzing command.
start_param is available at any subsequent time by calling llGetStartParameter (unless it has been overridden by llRemoteLoadScriptPin).
default
{
on_rez(integer start_param)
{
// Restarts the script every time the object is rezzed
llResetScript();
}
}
state_entry will be triggered prior to on_rez if state_entry has not been run prior.
on_rez will be triggered prior to attach when attaching from inventory or during login.
If the script was already processing an event at rez time, on_rez does not not trigger until the current event handler is completed. (same with attach)