Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Invisible script

ahkenatan Grommet
The lovable old Primosaur
Join date: 11 Jan 2005
Posts: 193
03-30-2007 15:33
Hi everyone,

Would it be possible for a scripter to check out this script? It seems to have broke in the last update and it's driving me nuts now. It no longer works to "cut a hole" or "see through", if you will, a shiny prim.
Here are some pics to see what I mean:

In this one notice how the wheel wells are nicely rounded? This is what the invisible script used to do:
http://www.sluniverse.com/pics/pic.aspx?id=123379&sort=Pictures.PictureID+desc&Name=ahkenatan+Grommet

After the update this is what it looks like:
http://www.sluniverse.com/pics/pic.aspx?id=152721&sort=Pictures.PictureID+desc&Name=ahkenatan+Grommet

While the script still turns the prim it's inside of invisible it no longer works to make shiny prims see through. Any help or advice on this would be great. I'm trying to fix this myself but I'm not a good scripter.
CODE

////The Better Invisibility Script
//from Chris Knox
refresh()
{
llSetTexture("38b86f85-2575-52a9-a531-23108d8da837", ALL_SIDES);
llOffsetTexture(0.468, 0, ALL_SIDES);
llScaleTexture(0, 0, ALL_SIDES);
llSleep(30);
llSetTexture("e97cf410-8e61-7005-ec06-629eba4cd1fb", ALL_SIDES);
llOffsetTexture(0.468, 0, ALL_SIDES);
llScaleTexture(0, 0, ALL_SIDES);
}

default
{
state_entry()
{
refresh();
llSetTimerEvent(5);
}

timer()
{
if ((integer)llGetWallclock() % 60 < 10)
{
refresh();
}
}
}
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
03-30-2007 20:56
There seem to be some contrary timings in this and that might generate unexpected undocumented behaviour that might behave differently with different updates.

The timer is called once every 5 seconds. Then it would not be good to sleep for 30 seconds in the refresh routine. The first part of the counter seems to check whether the seconds are less than 10, presumable so as to call refresh once or twice per minute. But with the refresh delays, that might never happen, as the time will only respond in the first 10 seconds of each minute (0 to 9).

Maybe the minutes should be computed and refresh called when the minutes change.

Otoh, refresh should be split and the timer called every 30 seconds, alternating calls on the halves of refresh.

Sorry, going to lunch in a minute, so no time to rewrite, but maybe Newgie might oblige?
ahkenatan Grommet
The lovable old Primosaur
Join date: 11 Jan 2005
Posts: 193
03-30-2007 21:22
Hmmmm never even thought to look at the timer. I'm going to hop on and mess with those settings. I'm willing try anything at this point. Thanks for the input :)
Bree Giffen
♥♣♦♠ Furrtune Hunter ♠♦♣♥
Join date: 22 Jun 2006
Posts: 2,715
03-31-2007 12:52
As of this new update my invisiprims look a lot better. They are much more invisible to me now. It used to be that I could still see the shape of the invisiprim because it made the background a tiny bit lighter. I'm not sure if they were fixing a bug when they made shiny prims stay visible when covered by an invisiprim. The shiny prims do turn to a flat color though so it's not completely perfect. At least semi-transparent textures still turn invisible.
_____________________
ahkenatan Grommet
The lovable old Primosaur
Join date: 11 Jan 2005
Posts: 193
04-02-2007 05:57
Unfortunately this has pretty much ruined my style of vehicles. I will be closing down for a while, need a break anyway. Maybe I can figure this out someday. Thanks for all who looked at it.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
who me?
04-02-2007 06:43
From: ed44 Gupte
There seem to be some contrary timings in this and that might generate unexpected undocumented behaviour that might behave differently with different updates.

The timer is called once every 5 seconds. Then it would not be good to sleep for 30 seconds in the refresh routine. The first part of the counter seems to check whether the seconds are less than 10, presumable so as to call refresh once or twice per minute. But with the refresh delays, that might never happen, as the time will only respond in the first 10 seconds of each minute (0 to 9).

Maybe the minutes should be computed and refresh called when the minutes change.

