12-07-2006 20:07
When an object running a script is taken into inventory then rezzed again it should continue to run where it left off. So why is a script reset when it is set to not running then taken into the inventory then rezzed and set to running again?

In a previous thread...
/139/7b/99650/1.html#post984243
scripts current state being lost becasue a sim crash. That I can understand. Pheonix's comment that a script state is stored when detached leads me to believe it should store whether it running or not.


use this script to test.
-Put it in a object.
-It should count.
-Take it. notice the number is at when taken.
-Rez it. it should continue where it left off.
-Set the script to not running.
-Take it again and rez it.
-Set the script to running. Notice it starts at one.
Is this correct?

CODE

integer i = 0;
default
{
state_entry()
{
while (1)
{
i++;
llSleep(1.0);
llSetText((string)i, <1,1,1>, 1.0);
}
}
}

EDIT:
Also found if worn and set not running the script gets reset when crossing regions as well. Or just moving the prim to another sim casue the reset. The more I play with this I think it is some old bug that has been festering in the corner. That or it is a limit makes it so you have no way of storing the script correcly when it is set to not running. But this would be such a useful function in the Lag reduction Have scripts turn other script off when not needed. But for fear that they would be reset would be a problem when a sim is reset. Not a crash but even a simple sim reset. Having llSetScriptState work correctly would give you one very powerful script in the war agaist Lag.