Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

show/hide

Finn Jensen
Registered User
Join date: 5 Jul 2004
Posts: 140
12-12-2004 21:34
I am clueless on scripting. I have made some furnitures that have pose balls, that put the avatar in cerain position when one sit on them.

What I would need is something to plop into the pose balls, that will be linked to rest.
It should be something simple :)
When one say show/hide it would do that to the parts of the model that contains teh script.

Is this somehow possibel?

Thanks in advance
Catherine Omega
Geometry Ninja
Join date: 10 Jan 2003
Posts: 2,053
12-12-2004 22:50
CODE
default
{
state_entry()
{
llListen(0,"",llGetOwner(),""); // listen on channel 0 for chat said by the owner of this object.
}

listen(integer channel, string name, key id, string message)
{
if (message == "invisible")
{
llSetAlpha(0.0,ALL_SIDES); // set all sides of this object to 100% transparent.
}

else if (message == "visible")
{
llSetAlpha(1.0,ALL_SIDES); // set all sides of this object to 100% opaque.
}
}

on_rez(integer start_param)
{
llResetScript(); // reset script when object is rezzed
}
}


This is basically what you need to do.

Saying "visible" or "invisible" on channel 0 (normal chat) will cause the object to turn visible or invisible.

If you're using this for more than one object, you'll probably want to use linkmessages in some way.
_____________________
Need scripting help? Visit the LSL Wiki!
Omega Point - Catherine Omega's Blog
Finn Jensen
Registered User
Join date: 5 Jul 2004
Posts: 140
12-13-2004 04:33
Thank you Cathereine.

I was given a script, and I played with it and got both show/hide and animations to work.

Now it insisits on giving an error " Script trying to stop animations but PERMISSION_TRIGGER_ANIMATION permission not set".

I do not seem to prevent things from working, but is annoying when one get it both when siting down and standing up. Would there be anyway to get rid of it?
Samhain Broom
Registered User
Join date: 1 Aug 2004
Posts: 298
12-13-2004 08:45
One other thing, instead of using the default chat channel, you should use channel 1 so that you can avoid some of the lag that is caused by the script trying to decode everything that is said on the default chat channel.... so the line that said:

CODE
llListen(0,"",llGetOwner(),""); // listen on channel 0 for chat said by the owner of this object.


should look like:

CODE
llListen(1,"",llGetOwner(),""); // listen on channel 1 for chat said by the owner of this object.


To use it this way, enter the same command, but put "/1" in front of the command...

So now your command would be:

/1 visible
/1 invisible

I hope this helps.
_____________________
rm -rf /bin/ladden #beware of geeks bearing grifts
Water Rogers
Registered User
Join date: 1 May 2003
Posts: 286
12-13-2004 13:47
From: finn Jensen
Thank you Cathereine.

I was given a script, and I played with it and got both show/hide and animations to work.

Now it insisits on giving an error " Script trying to stop animations but PERMISSION_TRIGGER_ANIMATION permission not set".

I do not seem to prevent things from working, but is annoying when one get it both when siting down and standing up. Would there be anyway to get rid of it?


Well in order to help, we'd have to see the script that was given to you. Post it if you can.

--Water
_____________________
From: Philip Linden

For the more technically minded - the problem is actually NOT the asset server (or 'asshat' as you prefer to affectionately call it herein).
Finn Jensen
Registered User
Join date: 5 Jul 2004
Posts: 140
12-13-2004 15:34
Sure thing . Wonder if it can be that some balls have animations and other poses?

string anim = "lay001";//change testmast to any animation or drop an animation in the contents then add the name

default
{
state_entry()
{ llSitTarget(<0,0,.001>, llEuler2Rot(<0,0,0> ));
llListen(0, "", "" ,"";);
}

changed(integer change)
{
if (change & CHANGED_LINK)
{
key user = llAvatarOnSitTarget();
if (user)
{
llRequestPermissions(user, PERMISSION_TRIGGER_ANIMATION);
llStartAnimation(anim);
llSetTexture("cdb565c1-59ba-3888-d650-e6a36cc60e0a", ALL_SIDES);//make the ball go invis
llStopAnimation("sit";);
}
else
{
llSetTexture("f2c05e3a-f15e-17e0-9432-1826d60f05d4", ALL_SIDES);//show the ball
llStopAnimation(anim);
llResetScript();
}
}
}
run_time_permissions(integer perms)
{
if (perms != PERMISSION_TRIGGER_ANIMATION)
{
llResetScript();
}
else
{
llStopAnimation("sit";);
}
}
listen(integer channel, string name, key id, string msg)
{
if(msg == "hide";)
{
llSetTexture("cdb565c1-59ba-3888-d650-e6a36cc60e0a", ALL_SIDES);
llSetText("", <0, 0, 1>, 1);
}
if(msg =="show";)
{
llSetTexture("f2c05e3a-f15e-17e0-9432-1826d60f05d4", ALL_SIDES);
llSetText("", <0, 0, 1>, 1);
}
}
}
Bill Otis
Registered User
Join date: 19 Aug 2004
Posts: 4
stuck on me
01-07-2005 16:21
I was playing with this but it seems to lock on to me as the owner.
I was ondering if there is a way to make sho anyone saying the commands can use it?
THanks.
:confused:
Cross Lament
Loose-brained Vixen
Join date: 20 Mar 2004
Posts: 1,115
01-07-2005 16:39
Change this
CODE
llListen(0,"",llGetOwner(),"");
to this
CODE
llListen(0,"","","");
:D
_____________________
- Making everyone's day just a little more surreal -

Teeple Linden: "OK, where did the tentacled thing go while I was playing with my face?"
CrazyMonkey Feaver
Monkey Guy
Join date: 1 Jul 2003
Posts: 201
01-08-2005 11:37
You could also use a touch even and be a bit more server friendly
Ursula Madison
Chewbacca is my co-pilot
Join date: 31 Jul 2004
Posts: 713
01-08-2005 13:55
From: CrazyMonkey Feaver
You could also use a touch even and be a bit more server friendly

That's what I do. I put a touch event in the main object of the furniture, and have it use a linkmessage to tell the poseballs to change the show/hide state. No listens, sensors, or anything else using up resources until someone touches the furniture. :)
_____________________
"Huh... did everything just taste purple for a second?" -- Philip J. Fry