Otoh, refresh should be split and the timer called every 30 seconds, alternating calls on the halves of refresh.

Sorry, going to lunch in a minute, so no time to rewrite, but maybe Newgie might oblige?


ed44's comments are correct this script could fail to work at all given the 'right' circumstances.

I'm not 100% sure what your trying to achive, but heres a blind generated version.


CODE

integer Flag;
float timer = 5.;

SetTexture(string id)
{
llSetTexture(id, ALL_SIDES);
llOffsetTexture(0.468, 0, ALL_SIDES);
llScaleTexture(0, 0, ALL_SIDES);
//
// The above 3 lines generate a 0.6 second delay.
// I think they could be replaced with
// llSetPrimitiveParams( [PRIM_TEXTURE, ALL_SIDES, id, <0.,0.,0.>, <0.468, 0. ,0.>, 0 ] );

}

default
{
state_entry()
{
Flag = False;
llSetTimerEvent(0.1); // Force a near immediate Update
}

timer()
{
Flag = !Flag;
if(Flag)SetTexture("38b86f85-2575-52a9-a531-23108d8da837");
else SetTexture("e97cf410-8e61-7005-ec06-629eba4cd1fb");
llSetTimerEvent(timer);
}
}
Gearsawe Stonecutter
Over there
Join date: 14 Sep 2005
Posts: 614
04-02-2007 15:03
Has anyone tried just this. then remove the script when you are done. Have been doing this for over a year and seems to work for me. What is the purpose of the timer but to use up script resources. once the properties of the prim are set there is no reason to keep updating them. what is the purpose of the other texture key people are always setting it to the first time?
CODE

default
{
state_entry()
{
llSetPrimitiveParams( [PRIM_TEXTURE, ALL_SIDES, "e97cf410-8e61-7005-ec06-629eba4cd1fb", <0, 0 ,0>, <0.468, 0, 0>, 0 ] );
}
}
ahkenatan Grommet
The lovable old Primosaur
Join date: 11 Jan 2005
Posts: 193
04-02-2007 15:46
Well I tried both suggestions above, thanks guys, but still getting the same effect. It turns the prim invisible but it only cancels out the shiny on the prim behind it instead of making that prim see through as well. See my links on the first post as to what happens now. I'm guessing this "feature" is now gone forever. Again thanks to all who looked at this.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-03-2007 00:42
From: Gearsawe Stonecutter
Has anyone tried just this. then remove the script when you are done. Have been doing this for over a year and seems to work for me. What is the purpose of the timer but to use up script resources. once the properties of the prim are set there is no reason to keep updating them. what is the purpose of the other texture key people are always setting it to the first time?
CODE

default
{
state_entry()
{
llSetPrimitiveParams( [PRIM_TEXTURE, ALL_SIDES, "e97cf410-8e61-7005-ec06-629eba4cd1fb", <0, 0 ,0>, <0.468, 0, 0>, 0 ] );
}
}



The orginal script toggled between the two textures, which is why I retained that functionality. As I said in my post I've no idea what they are trying to achive with it.
if it is just a fire and forget then your script would certainly be preferable although I'd also add
CODE
llRemoveInventory(llGetScriptName());
to self clean up.
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
04-03-2007 03:10
And another variation :)

/54/63/44186/1.html#post468050
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-03-2007 03:42
From: Pale Spectre



And Strife's parting comment is very pertinent

From: Strife
It is likely come the next generation of renderer, we will need to come up with a new way to make av's invisible.
ahkenatan Grommet
The lovable old Primosaur
Join date: 11 Jan 2005
Posts: 193
04-03-2007 17:42
"As I said in my post I've no idea what they are trying to achive with it."

Newgate, I know I'm not so good at expressing myself sometimes so I give it another shot.

example:
I would res a cube and set shiny to high. Then I would rez a sphere and put it in front of the cube then drop the invisible script in the sphere. At that point the sphere turns invisible, of course. Now not only can I see through the sphere I can also see through the cube, but only when I look at it through the sphere. If I moved the camera around I can still see the shiny cube just fine unless the camera's line of vision put the sphere between myself and the cube. I cannot believe this is so hard to describe. I'm confused at what I just wrote, lol.

