[JIRA] Commented: (SVC-1853) State of not-running scripts is not preserved over a region restart

Jopsy Pendragon (JIRA) no-reply at lindenlab.cascadeo.com
Sat Jan 9 08:10:36 PST 2010


    [ http://jira.secondlife.com/browse/SVC-1853?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=158657#action_158657 ] 

Jopsy Pendragon commented on SVC-1853:
--------------------------------------

Chorazin-

If stopped scripts still consume the same amount of memory, the only benefit to llSetScriptState is that it doesn't respond to events.   May as well use a 'sleeping' state which contains nothing but a link_message() event instructing it to return to an 'active' state.  (obviously not the 'default' state as that would be much like using llResetScript()).    

I was going to use llSetScriptState() as an alternate to llRemoveInventory( llGetScriptName() ) during object testing/debugging (I have objects that rez other objects and then send configuration information) ... so that the script I'm working on wouldn't suddenly "delete itself" but would act as if it were no longer there.   But this bug sounds like I can't rely on the 'dead' script to not wake up and take over again next time I rez the object.

I'm glad this jira is here though..  this restart on rez behavior seems very wrong, so I've voted for it anyway.

As far as I'm aware the chief usefulness to llSetScriptState is for an existing script to start a new script received by llGiveInventory() (which, if I remember correctly automatically sets the new script to Not Running upon delivery).



> State of not-running scripts is not preserved over a region restart
> -------------------------------------------------------------------
>
>                 Key: SVC-1853
>                 URL: http://jira.secondlife.com/browse/SVC-1853
>             Project: 2. Second Life Service - SVC
>          Issue Type: Bug
>          Components: Scripts
>    Affects Versions: 1.19.0 Server, 1.20.0 Server, 1.24 Server
>         Environment: Server-side issue on main grid
>            Reporter: chorazin allen
>            Priority: Major
>
> Put two scripts in an object.
> {code:title=Counter}
> integer count;
> default
> {
>     state_entry()
>     {
>         llSetTimerEvent(1.0);
>     }
>     
>     timer()
>     {
>         count++;
>         llOwnerSay((string)count);
>     }
> }
> {code}
> {code:title=Start/Stop}
> default
> {
>     state_entry()
>     {
>     }
>     touch_start(integer total_number)
>     {
>         integer running=llGetScriptState("Counter");
>         
>         if (running)
>         {
>             llSetScriptState("Counter",FALSE);
>             llOwnerSay("Script stopped");
>         }
>         else
>         {
>             llSetScriptState("Counter",TRUE);
>             llOwnerSay("Script started");
>         }
>     }
> }
> {code}
> Touch the object to see that the Counter script is started and stopped as expected. Let it run for a while, stop it, and note the last value displayed.
> Now restart the region.
> When the region is back, return to the object and touch it to restart the Counter.
> The Counter script, which was stopped, has lost all state and will begin counting from 0 rather than the total it had previously.
> Implications: This is a major headache for those situations where scripts would be stopped because they're not needed at the time or are stopped to reduce peformance impact. If a restart happens whilst they're stopped they do not resume in the same state that they were stopped.
> ---
> Update 20080328...
> This includes any granted Permissions, so in the crude example below, the script will lose the granted Debit permission over a restart if the script was not running at the time. Of course, if the script's owner isn't around to re-grant the permissions things get nasty.
> A really good script would detect that it's unexpectedly lost permissions it had been previously granted. Most won't and will carry on regardless, which could be real nasty in the case of a script that thinks it has the Debit permission to (for example) pay out the prize in a competition.
> Modified version of Counter script (I know this is crude :-) ):-
> {code:title=Modified Counter}
> integer count;
> default
> {
>     state_entry()
>     {
>         llSetTimerEvent(1.0);
>         llRequestPermissions(llGetOwner(),PERMISSION_DEBIT);
>     }
>     
>     timer()
>     {
>         count++;
>         llOwnerSay((string)count);
>         llGiveMoney(llGetOwner(),1);
>     }
> }
> {code}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.secondlife.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the Jira-notify mailing list