These forums are CLOSED. Please visit the new forums HERE
Path Cut |
|
SirFency Blackheart
Registered User
Join date: 6 Jan 2009
Posts: 81
|
08-11-2009 08:16
I have a bread box that I would like to open and close by clicking on it and I'm not sure how to go about building a script for it. Is it possible to script in a path cut so that it starts at a certain value ends at a certain value and checks to see what value it is at and goes to the oposite value everytime its clicked?
|
Destiny Niles
Registered User
Join date: 23 Aug 2006
Posts: 949
|
08-11-2009 08:55
You can use path cut. To read it use: http://wiki.secondlife.com/wiki/LlGetPrimitiveParams
You probably could also use a door script. |
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
08-11-2009 10:03
Or script the lid to go from llSetAlpha(1.0, ALL_SIDES) to llSetAlpha(0.0,ALL_SIDES) or vice versa in a touch_start event. That should work if you only need to see in the box and don't need to touch something in it.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask....
![]() Look for my work in XStreetSL at |
Void Singer
Int vSelf = Sing(void);
![]() Join date: 24 Sep 2005
Posts: 6,973
|
08-11-2009 12:37
I'll warn that if you want to do path cut in stages (like a roll away effect) then it's going to be choppy. if you go for a single stage swap then you can get away with a simple switch such as
gBooOpen; (gBooOpen = !gBooOpen * percentage) which will shuffle between 0.0 and your percentage... or (gBooOpen = !gBooOpen + percentage) which will shuffle between percentage and percentage + 1.0, which I *think* the percentage over 1 will default to 1 _____________________
|
| . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - |
SirFency Blackheart
Registered User
Join date: 6 Jan 2009
Posts: 81
|
08-13-2009 05:31
Could someone look at this and let me know what I'm doing wrong?
default { state_entry() { llSay(0, "Hello, Avatar!" ![]() } touch_start(integer total_number) { if (vector cut == < .75, 1, 0.0 > ![]() { llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_CYLINDER, PRIM_HOLE_DEFAULT, // hole_shape < 0, 1, 0.0 >, // cut 0.95, // hollow < 0.0, 0.0, 0.0 >, // twist < 1.0, 1.0, 0.0 >, // top_size < 0.0, 0.0, 0.0 > // top_Shear } else if ((vector cut == < 0, 1, 0.0 > ![]() { llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_CYLINDER, PRIM_HOLE_DEFAULT, // hole_shape < .75, 1, 0.0 >, // cut 0.95, // hollow < 0.0, 0.0, 0.0 >, // twist < 1.0, 1.0, 0.0 >, // top_size < 0.0, 0.0, 0.0 > // top_Shear } ]); } } |
Dora Gustafson
Registered User
![]() Join date: 13 Mar 2007
Posts: 779
|
08-13-2009 06:22
Your brackets do not match!
For a start you have a "[" without a "]" and you have a form:{[}], where curly and square brackets are conflicting. I don't want to look for more... Happy scripting ![]() _____________________
From Studio Dora
|
Jesse Barnett
500,000 scoville units
![]() Join date: 21 May 2006
Posts: 4,160
|
08-13-2009 06:32
Could someone look at this and let me know what I'm doing wrong? Everything. Really, your formatting is all screwed up. You did not enclose vector in brackets in the if test, you used just the start bracket for vector in the else if test. That unclosed bracket screws up everything past it. Your first llSetPrimitiveParams([ never closed at all. the second llSetPrimitiveParams([ closed outside the else if bracket. would suggest using LSLEditor as it will help with your formatting and point out the problems: CODE
But of course this will still not work because of the lack of logic in the script. How can you test for "cut" when it has not been declared yet? If you do declare it then declare it as a vector and get rid of the two (vector) casts. And also if I remember correctly; I do not think you can compare vectors. _____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
SirFency Blackheart
Registered User
Join date: 6 Jan 2009
Posts: 81
|
08-13-2009 06:42
OK well the whole point of me doing this is to have the breadbox open and close using pathcut if I connot compare the two values I dont understand how to make this happen.
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
08-13-2009 07:06
Since you're just switching between two values for the vector cut, rather than try to compare vectors and things, why not have a simple binary test and close the thing if it's open and open it if it's closed? Something on the lines of
CODE vector cut; |
Jesse Barnett
500,000 scoville units
![]() Join date: 21 May 2006
Posts: 4,160
|
08-13-2009 07:07
You do not have to compare, just set it one or the other. We use integer switches in a case like this and a user defined function keeps you from having to type out everything twice:
CODE
Do a search in the script library for doors and chests to see other example of the way we code it. _____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
Jesse Barnett
500,000 scoville units
![]() Join date: 21 May 2006
Posts: 4,160
|
08-13-2009 07:12
CODE Wonder if you beat me by a full minute or maybe it was right on the edge and it was only a few seconds ![]() _____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
Jesse Barnett
500,000 scoville units
![]() Join date: 21 May 2006
Posts: 4,160
|
08-13-2009 07:22
CODE
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
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
|
08-13-2009 07:22
i tried to do it in steps, did i get my math wrong somewhere? i don't understand why this isn't working right, and please correct for where i had to to put the stupid space in the vectors
CODE
edit: whoops, i realized what i did but how about this one without steps? CODE
_____________________
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 |
SirFency Blackheart
Registered User
Join date: 6 Jan 2009
Posts: 81
|
08-13-2009 07:40
Thanks for all the help guys. I'm obviosly not a scripter but I thought I was on the right track. Its working now.
Since you're just switching between two values for the vector cut, rather than try to compare vectors and things, why not have a simple binary test and close the thing if it's open and open it if it's closed? Something on the lines of CODE vector cut; |
Jesse Barnett
500,000 scoville units
![]() Join date: 21 May 2006
Posts: 4,160
|
08-13-2009 07:49
![]() CODE
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
Jesse Barnett
500,000 scoville units
![]() Join date: 21 May 2006
Posts: 4,160
|
08-13-2009 07:51
Thanks for all the help guys. I'm obviosly not a scripter but I thought I was on the right track. Its working now. You took the first steps thou and that is all that matters. It all begins to make sense after a while. Never be bashful about coming here and asking questions. _____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
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
|
08-13-2009 07:52
overkill? i wrote this one up so it would remember what the other params are so it would retain any other stuff you do to it and only mess with the path cut
CODE
_____________________
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 |