bbwbabe Posted March 21, 2017 Share Posted March 21, 2017 Hi there, I am very new to scripting and have a simple fade script I am using in a build, however I want to make it owner use only but I don't know what to put or where to put it in the script. Below is the script I am using. Could some please help me with what I need to put in and where. Thank you in advance!! float fadeVelo = .01; //Fade steps N° (1.0 - 0.1) default { touch_start(integer total_number) { integer x; float xf; for (x=9; x>=0; x--) { xf = x * .1; llSleep(fadeVelo); llSetAlpha(xf,ALL_SIDES); } state Velo; } } state Velo { touch_start(integer total_number) { integer x; float xf; for (x=1; x<11; x++) { xf = x * .1; llSleep(fadeVelo); llSetAlpha(xf,ALL_SIDES); } state default; } } Link to comment Share on other sites More sharing options...
Rolig Loon Posted March 21, 2017 Share Posted March 21, 2017 All you need to do is ask the script to see whether llDetectedKey(0) == llGetOwner() . Because you have two states in your script and a touch_start event in each, you'll have to put that test in both of them. Put all of the other stuff in the event inside the scope of that test: if (llDetectedKey(0) == llGetOwner) { // Do stuff } While you're at it, you probably ought to turn those touch_start events into touch_end. From the LSL wiki: "If using a touch to change states be careful about the touch event order. The best advice is not to do state changes from within touch_start. Add a touch_end handler and do the state change there. Changing state from within touch_start can cause the next occurrence of THIS touch_start code to be missed." Link to comment Share on other sites More sharing options...
bbwbabe Posted March 21, 2017 Author Share Posted March 21, 2017 Thank you Rolig for the very prompt reply. I added it where I thought it should go but I must be putting it in the wrong place as I am getting errors on line 6 and 42(there isn't a line 42) Below is how I laid it out. This is before I put the touch_end in. float fadeVelo = .01; //Fade steps N° (1.0 - 0.1) default { touch_start(integer total_number) { if (llDetectedKey(0) == llGetOwner) integer x; float xf; for (x=9; x>=0; x--) { xf = x * .1; llSleep(fadeVelo); llSetAlpha(xf,ALL_SIDES); } state Velo; } } state Velo { touch_start(integer total_number) { if (llDetectedKey(0) == llGetOwner) integer x; float xf; for (x=1; x<11; x++) { xf = x * .1; llSleep(fadeVelo); llSetAlpha(xf,ALL_SIDES); } state default; } } Link to comment Share on other sites More sharing options...
Rolig Loon Posted March 21, 2017 Share Posted March 21, 2017 That's because you didn't use any {brackets} to define the scope of the test, so your if test only applies to the line immediately after it. Link to comment Share on other sites More sharing options...
Madelaine McMasters Posted March 21, 2017 Share Posted March 21, 2017 (edited) A few errors... 1) llGetOwner is a function, and so it needs a pair of parentheses surrounding even an empty parameter list, as Rolig showed. 2,3) if statements require that the test statement be in parentheses, and that a multi-statement effect be contained within braces, as Rolig explained above. Try this... float fadeVelo = .01; //Fade steps N° (1.0 - 0.1) default { touch_end(integer total_number) { if (llDetectedKey(0) == llGetOwner()){ integer x; float xf; for (x=9; x>=0; x--) { xf = x * .1; llSleep(fadeVelo); llSetAlpha(xf,ALL_SIDES); } state Velo; } } } state Velo { touch_end(integer total_number) { if (llDetectedKey(0) == llGetOwner()){ integer x; float xf; for (x=1; x<11; x++) { xf = x * .1; llSleep(fadeVelo); llSetAlpha(xf,ALL_SIDES); } state default; } } } Edited March 21, 2017 by Madelaine McMasters 1 Link to comment Share on other sites More sharing options...
bbwbabe Posted March 21, 2017 Author Share Posted March 21, 2017 Thank you so much!!!!! I am sooo basic at scripts at the moment but I am trying lol Am a better builder than script writer lol Thank you all again so much! xxxx 1 Link to comment Share on other sites More sharing options...
Madelaine McMasters Posted March 21, 2017 Share Posted March 21, 2017 1 hour ago, bbwbabe said: Thank you so much!!!!! I am sooo basic at scripts at the moment but I am trying lol Am a better builder than script writer lol Thank you all again so much! xxxx You're welcome! Rolig and I both like to see exclamation points from people who are trying, and we'll even accept "xxxx"s, so you've made our day! 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now