Difference between revisions of "LlResetOtherScript"

From Second Life Wiki
Jump to navigation Jump to search
(it does have to be active... as explained above. otherwise it's not reset)
m (<lsl> tag to <source>)
 
(8 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{LSL_Function/inventory|name|uuid=false|type=script}}
{{LSL Function
{{LSL_Function
|inject-2={{LSL Function/inventory|name|uuid=false|type=script}}
|func_id=249|func_sleep=0.0|func_energy=10.0
|func_id=249|func_sleep=0.0|func_energy=10.0
|func=llResetOtherScript|p1_type=string|p1_name=name
|func=llResetOtherScript|p1_type=string|p1_name=name
|func_desc=Resets script {{LSLP|name}}.
|func_footnote=On script reset...
|func_footnote=On script reset...
*The current event/function is exited without further execution or return.
*The current event/function is exited without further execution or return.
Line 9: Line 10:
*The [[default]] state is set as the active state
*The [[default]] state is set as the active state
**If it has a [[state_entry]] event, then it is queued.
**If it has a [[state_entry]] event, then it is queued.
|func_desc=Resets script '''name'''
|return_text
|spec
|spec
|caveats=*If the script is not running, this call has no effect, even after the script is set running again.
|caveats=
*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).
|constants
|constants
|examples=
|examples=
<lsl>
<source lang="lsl2">
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...");
        if (llGetTime() < 3.0)
llResetOtherScript("Database_script"); // The script must be in the same prim and does have to be active
            llSay(0, "Please click & hold for at least 3.0 seconds.");
} else
        else
llSay(0, "Operation canceled");
            llResetOtherScript("second");
}
    }
}
}
</lsl>
</source>
|helpers
|helpers
|also_functions={{LSL DefineRow||[[llResetScript]]|}}
|also_functions={{LSL DefineRow||[[llResetScript]]|}}
Line 46: Line 44:
|notes
|notes
|sort=ResetOtherScript
|sort=ResetOtherScript
|cat1=Script
|cat1=Inventory
|cat2=Stop
|cat2=Script
|cat3
|cat3=Stop
|cat4
|cat4=
}}
}}

Latest revision as of 13:29, 22 January 2015

Summary

Function: llResetOtherScript( string name );
0.0 Forced Delay
10.0 Energy

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).

Examples

// 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)
    {
        if (llGetTime() < 3.0)
            llSay(0, "Please click & hold for at least 3.0 seconds.");
        else
            llResetOtherScript("second");
    }
}

See Also

Functions

•  llResetScript
•  llGetScriptState
•  llSetScriptState

Deep Notes

Signature

function void llResetOtherScript( string name );