Pose Ball System

Thread Started By THEREALAMMER

924
0
  • 39 Vote(s) - 4.08 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rate Thread
#1
PHP Code:
//THEREALAMMER waz here
//this is script 1 of two needing to be inside the same prim or linkset
/Poseballl4 System

string TITLE
="Sit here";            //This text will appear in the floating title above the ball
string ANIMATION="";             //Put the name of the pose/animation here!
vector offset=<0,0,0.5>;            //You can play with these numbers to adjust how far the person sits from the ball. ( <X,Y,Z> )
integer use_voice FALSE;

string  gNotecard "Pose ball - CONFIGURATION";    //Going to need a config notecard in inv of poseball prim
integer gLine 0;

integer listenHandle = -1;
integer masterswitch TRUE;
integer visible TRUE;
float base_alpha 1.0;
key avatar;

key dataserver_key NULL_KEY;

show()
{
    
visible TRUE;
    
llSetText(TITLE, <1,1,1>,1);        
    
llSetAlpha(base_alphaALL_SIDES);
}

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

next_line()
{
    
gLine++;
    
dataserver_key llGetNotecardLine(gNotecard,gLine);
}

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

init()
{

    if(
llGetInventoryNumber(INVENTORY_ANIMATION) == 0)      //Make sure we actually got something to pose with.
    
{
        
llWhisper(0,"Error: No animation found. Cannot pose.");
        
ANIMATION "sit";
    }
    else
        
ANIMATION llGetInventoryName(INVENTORY_ANIMATION,0);

    if(
llGetInventoryNumber(INVENTORY_NOTECARD) != 0)       //If the notecard is present, use it for configuration.
    
{
        
integer i;
        for(
i=0;i<llGetInventoryNumber(INVENTORY_NOTECARD);i++)
            if(
llGetInventoryName(INVENTORY_NOTECARD,i) == gNotecard)
            {
                
gLine 0;
                
dataserver_key llGetNotecardLine(gNotecard0);
                return;
            }
        
use_defaults();
    }
    else            
//No configuration notecard found... lets use the defaults.
        
use_defaults();
}

default
{
    
state_entry()
    {
        
llSetText("Starting up", <1,1,1>,1);
        
llSitTarget(offset,ZERO_ROTATION);
        
init();
    }

    
link_message(integer sender_numinteger numstring strkey 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 '/1 Hide' to hide me, or '/1 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(base_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);
            if(
visible == TRUE)
                
base_alpha llGetAlpha(ALL_SIDES);
            else
                
base_alpha 1.0;
            
llSetAlpha(0.0,ALL_SIDES);
            
llSetText("",<1,1,1>,1);
        }
    }
    
    
listen(integer channelstring namekey idstring message)
    {
        if(
llStringLength(message)!=4)
            return;
        
        
message llToLower(message);
        
        if(
message == "show")
        {
            
show();
            return;
        }
        if(
message == "hide")
            
hide();
    }
    
    
dataserver(key queryidstring data)
    {
        if(
queryid != dataserver_key)
            return;
        
        if(
data != EOF)
        {
            if(
llGetSubString(data,0,0) != ";")
            {
                if(
llGetSubString(data,0,5) == "title:")
                {
                    
TITLE llGetSubString(data,7,-1);
                    
next_line();
                    return;
                }
                if(
llGetSubString(data,0,6) == "offset:")
                {
                    
integer length llStringLength(data);
                    if(
llGetSubString(data,8,8) != "<" || llGetSubString(data,length 1,length) != ">")
                    {
                        
llSay(0,"Error: The numbers in the offset value lack the '<' and '>' signs. (Should be something like <3,1,6> )");
                        
offset = <0,0,0.5>;
                    }
                    else
                        
offset = (vector)llGetSubString(data,8,-1);
                    
                    if(
offset == <0,0,0>)
                        
offset = <0,0,0.01>;
                    
llSitTarget(offset,ZERO_ROTATION);
                    
next_line();
                    return;
                }
                if(
llGetSubString(data,0,5) == "voice:")
                {
                    
string value llGetSubString(data,7,-1);
                    
value llToLower(value);
                
                    if(
listenHandle != -1)
                    {
                        
llListenRemove(listenHandle);
                        
listenHandle = -1;
                    }
                    
                    if(
value !="no" && value != "yes" && value != "true" && value != "false")
                        
use_voice FALSE;
                    else
                        if(
value == "no" || value == "false")
                            
use_voice FALSE;
                        else
                        {
                            
use_voice TRUE;
                            
listenHandle llListen(1,"","","");
                        }
                    
next_line();
                    return;
                }
                if(
llGetSubString(data,0,10) == "sit_button:")
                {
                    
llSetSitText(llGetSubString(data,12,-1));
                    
next_line();
                    return;
                }
                
next_line();
            }
        }
        else
        {
            if(
visible == FALSE)
                
llSetText("",<1,1,1>,1);
            else
                
llSetText(TITLE,<1,1,1>,1);
        }
    }
}






//THEREALAMMER waz here
//Part two of the poseball4 system script
//This must also be inside same prim or linkset
//Poseball4 system click broadcaster

integer visible TRUE;

default
{
    
touch_start(integer total_number)
    {
        if(
visible == TRUE)
        {
            
llMessageLinked(LINK_SET,99,"hide",NULL_KEY);
            
visible FALSE;
        }
        else
        {
            
llMessageLinked(LINK_SET,99,"show",NULL_KEY);
            
visible TRUE;
        }
    }

Reply




Possibly Related Threads…
Thread Author Replies Views Last Post
  MLP - MULTI-LOVE-POSE V1.2 zion 20 19,394 02-03-2019, 07:53 AM
Last Post: seferiadam
  Pose Stand With A Nice Hello from You YoungMoney 0 2,976 04-29-2013, 07:51 AM
Last Post: YoungMoney

Forum Jump:

1 Guest(s)
Share this:

About Second Life Copybot

Second Life CopyBot Forum is a place where you can get items for Second Life and other vitual worlds for free. With our CopyBot viewers you can export and import any content from these virtual worlds and modify them in 3D software such as Blender, 3D studio Macx etc...