Tuesday, December 02, 2008
USERLOGIN PASSWORD Remember?
You are here » Learning Center ยป Forums

Openlife Forums

 Openlife Grid Forums
Minimize
 
  Openlife Forums  Scripting  LSL Help  Pose script not quite working
Previous Previous
 
Next Next
New Post 6/18/2008 1:32 PM
Informative
Online now... Violet Indigo
109 posts
Openlife Handyman




Pose script not quite working 

I found this basic pose script (complete with basic T pose) on the OSGrid scripting forum:

// The most basic of pose scripts

// change to the name of animation contained within your sittable object
string pose = "tpose2";

// change to x,y,z offset of object center where you want to appear (never all 0)
vector target = <0.0, 0.0, 1.5>;

// optional sit text to appear over object
string text = "T-Pose";

default {
    state_entry()
    {
        llSitTarget(target, ZERO_ROTATION);
        llSetSitText(text);
        llSetText(text,<1.0,0.0,0.0>,1.0);
    }

    changed(integer change)
    {
        if (change & CHANGED_LINK)
        {
            if (llAvatarOnSitTarget() != NULL_KEY)
            {
                llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION);
                llStopAnimation("sit");
                llStartAnimation(pose);
                llSetText("",<1.0,0.0,0.0>,1.0);
            }
            else
            {
                llStopAnimation(pose);
                llSetText(text,<1.0,0.0,0.0>,1.0);
            }
        }
    }
}
 

 

The problem is that the T-pose does not stay for more than a second.  At first it went straight to the normal sit pose after the initial T-pose but there is a second post in the thread which says to replace

llStopAnimation("sit");

with the UUID of the sit animation.  I did that and it worked ..... it did stop the sit animation... but the T-pose still only lasted a second or two. 

Can anyone help?

 

Penny

 
New Post 6/18/2008 3:16 PM
User is offline Pratyeka Muromachi
239 posts
Openlife Rising Star




Re: Pose script not quite working 

I don't have much experience with animations, but is your sit pose "looped"? I remember when I created a lotus posture animation, I had to make it "looped". I think it's when you upload the animation that there is the option to have it looped.

 


Meditating Avatar Gone for a walk.
 
New Post 6/19/2008 4:44 AM
Online now... Violet Indigo
109 posts
Openlife Handyman




Re: Pose script not quite working 

Ah - no - I don't suppose that it is looped.  I'll take a look at that.  Thanks Pratyeka.

 
New Post 10/7/2008 9:40 PM
User is offline DarkHealer
9 posts
Openlife Newbie




Re: Pose script not quite working 

Not sure if you got it working or not but I had the same problems. I now use this one and it works fine for me. Also you have to loop the animation and set the Priority to 4 as well. 

 

// -*- mode: lsl; indent-tabs-mode: nil; c-file-style: "stroustrup"; -*-
// Pose Ball script, Revision 5.0

// modified for Open Simulator 2008-04-26 by Jodie Marsh

// By CrystalShard Foo.
// Work started - October 10th.
// Last compile - November 7th.

// This script is free and comes without support. Dont contact me. Ask
// a local geek for help if it gets messy.

// ** This script is NOT FOR SALE ** You can use it in commercial
// products as long as you give this script to anyone who asks for it.
// You can use this source, distribute it and modify it freely, but
// leave the credits intact!  (You can add your own name to the list,
// ofcourse. Like, "Modified by John Doe")



// This text will appear in the floating title above the ball
string TITLE="";

// This text will appear in the pie menu
string SIT_TEXT = "Pose";

// Put the name of the pose/animation here!  If it's blank then
// the first animation in the inventory will be used.
string ANIMATION="tpose2";

// You can play with these numbers to adjust how far the person sits
// from the ball. ( <X,Y,Z> )
vector offset=<0,0,1.3>;

// should we check for /1hide type commands?
integer use_voice = TRUE;       // TRUE == listen

// what channel should we listen to?
integer voice_channel = 1;

// you probably don't want to mess with the stuff below here
integer listenHandle = -1;
integer masterswitch = TRUE;
integer visible = TRUE;
float visible_alpha = 1.0;
float hide_alpha = 1.0; // 0.0 for invisible

key avatar;

show()
{
    visible = TRUE;
    llSetText(TITLE, <1,1,1>,1);       
    llSetAlpha(visible_alpha, ALL_SIDES);
}

hide()
{
    visible = FALSE;
    llSetText("", <1,1,1>,1);       
    llSetAlpha(hide_alpha, ALL_SIDES);
}

use_defaults()
{
    if(visible == FALSE)
        llSetText("",<1,1,1>,1);
    else
        llSetText(TITLE,<1,1,1>,1);
}

init()
{
    // default to sit if we have no pose/animation
    if (llGetInventoryNumber(INVENTORY_ANIMATION) == 0)
    {
        ANIMATION = "sit";
    }
    else
    {
        ANIMATION = llGetInventoryName(INVENTORY_ANIMATION,0);
    }
    show();
}

default
{
    state_entry() {
        llSitTarget(offset,ZERO_ROTATION);
        init();
    }

    link_message(integer sender_num, integer num, string str, key id) {
        if(num == 99)
        {
            if(str == "show")
            {
                masterswitch = FALSE;
                hide();
                return;
            }
           
            if(str == "hide");
            {
                masterswitch = TRUE;
                show();
            }
        }
    }
   
    touch_start(integer detected) {
        if(use_voice == FALSE)
        {
            if(visible == TRUE)
                hide();
            else
                show();
        }
        else
            llSay(0,llDetectedName(0)+", say '/" + (string)voice_channel +
                  " Hide' to hide me, or '/" + (string)voice_channel +
                  " Show' to make me show.  Or just right-click and sit on me to use me.");
    }
   
    changed(integer change) {
        if(change == CHANGED_LINK)
        {
            avatar = llAvatarOnSitTarget();
            if(avatar != NULL_KEY)
            {
                hide();
                llRequestPermissions(avatar,PERMISSION_TRIGGER_ANIMATION);
            }
            else
            {
                if (llGetPermissionsKey() != NULL_KEY)
                    llStopAnimation(ANIMATION);
                if(masterswitch == TRUE)
                {
                    llSetAlpha(visible_alpha,ALL_SIDES);
                    llSetText(TITLE,<1,1,1>,1);
                }
            }
        }
       
        if(change == CHANGED_INVENTORY)
        {
            llSetText("Reloading configuration...",<1,1,1>,1);
            init();
        }
    }
   
    run_time_permissions(integer perm) {
        if(perm == PERMISSION_TRIGGER_ANIMATION)
        {
            llStopAnimation("sit");
            llStartAnimation(ANIMATION);
            hide();
            llSetText("",<1,1,1>,1);
        }
    }
   
    listen(integer channel, string name, key id, string message) {
        if(llStringLength(message)!=4)
            return;
       
        message = llToLower(message);
       
        if(message == "show")
        {
            show();
            return;
        }
        if(message == "hide")
            hide();
    }
}

 
Previous Previous
 
Next Next
  Openlife Forums  Scripting  LSL Help  Pose script not quite working
Privacy Statement | Terms Of UseAll Rights Reserved 2007,2008 3DX - Openlifegrid.com