Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Library: Scaling door (Garage Type)

Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
08-19-2008 12:28
did this a wile ago for my random house building projects thought id release it since im rarly going to use it

CODE

vector offset = <1,0,0>; //Prim moves/changes size along this local coordinate
float hi_end_fixed = FALSE; //Z axis scaling up or down
//The one with the higher (local) coordinate
float min = 0.01; //The minimum size of the prim relative to its maximum size
integer ns = 40; //Number of distinct steps for move/size change


default
{
state_entry()
{
offset *= ((1.0 - min) / ns) * (offset * llGetScale());
hi_end_fixed -= 0.5;
}

touch_start(integer detected) // reverses scaling
{
integer i;
do llSetPrimitiveParams([PRIM_SIZE, llGetScale() - offset,
PRIM_POSITION, llGetLocalPos() + ((hi_end_fixed * offset) * llGetLocalRot())]);
while ((++i) < ns);
offset = - offset;
}
}


have fun
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Library bump
09-15-2008 05:37
:)
_____________________
i've got nothing. ;)
Sue Kirkpatrick
Knee deep in prims :o))
Join date: 30 Jul 2008
Posts: 8
Thankyou
09-22-2008 23:05
I have been looking for this script just recently for my house garage. Thankyou sooo much it is really really appreciated :0))
Maihem Randt
NEXUS-6 N6FAB21416
Join date: 22 Aug 2007
Posts: 108
12-08-2008 13:50
this is an awesome script, I am using it in a build but I would like to have it so it will open/close by touching a linked prim that would act as an open/close switch in the build.
can any one help?
_____________________
Plasma Labs Sci-Fi gadgets, props and cool stuff!
http://www.freewebs.com/plasmalabs/
visit the shop http://snurl.com/4163n
Maihem Randt
NEXUS-6 N6FAB21416
Join date: 22 Aug 2007
Posts: 108
12-09-2008 11:39
i guess not :(
_____________________
Plasma Labs Sci-Fi gadgets, props and cool stuff!
http://www.freewebs.com/plasmalabs/
visit the shop http://snurl.com/4163n
icktoofay Kamachi
Registered User
Join date: 10 Nov 2007
Posts: 17
12-09-2008 13:02
From: Maihem Randt
this is an awesome script, I am using it in a build but I would like to have it so it will open/close by touching a linked prim that would act as an open/close switch in the build.
can any one help?


Note: Untested code follows.

Door Script:
CODE

vector offset = <1,0,0>; //Prim moves/changes size along this local coordinate
float hi_end_fixed = FALSE; //Z axis scaling up or down
//The one with the higher (local) coordinate
float min = 0.01; //The minimum size of the prim relative to its maximum size
integer ns = 40; //Number of distinct steps for move/size change

integer yourID=12345; // Change this if you want to use more than one door in a build. You must change it in the switch also.


default
{
state_entry()
{
offset *= ((1.0 - min) / ns) * (offset * llGetScale());
hi_end_fixed -= 0.5;
}

link_message(integer link_num,integer num,string str,key id)
{
if(num!=yourID) return;
integer i;
do llSetPrimitiveParams([PRIM_SIZE, llGetScale() - offset,
PRIM_POSITION, llGetLocalPos() + ((hi_end_fixed * offset) * llGetLocalRot())]);
while ((++i) < ns);
offset = - offset;
}
}

Switch Script:
CODE

integer yourID=12345; // Again, you should change this to the one in the above script.

default {
state_entry() {
}
touch_start(integer n) {
llMessageLinked(LINK_SET,yourID,"",NULL_KEY);
}
}
Maihem Randt
NEXUS-6 N6FAB21416
Join date: 22 Aug 2007
Posts: 108
12-09-2008 13:45
your my hero!
works a treat thanks muchly!
_____________________
Plasma Labs Sci-Fi gadgets, props and cool stuff!
http://www.freewebs.com/plasmalabs/
visit the shop http://snurl.com/4163n
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
12-11-2008 19:15
your all welcome, im working on one that will move slower but havent had the time latly :D
Sue Kirkpatrick
Knee deep in prims :o))
Join date: 30 Jul 2008
Posts: 8
12-31-2008 05:35
Oh nice one! i'll be keeping an eye out for that :)


Thankyou
Coal Porter
Owner CP Motors
Join date: 26 Mar 2008
Posts: 37
01-19-2009 18:12
Very useful, Thanks :D
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
01-19-2009 18:43
From: Mrc Homewood
your all welcome, im working on one that will move slower but havent had the time latly :D



