Wandering Soulstar Posted March 21, 2014 Share Posted March 21, 2014 Hi all, I am encountering a strange problem with a bit of code I have and cannot for the life of me find why. I have a single object (mesh) where I want to on occasion set the Alpha of all the faces except one to 100%. The following snippet is what does this:integer numFaces = llGetNumberOfSides(); integer x; for (x = 0; x < numFaces; x++) { if (x != HINGE_FACE) { llSetAlpha(0.0, x); } } The problem is that most of the time (not always) all the faces go to 100%. I have put in a sniffer and can see that when the face in question comes up in the loop it does not enter and execute the llSetAlpha statement, but the result is still said face going to 100% Alpha.Any ideas? Link to comment Share on other sites More sharing options...
Rolig Loon Posted March 21, 2014 Share Posted March 21, 2014 If the value of X isn't causing the problem in your if test, then the other logical candidate is HINGE_FACE. Check to be sure that you aren't redefining HINGE_FACE somewhere in your script, or failing to assign it unambiguously. Link to comment Share on other sites More sharing options...
Emma Krokus Posted March 21, 2014 Share Posted March 21, 2014 Firstly, I don't have the same issue. But something weird occured with a mesh i was using. One face would flip offsets when I touched it - it should have just gone fullbright. All other faces behaved normally. I have heard from someone in a scripters' group that they also had an issue with "bad" mesh faces. If such a thing exists ( obviously my evidence is anecdotal ), I wonder if it could be related to your problem. So I wonder what happens when you try the code in a different mesh or even a prim.... Link to comment Share on other sites More sharing options...
Wandering Soulstar Posted March 21, 2014 Author Share Posted March 21, 2014 Rolig - Yep already checked the value of HINGE_FACE and it is correct, like I said, in my 'debug' I can see that it is not calling llSetAlpha for the face defined in HINGE_FACE. Emma - When I get some time tonight or tomorrow I am going to try it with another mesh, and a standard prim. Though I am sure it will work with the standard prim, the mesh who knows. I may not have been clear enough, but the realy wierd thing is that occasionally the code does work, maybe 5% of the time ... so very wierd. And to make things more confusing, there is another spot in my code where I set the Alpha back to 0% (1.0) and there I have another face that I always want full Alpha, so I skip the setting, and that works! Link to comment Share on other sites More sharing options...
LepreKhaun Posted March 21, 2014 Share Posted March 21, 2014 Wandering Soulstar wrote: Hi all, I am encountering a strange problem with a bit of code I have and cannot for the life of me find why. I have a single object (mesh) where I want to on occasion set the Alpha of all the faces except one to 100%. The following snippet is what does this: integer numFaces = llGetNumberOfSides();integer x;for (x = 0; x < numFaces; x++){ if (x != HINGE_FACE) { llSetAlpha(0.0, x); }} The problem is that most of the time (not always) all the faces go to 100%. I have put in a sniffer and can see that when the face in question comes up in the loop it does not enter and execute the llSetAlpha statement, but the result is still said face going to 100% Alpha. Any ideas? Keep in mind that each call to llSetAlpha() entails an object update and your loop is causing this to happen for as many faces as your mesh has. Try: integer HINGE_FACE = faceNumberYouWantToKeepOpaque;llSetAlpha(0.0, ALL_SIDES); // Set everything transparent then...llSetAlpha(1.0, HINGE_FACE); // Set that one face opaque This will require fewer object updates and should lessen, if not eliminate, wonky behavior. Link to comment Share on other sites More sharing options...
Wandering Soulstar Posted March 21, 2014 Author Share Posted March 21, 2014 This is really weird ...Just got home and went to test some more .. and now working fine .. after two days of problems <sigh> No code changes, same mesh prim ... Gremlins Link to comment Share on other sites More sharing options...
Wandering Soulstar Posted March 21, 2014 Author Share Posted March 21, 2014 And now failing again <sigh> Link to comment Share on other sites More sharing options...
Wandering Soulstar Posted March 22, 2014 Author Share Posted March 22, 2014 So no solution it seems, and appears to be some kind of glitch. I have tried: 1) With a normal Prim - works fine 2) With a different mesh - still same problem 3) LepreKhauns suggestion - still same problem What is even stranger is that it does not always fail, I ran the sequence 15 times, worked properly 4 times in that run, but no pattern as to when it failed and when it worked. I have an inelegant workaround that involves another prim and guess I'll have to chalk this one up to gremlins in the servers. Link to comment Share on other sites More sharing options...
Cerise Sorbet Posted March 22, 2014 Share Posted March 22, 2014 The problem is not really with your script, but a bug in object updates. I know that LL is aware that this problem is still out there, but fixing it hasn't percolated to the top of their list yet. There is a workarund. After you change the alphas, use a call like this: llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_TEXT," ",<0.,0.,0.>, 0.0]); This won't add any visible text, but it will force the updates you need to make the mass alpha swaps work consistently. Each time you call that, use a different value for the text or color to make sure it updates, toggling between "" and " " works pretty well. Link to comment Share on other sites More sharing options...
Wandering Soulstar Posted March 24, 2014 Author Share Posted March 24, 2014 Cerise .. Thanks for the suggestion, tried it but no joy :smileysad: Link to comment Share on other sites More sharing options...
Rolig Loon Posted March 24, 2014 Share Posted March 24, 2014 In theory, any scripted action that changes a prim property ought to serve as a workaround. Setting a blank hover text, as Cerise suggested, is one way. So is starting and stopping a trivial particle effect, turning glow on and off, or any number of other actions that force the servers to reset prim parameters. Link to comment Share on other sites More sharing options...
Cerise Sorbet Posted March 24, 2014 Share Posted March 24, 2014 Wandering Soulstar wrote: Cerise .. Thanks for the suggestion, tried it but no joy :smileysad: Bummer. What viewer are you using? Does it happen if you try using a different viewer? I ask because this resembles a bug with alpha faces on meshes that is peculiar to Singularity. Link to comment Share on other sites More sharing options...
Wandering Soulstar Posted March 25, 2014 Author Share Posted March 25, 2014 Ahh!!! Yes I am using Singularity .. will install another viewer to see if it continues. Thanks for the tip! 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