Jump to content

llSetPrimitiveParams Vs llSetLinkParamsFast script help pleeease XD


MrBobbins
 Share

You are about to reply to a thread that has been inactive for 2804 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hi everyone, I've written the following script with the knowledge I have and a wee bit of reaserch done. I've tried with all my might to bring in the llSetLinkParamsFast function with the LINK_THIS flag.

The script is for a 1 prim mesh old fashioned lamp. Now before I go back to Blender and rebuild it. Theres 4 faces in the mesh I want to act as a light. I know the prim itself will become a light, but the 4 faces to act like the look like they are a light. I;ve created two textures, a "lighton" and a "light off", now this script works, but I'm getting the .2 delay with llSetPrimitiveParams, which makes the light operate in .2 second steps. From off, to on, full bright, get the glow, then turn on the lighting. Off is faster, I just call an ALL_SIDES integer to switch off glow and light.

Now can I make this faster? or A little lighter on the code? Please help me.

integer on = TRUE;
string texture1 = "lamplighton";
string texture2= "lamplightoff2";

default
{
state_entry()
{
//Pray Scotland win the World Cup (any of them... doesn't matter)
}

touch_start(integer x)

{
if (on == TRUE)
{
// Light Is On
llPlaySound("sound1", 0.5);

llSetTexture(texture1, 1);
llSetTexture(texture1, 2);
llSetTexture(texture1, 3);
llSetTexture(texture1, 4);
llSetPrimitiveParams([PRIM_POINT_LIGHT,TRUE,<1.0, 0.502, 0.0>,1.0,15,0.750, PRIM_GLOW, 1, 0.1]);
llSetPrimitiveParams([PRIM_POINT_LIGHT,TRUE,<1.0, 0.502, 0.0>,1.0,15,0.750, PRIM_GLOW, 2, 0.1]);
llSetPrimitiveParams([PRIM_POINT_LIGHT,TRUE,<1.0, 0.502, 0.0>,1.0,15,0.750, PRIM_GLOW, 3, 0.1]);
llSetPrimitiveParams([PRIM_POINT_LIGHT,TRUE,<1.0, 0.502, 0.0>,1.0,15,0.750, PRIM_GLOW, 4, 0.1]);
llSetPrimitiveParams([PRIM_FULLBRIGHT, 1, TRUE]);
llSetPrimitiveParams([PRIM_FULLBRIGHT, 2, TRUE]);
llSetPrimitiveParams([PRIM_FULLBRIGHT, 3, TRUE]);
llSetPrimitiveParams([PRIM_FULLBRIGHT, 4, TRUE]);
on = FALSE;

}

else if (on == FALSE)
{
// Light Is off
llPlaySound("sound1", 0.5);
llSetPrimitiveParams([PRIM_POINT_LIGHT,FALSE,<1.0, 0.502, 0.0>,1.0,15,0.750, PRIM_GLOW, ALL_SIDES, 0.0]);
llSetPrimitiveParams([PRIM_FULLBRIGHT, ALL_SIDES, FALSE]);
llSetTexture(texture2, 1);
llSetTexture(texture2, 2);
llSetTexture(texture2, 3);
llSetTexture(texture2, 4);
llSetPrimitiveParams([PRIM_POINT_LIGHT,FALSE,<1.0, 0.502, 0.0>,1.0,15,0.750, PRIM_GLOW, ALL_SIDES, 0.0]);
llSetPrimitiveParams([PRIM_FULLBRIGHT, ALL_SIDES, FALSE]);
on = TRUE;

}

}
}

Now like I say, this script works the way I want it to, however, I may have written it inneficiently. Any help would be great.

Thank you :)

 



Link to comment
Share on other sites

You can do it all in one call to llSetLinkPrimitiveParamsFast().   You could use llSetLinkPrimitiveParams, too, but that function has an automatic delay built in, so there's no point in using it here.

 

The basic syntax would be something like 

 

		llSetLinkPrimitiveParamsFast(LINK_THIS,[//I'm assuming it just the one prim		PRIM_POINT_LIGHT,TRUE,<1.0, 0.502, 0.0>,1.0,15,0.750, 		PRIM_TEXTURE,1,texture1,<repeats>,<offsets>,rotation_in_radians,		PRIM_TEXTURE,2,texture1,<repeats>,<offsets>,rotation_in_radians,		PRIM_TEXTURE,3,texture1,<repeats>,<offsets>,rotation_in_radians,		PRIM_TEXTURE,4,texture1,<repeats>,<offsets>,rotation_in_radians,		PRIM_FULLBRIGHT, 1, TRUE,		PRIM_FULLBRIGHT, 2, TRUE,		PRIM_FULLBRIGHT, 3, TRUE,		PRIM_FULLBRIGHT, 4, TRUE		]);
  • Like 1
Link to comment
Share on other sites

Innula, thanks for the very very fast reply, I really love that you hekped so quick.

In the time that I took to post, and wait for a reply, I decided to have one more bash at the code, and fixed it, I looked too hard at it trying to be complicated. I took a step back, and as exactly as you suggested, i did... I'm so sorry for wasting your time, but I do hope someone with a similar query would find this useful.

Here's the code I did while you were typing up your reply...

 

integer on = TRUE;default{    state_entry()    {//Nuffin    }      touch_start(integer x)           {         if (on == TRUE)        {             // Turn Light On             llPlaySound("sound1", 0.5);                     llSetLinkPrimitiveParamsFast(LINK_THIS, [                     PRIM_POINT_LIGHT,TRUE,<1.0, 0.502, 0.0>,1.0,15,0.750,                      PRIM_TEXTURE, 1, "lamplighton", <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0,                      PRIM_FULLBRIGHT, 1, TRUE, PRIM_GLOW, 1, 0.1,                     PRIM_TEXTURE, 2, "lamplighton", <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0,                      PRIM_FULLBRIGHT, 2, TRUE, PRIM_GLOW, 2, 0.1,                     PRIM_TEXTURE, 3, "lamplighton", <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0,                      PRIM_FULLBRIGHT, 3, TRUE, PRIM_GLOW, 3, 0.1,                     PRIM_TEXTURE, 4, "lamplighton", <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0,                      PRIM_FULLBRIGHT, 4, TRUE, PRIM_GLOW, 3, 0.1]);                                                 on = FALSE;              }    else if (on == FALSE)        {             // Turn Light Off             llPlaySound("sound1", 0.5);                                  llSetLinkPrimitiveParamsFast(LINK_THIS, [                     PRIM_POINT_LIGHT,FALSE,<1.0, 0.502, 0.0>,1.0,15,0.750, PRIM_GLOW, ALL_SIDES, 0.0,                      PRIM_FULLBRIGHT, ALL_SIDES, FALSE,                     PRIM_TEXTURE, 1, "lamplightoff2", <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0,                      PRIM_TEXTURE, 2, "lamplightoff2", <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0,                      PRIM_TEXTURE, 3, "lamplightoff2", <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0,                      PRIM_TEXTURE, 4, "lamplightoff2", <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0]);             on = TRUE;                  }    }}

 



Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2804 days.

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
 Share

×
×
  • Create New...