Check out this picture:
http://www.sluniverse.com/pics/pic.aspx?id=152721&sort=Pictures.PictureID+desc&Name=ahkenatan+Grommet

Notice the light parts of the prims around the wheel? You are seeing the outline of what an invisible half-cylinder looks like now, with that invisible script in it. Before there was no outline. It simply cancelled out the shiny prims behind it, within it's outline. All you would see is the wheel itself and a nicely shaped wheel well.
Ed Gobo
ed44's alt
Join date: 20 Jun 2006
Posts: 220
04-04-2007 03:21
Could this be an example of the opengl transparency display order bug? Are both the body and the wheel 32 bit .tga's?

I do believe that opengl v2 changed this behaviour somewhat, or maybe SL first look viewer has altered this bug in some way.

It looks like all this timing stuff was just a red (sic) herring!

btw, ed44 and I are intimately related!
Domino Marama
Domino Designs
Join date: 22 Sep 2006
Posts: 1,126
04-05-2007 13:06
Just been experimenting with this and as far as I can tell, a single shot script is enough, the script isn't needed after either texture is set (shoes makers take note!). What does seem to be happening is that only textures with an alpha channel are affected. If the texture doesn't have an alpha channel then it appears as normal. If it has an alpha channel then the invisiprim will hide it..
Krimson Gray
Registered User
Join date: 5 Dec 2006
Posts: 40
04-07-2007 14:10
I use this one...

CODE
default
{
state_entry()
{
llSetTexture("e97cf410-8e61-7005-ec06-629eba4cd1fb", ALL_SIDES);
}
}
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-07-2007 14:53
From: Domino Marama
Just been experimenting with this and as far as I can tell, a single shot script is enough, the script isn't needed after either texture is set (shoes makers take note!). What does seem to be happening is that only textures with an alpha channel are affected. If the texture doesn't have an alpha channel then it appears as normal. If it has an alpha channel then the invisiprim will hide it..



Interesting that you should mention shoes.
I have recently had a couple of occurences where a friends shoes suddenly become completely invisible. Later that same week, in a totally unrelated incident, an object I was working on became invisible of its own accord. I did however find a script not of my making inside it. A few minute slater the script had disappeared. The object was not set to allow inventory drop at the time.
Julian Volitant
Registered User
Join date: 9 Feb 2007
Posts: 8
08-12-2007 13:49
How can I make this turn on/off when needed. For example with like /1 on or /1 off.

I am a scripting noob.

Thank you
Day Oh
Registered User
Join date: 3 Feb 2007
Posts: 1,257
08-12-2007 13:58
One fix for your problem would be to set the prim that you want to be susceptible to the effects of the invisiprim to be 1% transparent.

About the script that switches between the two invisiprim textures... I've never done it, but it's always striked me as funny and if someone knows a reason why it should be done, they should post it. For now, I think it's pointless and I'd go with the script Krimson posted. And then remove it P:
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
08-13-2007 11:39
for some history on this stuff:

/15/6f/22112/1.html
MathieuBC Noel
Registered User
Join date: 26 May 2007
Posts: 3
A full working invisible script !!!!!
08-17-2007 18:30
(begin code)

// Invisibility Prim Refresh v1.1a
// by Beatfox Xevious
// last updated Oct. 21, 2004

refresh()
{
llSetTexture("38b86f85-2575-52a9-a531-23108d8da837", ALL_SIDES);
llSleep(30);
llSetTexture("e97cf410-8e61-7005-ec06-629eba4cd1fb", ALL_SIDES);
}

default
{
state_entry()
{
llSetPrimitiveParams([PRIM_BUMP_SHINY, ALL_SIDES, PRIM_SHINY_NONE, PRIM_BUMP_BRIGHT]);
llOffsetTexture(0.468, 0.0, ALL_SIDES);
llScaleTexture(0.0, 0.0, ALL_SIDES);
llSetAlpha(1.0, ALL_SIDES);
llSetTimerEvent(5);
}

timer()
{
if ((integer)llGetWallclock() % 60 < 10)
{
refresh();
}
}
}

(end code)