Jump to content

Error with the llStopAnimation


GEARspirit
 Share

You are about to reply to a thread that has been inactive for 1447 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hi, this newbie has a simple and maybe silly question... i've been working in a simple HUD to trigger animations but i got an error when trying to stop the last anim... using the variable LastPlayed... can you help me please? ty

 

    touch_start(integer total_number)
    {
        llRequestPermissions(llDetectedOwner(0), PERMISSION_TRIGGER_ANIMATION);

        string nameLinked = (string)llGetLinkName(llDetectedLinkNumber(0));       
            if (nameLinked == "01z") 
            {
               llSetLinkPrimitiveParamsFast(1,[PRIM_ROT_LOCAL,llEuler2Rot(<PI/2,0.0,0.0>)*llGetLocalRot()]);
            } 
            else if (nameLinked == "02z") 
            {
               llSetLinkPrimitiveParamsFast(1,[PRIM_ROT_LOCAL,llEuler2Rot(<-PI/2,0.0,0.0>)*llGetLocalRot()]);
            }   
            else if (nameLinked == "01a") 
            {
               llStopAnimation(LastPlayed);
            }                           
            else if (nameLinked == "02a") 
            {
               llStartAnimation("anim");
               string LastPlayed ="anim";
            }         

Link to comment
Share on other sites

I think you need to make the variable LastPlayed global. Declare it before the state default part of your script. As it stands, the variable is declared and created in the "02a" section of the script and is only available there.

So:

string LastPlayed;

state default
{
    //...

    touch_start (integer total_number)
    {
        //...

        else if (nameLinked == "02a")
        {
            llStartAnimation ("anim");
            LastPlayed = "anim";
        }
    }
}

(Or, seeing as you seem to be referring to a run-time error rather that a compiler error, I suspect you've already declared LastPlayed as a global variable, but you're creating a new variable, also called LastPlayed, in that section of code which supersedes the global variable. Just drop the "string" from the line string LastPlayed ="anim"; so the script will use the original global variable and not create a new, temporary, one.)

Edited by KT Kingsley
  • Like 2
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1447 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...