Hey everyone :3 just curious, but is it possible to have an on-touch script that toggles full bright on or off? If so, do you think I could find it in the Wiki or library here?
thanks a ton in advance!
These forums are CLOSED. Please visit the new forums HERE
Full Birght On/Off? |
|
duLuna Bosatsu
OMnomnom nom.
Join date: 4 Nov 2007
Posts: 102
|
10-02-2009 13:56
Hey everyone :3 just curious, but is it possible to have an on-touch script that toggles full bright on or off? If so, do you think I could find it in the Wiki or library here?
thanks a ton in advance! |
Argent Stonecutter
Emergency Mustelid
![]() Join date: 20 Sep 2005
Posts: 20,263
|
10-02-2009 14:08
Hey everyone :3 just curious, but is it possible to have an on-touch script that toggles full bright on or off? If so, do you think I could find it in the Wiki or library here? thanks a ton in advance! default { touch_start(integer n) { integer on = llList2Integer(llGetPrimitiveParams([PRIM_FULL_BRIGHT,FACE]),0); llSetPrimitiveParams([PRIM_FULL_BRIGHT,FACE,!on]); } } _____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/
"And now I'm going to show you something really cool." Skyhook Station - http://xrl.us/skyhook23 Coonspiracy Store - http://xrl.us/coonstore |
duLuna Bosatsu
OMnomnom nom.
Join date: 4 Nov 2007
Posts: 102
|
10-02-2009 14:22
whoo! Thanks Argent, but it's giving me this error (I tried playing around with the order of things, but I can't figure out why it's giving me an error) "Name not defined within scope"
It's putt the marker inbetween BRIGHT and the comma x.x; ([PRIM_FULL_BRIGHT,FACE]) |
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
10-02-2009 14:34
The word FULLBRIGHT shouldn't have an underbar in it. It's just FULLBRIGHT.
ETA: LOL I went back to edit my note and Dora got it in the meantime..... Yay Dora! _____________________
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 |
Dora Gustafson
Registered User
![]() Join date: 13 Mar 2007
Posts: 779
|
10-02-2009 14:35
Try: PRIM_FULLBRIGHT instead of PRIM_FULL_BRIGHT
_____________________
From Studio Dora
|
duLuna Bosatsu
OMnomnom nom.
Join date: 4 Nov 2007
Posts: 102
|
10-02-2009 14:40
Will do Dora!
![]() for the integer since i'm changing the faces to "ALL_SIDES" (it's a mask, so I'm only looking to put 1 side full bright, really...but I think it'd get too technical to try and tell which side to full bright?) do I change integer FACE = 0; to integer ALL_SIDES; or take it out entirely? x.x |
Argent Stonecutter
Emergency Mustelid
![]() Join date: 20 Sep 2005
Posts: 20,263
|
10-02-2009 14:47
You can tell I wrote that off the top of my head. Sorry for the typo.
![]() I don't know what will happen if you GET primitive parameters from ALL_SIDES. I would leave FACE in the GET line and change it to ALL_SIDES in the SET line. That will use the full-bright-ness of face 0 as what it's toggling on. _____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/
"And now I'm going to show you something really cool." Skyhook Station - http://xrl.us/skyhook23 Coonspiracy Store - http://xrl.us/coonstore |
duLuna Bosatsu
OMnomnom nom.
Join date: 4 Nov 2007
Posts: 102
|
10-02-2009 15:23
uu, yay! It works!
XD mind helping me with something else? It's a little more advanced.. Void linked me to this script before, it's a color picker that finds the name of specific prims inside a linkset and only changes the colors of those prims... can I do that for the FullBright function? her script: http://wiki.secondlife.com/wiki/User:Void_Singer/Programs#v7-D_Enh._Color_Picker I'm sure I can, tried figuring out what I can take out/replace... but there's a lot of words/phrases/half substrings etc I don't understand that might be useful x.x the mask's visor is in three parts, two side panels and the front- need those to go full bright. So instead of clicking one at a time, I can use the method in that script to just click the linkset and toggle "On/Off" in the menu to turn it.. on and off <3 |
Argent Stonecutter
Emergency Mustelid
![]() Join date: 20 Sep 2005
Posts: 20,263
|
10-02-2009 15:25
I would recommend just going and trying it. You'll learn a lot from figuring out the changes you need to make, and WHY you need to make them.
I'll just say, yes you can but you have to keep track of the FULLBRIGHTness of the prims yourself, you can't GET that remotely from another prim. _____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/
"And now I'm going to show you something really cool." Skyhook Station - http://xrl.us/skyhook23 Coonspiracy Store - http://xrl.us/coonstore |
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
10-02-2009 18:11
You might find this thread /54/06/265951/1.html useful, particularly the second example Hewee Zetkin very kindly gave me. It's the same as Void's method, but just gives you the basic function that finds the named prims and changes them, so you might find it helps you into Void's rather more complex example.
|
duLuna Bosatsu
OMnomnom nom.
Join date: 4 Nov 2007
Posts: 102
|
10-03-2009 02:00
:3 thank you Innula~ unfortunately I'm really not that great at this, so I couldn't get past the syntax error... I'm not sure how to go about putting something after default... or if default goes before the string @_@ -not proud of that- I think I'm just too right brainded for this XD; ahh..
but I did give editing Void's script a go... I'm stuck at what to do with this: http://img.photobucket.com/albums/v38/neko-vamp/Error.gif I get the feeling "16" is relating to the color value, but I don't know if I need the two lines, the entire set, or if I should take out the 16? Wouldn't make much sense in the pattern I see that goes along with the coding so far... I'm sure if I figure this bit out, they'll be more errors... I'd be really, ungodly indebted to anyone who's willing to take my hand through this & explain what's going in the script as the errors pop up. I know it says in the bottom, but it might as well be an inside joke from a different culture's standard of funny XD; thanks all <3 am willing to learn, as long as someone's willing to teach |
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
10-03-2009 02:53
Try this. Name the prims you want to change "visor" (without the quotes) and then drop this into the linkset:
CODE string TARGET_PRIM_NAME = "visor"; // name of the prims you want to changeVoid's script is for changing the colour values of target prims in the linkset by adjusting the RGB values of the colour separately. She's doing this by giving you the hex values used in CSS/HTML and converting them to the colour vectors used by lsl (see https://wiki.secondlife.com/wiki/Color_and_Scripting for an explanation). You could certainly adapt her script to feed color vectors to your parameter list; llSetLinkPrimitiveParams lets you change lots of things at once. That's a bit more complicated, though, than my simple example for turning PRIM_FULLBRIGHT on and off with a touch toggle, since you would probably want to control everything from a single dialog menu and change the values of CODE [PRIM_FULLBRIGHT,ALL_SIDES,bright,PRIM_COLOR,ALL_SIDES,my_color_vector,my_alpha_value]. You'd then feed values to the list from the responses to the dialog menu, and change the visor prims when you get the new values in the listen event. |
Argent Stonecutter
Emergency Mustelid
![]() Join date: 20 Sep 2005
Posts: 20,263
|
10-03-2009 04:36
If there's many prims in the object it would be more efficient to make a list of the prims named "visor" once, and step through that list.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/
"And now I'm going to show you something really cool." Skyhook Station - http://xrl.us/skyhook23 Coonspiracy Store - http://xrl.us/coonstore |
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
10-03-2009 06:50
I don't know what will happen if you GET primitive parameters from ALL_SIDES. I would leave FACE in the GET line and change it to ALL_SIDES in the SET line. That will use the full-bright-ness of face 0 as what it's toggling on. i think it averages out the colors between all the faces somehow try this, change the color on each face to something different, and look at the results from the changed event, and then touch each face, the results probably won't be the same 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 |
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
10-03-2009 07:13
If there's many prims in the object it would be more efficient to make a list of the prims named "visor" once, and step through that list. CODE list visor_prims; |
Argent Stonecutter
Emergency Mustelid
![]() Join date: 20 Sep 2005
Posts: 20,263
|
10-03-2009 08:30
All except for one thing:
integer i; integer n; integer max=llGetListLength(visor_prims); for(i=max;i>=0;--i){ Last line should either be for(i = 0; i < max; i++) or for(i = max-1; i >= 0; i--) Whether you're counting up or down, you don't need to loop over it with i == max. Also, if you're going to count down, and you don't care about the number of prims afterward, you can shed two variables: integer n=llGetListLength(visor_prims); for(n--; n >= 0; n--) Salt to taste: You can use pre or post increment and decrement as you like. I'm just accustomed to using predecrement and after 30 years I ain't changing. _____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/
"And now I'm going to show you something really cool." Skyhook Station - http://xrl.us/skyhook23 Coonspiracy Store - http://xrl.us/coonstore |
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
10-03-2009 11:49
Thank you.. shedding the variables makes a lot of sense.
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
10-03-2009 20:26
also if you're decrementing from the last link to the first, you don't even have to check if it's more than 0, you can just leave it as true or false
integer max = llGetNumberOfPrims(); for(max;max;max--) the second argument just checks if it's still true, which is any number but 0 and you're starting with a number higher than 0 so you don't need to worry about turning negative _____________________
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 |
Argent Stonecutter
Emergency Mustelid
![]() Join date: 20 Sep 2005
Posts: 20,263
|
10-03-2009 20:30
also if you're decrementing from the last link to the first, you don't even have to check if it's more than 0, you can just leave it as true or false 2. I would recommend against writing a loop with an equality for the ending condition, because it's a dangerous habit to get into... because one day you'll use it for a case where you might not start out >0. _____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/
"And now I'm going to show you something really cool." Skyhook Station - http://xrl.us/skyhook23 Coonspiracy Store - http://xrl.us/coonstore |
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
10-03-2009 20:35
1. That's only true for the specific case of llGetNumberOfPrims where the prim index is 1-based, not zero-based. For the loop over llGetListLength(visor_prims) that's not true. 2. I would recommend against writing a loop with an equality for the ending condition, because it's a dangerous habit to get into... because one day you'll use it for a case where you might not start out >0. yeah i meant to make a note of that, i was talking specifically about links, for 0 based indexes i usually find the max, start at 0 and increment while it's less than max, but in the build list function it is using a 1 based indexing but with i >= 0, when you get to zero, the name will return "", of course it wouldn't matter for that script, but it could cause some problems if you need to keys or names of all the prims _____________________
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 |
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
10-03-2009 21:22
yeah i meant to make a note of that, i was talking specifically about links, for 0 based indexes i usually find the max, start at 0 and increment while it's less than max, but in the build list function it is using a 1 based indexing but with i >= 0, when you get to zero, the name will return "", of course it wouldn't matter for that script, but it could cause some problems if you need to keys or names of all the prims |
Argent Stonecutter
Emergency Mustelid
![]() Join date: 20 Sep 2005
Posts: 20,263
|
10-04-2009 03:44
It's not so much that I can't remember when it's safe, it's just that I've run into too many cases where, for example, APIs documented as returning 0..N pop up a -1 after an upgrade because a new failure mode showed up down the line and the guy who modified the function forgot he was supposed to return 0 for failure.
That's not likely to happen here, but if you get in the habit of assuming the f***-up fairy's gonna coma knocking, you won't discover you left the door unlocked at an embarrassing moment. _____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/
"And now I'm going to show you something really cool." Skyhook Station - http://xrl.us/skyhook23 Coonspiracy Store - http://xrl.us/coonstore |