you could add more steps, or insert a sleep after the primparams call
Maihem Randt
NEXUS-6 N6FAB21416
Join date: 22 Aug 2007
Posts: 108
03-28-2009 03:29
I've been using this script for retractable landing gear on physical fliers :)
i was trying to set the script to respond to a listen command so i could use it with chat commands rather than pulling out of mouse look to click on a prim but i keep getting syntax errors :(
anyone able to help?
_____________________
Plasma Labs Sci-Fi gadgets, props and cool stuff!
http://www.freewebs.com/plasmalabs/
visit the shop http://snurl.com/4163n
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
03-28-2009 09:29
what do you have so far?
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Maihem Randt
NEXUS-6 N6FAB21416
Join date: 22 Aug 2007
Posts: 108
03-28-2009 09:59
From: Ruthven Willenov
what do you have so far?


my scripting ability is..deplorable at best but i have been learning to edit. i just am not very good at it yet

default
{
state_entry()
{
offset *= ((1.0 - min) / ns) * (offset * llGetScale());
hi_end_fixed -= 0.5;
}
llListen(0,"", NULL_KEY, "";);
}
listen(integer channel, string name, key id, string message) {
if (message == "landing gear";) {
integer i;
do llSetPrimitiveParams([PRIM_SIZE, llGetScale() - offset,
PRIM_POSITION, llGetLocalPos() + ((hi_end_fixed * offset) * llGetLocalRot())]);
while ((++i) < ns);
offset = - offset;
}
}
_____________________
Plasma Labs Sci-Fi gadgets, props and cool stuff!
http://www.freewebs.com/plasmalabs/
visit the shop http://snurl.com/4163n
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
03-28-2009 10:37
it looks like you're missing the constants:
i also advise against having an open listen on channel 0, that has to filter every message that's said in open chat, and whether or not it's in listening distance. if you must use channel 0, i would put a word filter in the listen function (the last argument). made those changes below. i haven't tried it in world to be sure, but hopefully it can point you in the right direction

CODE

vector offset = <1,0,0>; //Prim moves/changes size along this local coordinate
float hi_end_fixed = FALSE; //Z axis scaling up or down
//The one with the higher (local) coordinate
float min = 0.01; //The minimum size of the prim relative to its maximum size
integer ns = 40; //Number of distinct steps for move/size change

default
{
state_entry()
{
offset *= ((1.0 - min) / ns) * (offset * llGetScale());
hi_end_fixed -= 0.5;
}
llListen(20,"", NULL_KEY, "landing gear");//changed to channel 20, and put the word filter so the listen event will only be triggered if it hears that exact message
}
listen(integer channel, string name, key id, string message) {
integer i;
do llSetPrimitiveParams([PRIM_SIZE, llGetScale() - offset,
PRIM_POSITION, llGetLocalPos() + ((hi_end_fixed * offset) * llGetLocalRot())]);
while ((++i) < ns);
offset = - offset;
}
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Maihem Randt
NEXUS-6 N6FAB21416
Join date: 22 Aug 2007
Posts: 108
03-28-2009 22:18
thanks Ruthven, i never thought about the lag that listening on an open channel would cause!
I'll give this a try, again thanks very very much :)
_____________________
Plasma Labs Sci-Fi gadgets, props and cool stuff!
http://www.freewebs.com/plasmalabs/
visit the shop http://snurl.com/4163n
Maihem Randt
NEXUS-6 N6FAB21416
Join date: 22 Aug 2007
Posts: 108
03-29-2009 10:09
i tried it but got a syntax error at the start of the line
llListen(20,"", NULL_KEY, "landing gear";);
_____________________
Plasma Labs Sci-Fi gadgets, props and cool stuff!
http://www.freewebs.com/plasmalabs/
visit the shop http://snurl.com/4163n
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
03-29-2009 11:01
CODE

vector offset = <1, 0, 0 >; //Prim moves/changes size along this local coordinate
float hi_end_fixed = FALSE; //Z axis scaling up or down
//The one with the higher (local) coordinate
float min = 0.01; //The minimum size of the prim relative to its maximum size
integer ns = 40; //Number of distinct steps for move/size change

default {
state_entry() {
offset *= ((1.0 - min) / ns) * (offset * llGetScale());
hi_end_fixed -= 0.5;
llListen(20, "", NULL_KEY, "landing gear"); //changed to channel 20, and put the word filter so the listen event will only be triggered if it hears that exact message
}
listen(integer channel, string name, key id, string message) {
integer i;
do
llSetPrimitiveParams([PRIM_SIZE, llGetScale() - offset,
PRIM_POSITION, llGetLocalPos() + ((hi_end_fixed * offset) * llGetLocalRot())]);
while ((++i) < ns);
offset = -offset;
}
}
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
03-29-2009 11:17
From: Maihem Randt
i tried it but got a syntax error at the start of the line
llListen(20,"", NULL_KEY, "landing gear";);


whoops, yep, i copied and pasted from yours and didn't notice you had an extra bracket in the state entry. jesse fixed it above. thanks jesse :-)
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Maihem Randt
NEXUS-6 N6FAB21416
Join date: 22 Aug 2007
Posts: 108
03-29-2009 17:30
thanks very much :)
_____________________
Plasma Labs Sci-Fi gadgets, props and cool stuff!
http://www.freewebs.com/plasmalabs/
visit the shop http://snurl.com/4163n