Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Need poseball sit script NOT to go back to default

Paulo Dielli
Symfurny Furniture
Join date: 19 Jan 2007
Posts: 780
12-18-2008 17:24
Hi there, I can't figure this out and I've tried a lot.

In my furniture I have embedded poses in a pillow. For this I am using a multipose sit script, which I bought. The avi sits and gets a menu with several poses to choose from. That works fine. Besides that, I have two regular poseballs in this item for a couples cuddle pose. I am using poseballs, so that avis can move the poseballs easily to fit their avi sizes. These poseballs use a regular sit script (pasted below) and can be hidden with a chat command /22 hide.

The problem is that the bought multipose script seems to reset the entire item to default (state_entry, actually back to 'react()'). So when the regular poseballs are hidden with the chat command, but when an avi sits on the pillow with the multipose script, the regular poseballs become visible again. I think this can be solved in the regular poseball script, but I don't know how.

What I want is that the item/script reset (triggered by the multipose script) doesn't make the couples poseballs visible again. These poseballs should remain invisible when the owner used the chat command.

Can anyone help please? Here's the regular poseball script:

// Variables

string gTitle = "F"; // Title in Hovertext

integer use_voice = TRUE; // If set to true, you can hide/show the poseball via chat

integer gChannel = 22; // Channel on which the poseball listens to hide/show-commands

integer listenHandle;
integer masterswitch = TRUE;
integer visible = TRUE;
float base_alpha = 0.3; // Base-Visibility if shown

key trigger; // Agent that sits on the poseball

// functions

react()
{
key avatar = llAvatarOnSitTarget();
if(avatar != NULL_KEY)
{
llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION);
hide();
}
else
{
trigger = NULL_KEY;
show();
}
}

show()
{
visible = TRUE;
llSetText(gTitle, <1.0,1.0,1.0>,1.0);
llSetAlpha(base_alpha, ALL_SIDES);
}

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

default
{
state_entry()
{
if(use_voice)
listenHandle = llListen(gChannel, "", "", "";);

llSitTarget(<1.31,-0.30,-0.36>, ZERO_ROTATION);
react();
}

changed(integer change)
{
if(change & (CHANGED_LINK | CHANGED_INVENTORY))
{
react();
}
}

run_time_permissions(integer perm)
{
key avatar = llAvatarOnSitTarget();
trigger = avatar;

if((llGetPermissionsKey() == avatar) && (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION))
{
string anim = llGetInventoryName(INVENTORY_ANIMATION, 0);

if(llGetInventoryType(anim) == INVENTORY_ANIMATION)
{
list anims = llGetAnimationList(avatar);
integer t = llGetListLength(anims);

if(t)
{
integer i;
do
{
llStopAnimation(llList2String(anims, i));
} while(++i < t);
}

llStartAnimation(anim);
}
}
}

listen(integer channel, string name, key id, string message)
{
if(llStringLength(message) == 4)
{
message = llToLower(message);
if(message == "show";)
{
masterswitch = TRUE;
if(llKey2Name(trigger) == "";)
show();
}
else if(message == "hide";)
{
masterswitch = FALSE;
hide();
}
else
return;
//llMessageLinked(LINK_ALL_OTHERS, 99, message, "";);
}
}
}
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
12-18-2008 19:48
Assuming you want sometimes to be able to make them visible, i would have thought just commenting out (or removing) the show() function in react() would do what you want:
CODE
react()
{
key avatar = llAvatarOnSitTarget();
if(avatar != NULL_KEY)
{
llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION);
hide();
}
else
{
trigger = NULL_KEY;
//show();
}
}
Paulo Dielli
Symfurny Furniture
Join date: 19 Jan 2007
Posts: 780
12-20-2008 09:32
Hi Innula. Thanks for your help. I commented out the show() function in the react() event and that works. Now, when the poseballs are made invisible with /22 hide and when an avi sits on the prim with the multipose-sit, the couples poseballs remain invisible.

It's not perfect though. When the couples poseballs are visible and the avi sits on one of them, it becomes invisible like it should. But after the avi stands up, the poseball remains invisible. In this case (because the poseballs were not set to invisible, no /22 hide used) the poseball should become visible again. But of course that doesn't work anymore because the show() function is commented out.

It's just a minor flaw, nothing really important. But if someone has a way around this, I'd appreciate it very much. Anyway Innula, thanks a lot!
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
12-20-2008 10:33
You need a global variable that keeps track of whether the prim has been explicitly hidden with a command. This variable wouldn't survive a script reset, but it doesn't look like this is one of those, "give up and reset everything when something interesting happens" scripts anyway. So a global like:

CODE

integer hiddenByCommand = FALSE;


then logic that goes something like:

CODE

if (llAvatarOnSitTarget() != NULL_KEY && !hiddenByCommand)
{
show();
}