Jump to content
StellaEricsson

Apply Specular with a Script

Recommended Posts

Hello everyone,

I'll try to make this request for help short and concise. I've recently started to thinker with scripting, currently I am making a rotating billboard that changes texture on time intervals, each side a different texture.
That was hard enough to do because all the examples available in literature show how to do it to ALL faces, but not individual faces. So no examples or syntax demonstrations.
So they all show this...
llSetLinkTexture(LINK_SET, "00000000-0000-0000-0000-000000000000", ALL_SIDES);
Then mention you CAN change per face, but no examples... and I know it is obvious now but that took me an hour to find the right syntax.

So, I'm currently changing the faces with...
llSetLinkTexture(LINK_SET, "00000000-0000-0000-0000-000000000000", 1)
llSetLinkTexture(LINK_SET, "00000000-0000-0000-0000-000000000000", 2)
... and so on.

This applies the texture to the diffuse layer, my question is, how do I apply a texture on the specular layer per face in the same manner?
I tried llSetLinkSpecular, llSetLinkTextureSpecular but those do not exist and I can't find a reference to anything like that online, is it even possible?

Thanks in advance for any reply.

Share this post


Link to post
Share on other sites

use llSetLinkPrimitiveParamsFast with the PRIM_SPECULAR flag.   It is more complicated than a simple stand alone 'set specular' command, but it'll get the job  done for you.

edit: and on a reread you do state you are new on scripting.  The set primitive params set of commands has a bit of a learning curve on the syntax needed to make it work, but it can get into some of the deeper parameters of a prim that can't be done with any of the stand alone commands, and, as a big pus, it can do several all at once.  That can be very useful at times.   Tinker and play with it.

 

Edited by Anna Salyx
  • Like 1

Share this post


Link to post
Share on other sites

Thank you everyone that replied, for future reference I'll leave it here...

llSetPrimitiveParams([
                            PRIM_TEXTURE, 2, "00000000-0000-0000-0000-000000000000", <1.0, 1.0, 0.0>, ZERO_VECTOR,0.0,
                            PRIM_SPECULAR, 2, "00000000-0000-0000-0000-000000000000", <1.0, 1.0, 0.0>, ZERO_VECTOR,0.0, <0.502, 0.502, 0.502>, 100, 0]);

Again for some reason I didn't find it in the literature any correct examples of syntax, for a new comer that is very hard to figure out.

Share this post


Link to post
Share on other sites

Once you stare at entries in the LSL wiki for a while, it will start to make more sense.  The basic syntax for any function is shown right at the top of the page for that function.  It will tell you what each input parameter means, and what the output looks like.  For a complicated function like llSetLinkPrimitiveParams, things are a bit messier, but the syntax details for each parameter are spelled out on that parameter's line as well.

Share this post


Link to post
Share on other sites
8 hours ago, StellaEricsson said:

Thank you everyone that replied, for future reference I'll leave it here...

llSetPrimitiveParams([
                            PRIM_TEXTURE, 2, "00000000-0000-0000-0000-000000000000", <1.0, 1.0, 0.0>, ZERO_VECTOR,0.0,
                            PRIM_SPECULAR, 2, "00000000-0000-0000-0000-000000000000", <1.0, 1.0, 0.0>, ZERO_VECTOR,0.0, <0.502, 0.502, 0.502>, 100, 0]);

Again for some reason I didn't find it in the literature any correct examples of syntax, for a new comer that is very hard to figure out.

Yes, I think scripters tend to forget quite quickly how hard it is for absolute beginners (especially if they have no previous experience with other scripting languages) to find really exhaustive descriptions on how to tinker with the basic LSL functions. I have bought this as an e-book and it has helped me a lot: https://www.amazon.com/Scripting-Your-World-Official-Second/dp/0470339837

Even if some info is outdated, it gives a quite exhaustive introduction and not just some snippets here and there that you need to puzzle together yourself. However if you have been able to make sense of the llSetPrimitiveParams all by yourself, then maybe you'll get there without the book...

  • Thanks 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...