Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: Reset a script on rez ONCE

Graysen Graff
Registered User
Join date: 1 Oct 2005
Posts: 16
05-23-2006 14:23
I am very new to scripting so be kind! :-)

CODE
//Reset on Rez ONCE
//by Graysen Graff
//
//This script will cause another script in the same prim to be reset when the
//object is rezzed for the first time. It will then delete itself so that
//the reset on rez is a one-time event.
//
//Freely given to the SL community for any purpose including commerical use.
//With thanks to those before me who have so freely shared so others
//can learn.



default
{
state_entry()
{
llSay(0, "Reset script active!");
}

on_rez(integer start_param)

{
llSay(0, "Initializing...");
llResetOtherScript("name of script to be reset goes here");
llSay(0, "Done!");
llRemoveInventory("name of this script goes here");
}

}
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Original Thread
05-27-2006 16:15
/15/62/108528/1.html
_____________________
i've got nothing. ;)
Marcuw Schnook
Scripter
Join date: 24 Dec 2005
Posts: 246
07-12-2006 09:13
I'd alter code a bit to the following, with some comments:
CODE

//Reset on Rez ONCE
//by Graysen Graff
//
//This script will cause another script in the same prim to be reset when the
//object is rezzed for the first time. It will then delete itself so that
//the reset on rez is a one-time event.
//
//Freely given to the SL community for any purpose including commerical use.
//With thanks to those before me who have so freely shared so others
//can learn.
// Marcuw Schnook, some additions

// vv Change the line below; Alter the text within the "
string SCRIPT_TO_RESET="name of the script to be reset";
// ^^ --------- NOTHING NEEDS TO BE EDITED BELOW THIS LINE -------

default
{
state_entry()
{
// Using llOwnerSay prevents a lot of spam on spatial chat
// (channel 0). Who else would need to know that this script is
// active besides the owner of the object?
llOwnerSay("Reset script active!");
}

on_rez(integer start_param)
{
llOwnerSay("Initializing...");
llResetOtherScript(SCRIPT_TO_RESET);
llOwnerSay("Done!");
// Using llGetScriptName will return the name of this script,
// so there is no need to alter the name manually (if one
// renames the script).
llRemoveInventory(llGetScriptName());
}
}

This would probably my version.
Jesse Malthus
OMG HAX!
Join date: 21 Apr 2006
Posts: 649
07-12-2006 21:19
Cool. Autoreconfiguration on first rez.
Jill Vinson
Not a zombie
Join date: 8 Jul 2006
Posts: 10
07-19-2006 23:32
Hey thanks your a lifesaver, I made weapons and monsters but noticed that they dont work when they spawn first. I owe you one
_____________________