I have some flags that affect how my object behaves. When I copy the object in-world using the SHIFT+Drag method, those flags remain the same. But I need them to reset on touch, BEFORE doing anything, since it's a new object, but wasn't rezzed. So here is my solution...question follows.
CODE
integer my_flag;My question: Is the use of llReSetScript() here redundant? Furthermore, in regards to init(), is that even neccessary if I establish the default values when I declare them?
key my_key;
init()
{
my_flag = FALSE;
my_key = llGetKey();
}
default
{
state_entry()
{
init();
}
on_rez(integer start_program)
{
init();
llResetScript();
}
touch_start(integer total_number)
{
if(my_key != llGetKey())
{
init();
llResetScript();
}
}
}
Once again, I'm at work and unable to test my assumptions, but doe the following code do the same thing, but without the call to init()?
CODE
integer my_flag = FALSE;
key my_key = llGetKey();
default
{
state_entry()
{
//nothing to do here.
}
on_rez(integer start_program)
{
llResetScript();
}
touch_start(integer total_number)
{
if(my_key != llGetKey())
{
llResetScript();
}
}
}
Thanks for the help...