Jump to content

texture changer, materials, uuid


hollowman
 Share

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

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

Recommended Posts

Hello! please help with scripts! i need to turn the texture changer scripts(sender/receiver) into material texture changer. it uses uuids. There are two scripts. for primmy hud with 3 buttons. I have already posted this request in the job section, but just in case, here too. I understand scripts quite a bit. maybe just tell me what needs to be done, if not difficult. 

Link to comment
Share on other sites

It all depends on how you wrote the texture changing code.  If you are already using llSetLinkPrimitiveParamsFast to change PRIM_TEXTURE, then all you need to do is add PRIM_NORMAL and PRIM_SPECULAR parameters to those statements.  If you are using some other method, like llSetLinkTexture, you can still change the materials parameters separately with SLPPF.  If you don't feel confident enough to do the work yourself, then just explain what you want to the scripter that you hire.  She ought to be able to do it fairly easily.

  • Thanks 1
Link to comment
Share on other sites

54 minutes ago, Rolig Loon said:

It all depends on how you wrote the texture changing code.  If you are already using llSetLinkPrimitiveParamsFast to change PRIM_TEXTURE, then all you need to do is add PRIM_NORMAL and PRIM_SPECULAR parameters to those statements.  If you are using some other method, like llSetLinkTexture, you can still change the materials parameters separately with SLPPF.  If you don't feel confident enough to do the work yourself, then just explain what you want to the scripter that you hire.  She ought to be able to do it fairly easily.

Thanks for the answer! yes the script uses llSetLinkTexture.
the sender script looks like:

string product_id = "object_name";
// -------------------------------------------
string  vApplierPassword = "password"; 
integer vApplierChannel  = 1234; 

// button & texture uuid
list settings = [
    "BTN1","texture_uuid",
    "BTN2","texture_uuid",
    "BTN3","texture_uuid"
];

default
{
    touch_start(integer num_detected)
    {
        string  btnid = llGetLinkName(llDetectedLinkNumber(0));
        integer line  = llListFindList(settings,[btnid]); 

        if(line != -1){
            string pswd = llSHA1String((string)llGetOwner()+vApplierPassword+product_id);
            llRegionSayTo(llGetOwner(),vApplierChannel,pswd+"&"+llList2String(settings,line+1));
        }
    }
}

and I don’t understand how to add materials to it.

The receiver script applies texture:

llSetLinkTexture(_TargetPrimLinknr,(key)llList2String(data,1),vTargetPrimFace);

Maybe something will be clear from these pieces of code.

 

 

-- I usually apply materials like this --

llSetLinkPrimitiveParamsFast
(PRIM_1,   [
PRIM_TEXTURE,FACE_1,DIFFUSE_1,<1,1,0>,ZERO_VECTOR,0.0,
PRIM_NORMAL,FACE_1,NORMAL_1,<1,1,0>,ZERO_VECTOR,0.0,    
PRIM_SPECULAR,FACE_1,SPECULAR_1,<1,1,0>,ZERO_VECTOR,0.0,WHITE,85,15]);

 

Link to comment
Share on other sites

8 minutes ago, hollowman said:

The receiver script applies texture:


llSetLinkTexture(_TargetPrimLinknr,(key)llList2String(data,1),vTargetPrimFace);

 

There you have it. llSetLinkTexture does not support materials.
So why don't you use you usual method with llSetLinkPrimitiveParamsFast()?

  • Like 1
Link to comment
Share on other sites

7 minutes ago, Fritigern Gothly said:

There you have it. llSetLinkTexture does not support materials.
So why don't you use you usual method with llSetLinkPrimitiveParamsFast()?

Hello! Thanks for answer! but how llSetLinkPrimitiveParamsFast  will look here like?

llSetLinkPrimitiveParamsFast
(PRIM_1,   [
PRIM_TEXTURE,FACE_1,  (_TargetPrimLinknr,(key)llList2String(data,1),vTargetPrimFace),<1,1,0>,ZERO_VECTOR,0.0,
PRIM_NORMAL,FACE_1,NORMAL_1,<1,1,0>,ZERO_VECTOR,0.0,    
PRIM_SPECULAR,FACE_1,SPECULAR_1,<1,1,0>,ZERO_VECTOR,0.0,WHITE,85,15]);
  

I am just pretty lost here.

Link to comment
Share on other sites

22 minutes ago, hollowman said:

-- I usually apply materials like this --


llSetLinkPrimitiveParamsFast
(PRIM_1,   [
PRIM_TEXTURE,FACE_1,DIFFUSE_1,<1,1,0>,ZERO_VECTOR,0.0,
PRIM_NORMAL,FACE_1,NORMAL_1,<1,1,0>,ZERO_VECTOR,0.0,    
PRIM_SPECULAR,FACE_1,SPECULAR_1,<1,1,0>,ZERO_VECTOR,0.0,WHITE,85,15]);

Great.  So that's exactly what your receiving script can do too.  You are already passing an encoded string of settings from thje main script, so the receiving script already knows the link and face numbers that it needs to operate on. So add your bit of SLPPF code to it and let it apply the materials to the same link/face.  

EDIT: I assume that you are already passing the diffuse texture UUID in the parameter string.  Pass the normal and spec texture UUIDs too, or store them in the receiving script and apply them by reference.

Edited by Rolig Loon
  • Thanks 1
Link to comment
Share on other sites

41 minutes ago, Rolig Loon said:

Great.  So that's exactly what your receiving script can do too.  You are already passing an encoded string of settings from thje main script, so the receiving script already knows the link and face numbers that it needs to operate on. So add your bit of SLPPF code to it and let it apply the materials to the same link/face.  

EDIT: I assume that you are already passing the diffuse texture UUID in the parameter string.  Pass the normal and spec texture UUIDs too, or store them in the receiving script and apply them by reference.

And the new list will look like?:

// button & texture uuid
list settings = [
    "BTN1","diff1","norm1","spec1",
"BTN2","diff2","norm2","spec2",
"BTN3","diff3","norm3","spec3"
];

And how to pass/receive normal and specular here?

 

Edited by hollowman
Link to comment
Share on other sites

I'm reduced to guessing what exactly you are passing in that string.  I'm assuming that "diff1", "norm1", "spec1", and so on are all texture UUIDs, right? If so, you are already passing them.  Just parse the string on the receiving end and apply the textures.

  • Thanks 1
Link to comment
Share on other sites

12 hours ago, Rolig Loon said:

I'm reduced to guessing what exactly you are passing in that string.  I'm assuming that "diff1", "norm1", "spec1", and so on are all texture UUIDs, right? If so, you are already passing them.  Just parse the string on the receiving end and apply the textures.

Yes its a list of materials uuids for each button.

EDIT: Yay! I already got it! Thank you!!!

 

 

Edited by hollowman
  • Like 3
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1707 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...