Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

How do you stop a script?

Vi Shenley
Still Rezzing
Join date: 24 Oct 2006
Posts: 103
06-30-2008 09:42
Hi,

I have a script that animates a texture, and over 10 seconds it gradually reduces the rate of animation, and the transparency of the prim. What I am scratching my head about is how to stop the script once this is done. For example, is there any command I could put after the 'if' statement?

CODE

float rate = 0.5;
float alpha = 1.0;

default
{
state_entry()
{
llSetTimerEvent(10); //set to 10secs per event for debug only
}

timer()
{
llSetAlpha(alpha, ALL_SIDES);
llSetTextureAnim(ANIM_ON | SMOOTH | LOOP, ALL_SIDES, 0, 0, 0.0, 1, rate);
rate = rate - 0.1;
alpha = alpha - 0.2;
llSay(0, (string) rate + ", " + (string) alpha); //debug only
if (rate =< 0.1)
{

}
}

}


Vi
Cheree Bury
ChereeMotion Owner
Join date: 6 Jun 2007
Posts: 666
06-30-2008 10:04
From: Vi Shenley
Hi,

I have a script that animates a texture, and over 10 seconds it gradually reduces the rate of animation, and the transparency of the prim. What I am scratching my head about is how to stop the script once this is done. For example, is there any command I could put after the 'if' statement?

CODE

float rate = 0.5;
float alpha = 1.0;

default
{
state_entry()
{
llSetTimerEvent(10); //set to 10secs per event for debug only
}

timer()
{
llSetAlpha(alpha, ALL_SIDES);
llSetTextureAnim(ANIM_ON | SMOOTH | LOOP, ALL_SIDES, 0, 0, 0.0, 1, rate);
rate = rate - 0.1;
alpha = alpha - 0.2;
llSay(0, (string) rate + ", " + (string) alpha); //debug only
if (rate =< 0.1)
{

}
}

}


Vi



llSetTimerEvent(0) will stop the timer.

if (rate =< 0.1)
{
llSetTimerEvent(0);
}
Xhawkx Holden
Registered User
Join date: 1 Nov 2006
Posts: 86
06-30-2008 11:03
Use..


Function: llSetScriptState( string name, integer run );


Set the running state of the script name.
• string name – a script in the prim's inventory
• integer run – boolean, if FALSE the script will be disabled.

Found here:
http://wiki.secondlife.com/wiki/LlSetScriptState
Vi Shenley
Still Rezzing
Join date: 24 Oct 2006
Posts: 103
06-30-2008 11:23
Many thanks guys.

:)

Vi