Difference between revisions of "LlResetOtherScript"

From Second Life Wiki
Jump to navigation Jump to search
(It took me a while to understand what the sentance framgent was trying to convey, i think this rearrangment helps. Also reordered the a few of the fields to aid readability.)
m (changed example script to not have an open listener......geez)
Line 17: Line 17:
|examples=
|examples=
<lsl>
<lsl>
integer menu_channel = -2345;
// the other script must be within the same prim and has to be running


default
default
{
{
state_entry(){
    touch_start(integer num_detected)
llListen(menu_channel, "", "", "");
    {
}
        llResetTime();
    }
touch_start(integer total_number){
llDialog(llDetectedKey(0), "Reset database script?", ["Yes", "No"], menu_channel);
}


listen(integer channel, string name, key id, string message){
    touch_end(integer num_detected)
if (message == "Yes"){
    {
llSay(0, "Reseting script...");
        float timePassed = llGetAndResetTime();
llResetOtherScript("Database_script"); // The script must be in the same prim and does have to be running
 
} else
        if (timePassed < 3.0)
llSay(0, "Operation canceled");
            llSay(PUBLIC_CHANNEL, "Please click & hold for at least 3.0 seconds.");
}
        else
            llResetOtherScript("database_script.lsl");
    }
}
}
</lsl>
</lsl>

Revision as of 11:22, 24 September 2012

Summary

Function: llResetOtherScript( string name );

Resets script name.

• string name a script in the inventory of the prim this script is in

On script reset...

  • The current event/function is exited without further execution or return.
  • All global variables are set to their defaults
  • The event queue is cleared, and recurring events are stopped.
  • The default state is set as the active state

Caveats

  • If name is missing from the prim's inventory or it is not a script then an error is shouted on DEBUG_CHANNEL.
  • If the script is not running, this call has no effect, even after the script is set running again.
  • A script can reset itself with this function (not just other scripts).
All Issues ~ Search JIRA for related Bugs

Examples

<lsl> // the other script must be within the same prim and has to be running

default {

   touch_start(integer num_detected)
   {
       llResetTime();
   }
   touch_end(integer num_detected)
   {
       float timePassed = llGetAndResetTime();
       if (timePassed < 3.0)
           llSay(PUBLIC_CHANNEL, "Please click & hold for at least 3.0 seconds.");
       else
           llResetOtherScript("database_script.lsl");
   }

}

</lsl>

See Also

Functions

•  llResetScript
•  llGetScriptState
•  llSetScriptState

Deep Notes

Search JIRA for related Issues

Signature

function void llResetOtherScript( string name );