Jump to content

Need help with a texture applier HUD Sender and Receiver


Recommended Posts

I need a little help if possible. I am using these scripts as an inspiration to derive from but with some differences. I just do not know how to go about it. I want to switch things around to where I can conveniently place the texture UUIDs in the hud instead of the mesh objects themselves. Basically send the texture UUID as a message to the receiver script and apply the texture. These scripts work well but I would rather not have to change each receiver script's uuid settings and rather have it down to just configuring the HUD script settings. 

Any and all help is appreciated.

Sender (HUD):

Quote

//===== Texture Changing HUD - by Sylvia Wasp =====
//      installed in the root prim of a linkset
//      where the other prims are *named* buttons
//=================================================

integer     cmdChannel;
integer     app_id = 73245;
string      HUD_Name = "Product HUD";

default
{
    state_entry ()
    {
        llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_NAME,HUD_Name]);
        cmdChannel = (integer)("0x"+(string)llGetOwner());
        if (cmdChannel == app_id) ++app_id;
        cmdChannel = cmdChannel ^ app_id | 0x80000000;
    }

    touch_start(integer n)
    {
        string button = llGetLinkName(llDetectedLinkNumber(0));
        llRegionSayTo(llGetOwner(),cmdChannel, button);
        llSay(cmdChannel, button);                      // delete when done
    }                
}

Receiver Script:

Quote

//===== Texture Changer (Mesh) - by Sylvia Wasp ========
//      installed in an item of mesh clothing,
//      receives messages from "Texture Changing HUD"   
//======================================================

integer     cmdChannel;
integer     app_id = 73245;

key         texture_01 = "36e9d64c-3f58-92d1-b2d1-807ddc996558";    
key         texture_02 = "1db31c0c-622a-d120-23dd-52519592d253";
key         texture_03 = "614544ae-4bdf-c8d6-2cb3-0115a990943b";    
key         texture_04 = "06943dd0-0216-16c7-83de-4f40c6185106";
key         texture_05 = "33a2a763-dae0-e4b9-d908-b56d9c50fb47";    
key         texture_06 = "bfba4c48-cea2-3523-b62d-52beafcb3a77";

default
{
    state_entry ()
    {
        cmdChannel = (integer)("0x"+(string)llGetOwner());
        if (cmdChannel == app_id) ++app_id;
            cmdChannel = cmdChannel ^ app_id | 0x80000000;
            
        llListen(cmdChannel, "Product HUD", NULL_KEY, "");
    }

    listen(integer channel, string name, key id, string message) 
    {
        key msg_owner = llGetOwnerKey(id);
        key msg_creator = llList2Key(llGetObjectDetails(id, [OBJECT_CREATOR]), 0);
        
        if ((msg_owner == llGetOwner()) && (msg_creator == llGetCreator())) {
           llOwnerSay("Hi! I am good thank you");    
            }         

        if (message == "button_01" ) {
            llSetLinkPrimitiveParamsFast(LINK_THIS,[ PRIM_TEXTURE, ALL_SIDES, texture_01, <1.0, 1.0, 1.0>,ZERO_VECTOR, 0.0 ]);
            }
        else if (message == "button_02") {
            llSetLinkPrimitiveParamsFast(LINK_THIS,[ PRIM_TEXTURE, ALL_SIDES, texture_02, <1.0, 1.0, 1.0>,ZERO_VECTOR, 0.0 ]);
            }
        if (message == "button_03" ) {
            llSetLinkPrimitiveParamsFast(LINK_THIS,[ PRIM_TEXTURE, ALL_SIDES, texture_03, <1.0, 1.0, 1.0>,ZERO_VECTOR, 0.0 ]);
            }
        else if (message == "button_04") {
            llSetLinkPrimitiveParamsFast(LINK_THIS,[ PRIM_TEXTURE, ALL_SIDES, texture_04, <1.0, 1.0, 1.0>,ZERO_VECTOR, 0.0 ]);
            }
        if (message == "button_05" ) {
            llSetLinkPrimitiveParamsFast(LINK_THIS,[ PRIM_TEXTURE, ALL_SIDES, texture_05, <1.0, 1.0, 1.0>,ZERO_VECTOR, 0.0 ]);
            }
        else if (message == "button_06") {
            llSetLinkPrimitiveParamsFast(LINK_THIS,[ PRIM_TEXTURE, ALL_SIDES, texture_06, <1.0, 1.0, 1.0>,ZERO_VECTOR, 0.0 ]);
            }
    }
} 

 

Link to post
Share on other sites

not sure if this is what you want, but its simple to send from HUD to receiver?

just mebbe associate textures with buttons in the touch event, i.e.

if( llDetectedLinkNumber(0) == 2){ string msg = "5d4d5d90-f467-35d1-4850-3bf61a6401e0";  llRegionSay(cmdChannel, msg); }

etc etc

 

.
Sender:

integer  cmdChannel ;
default
{
    state_entry()
    { cmdChannel = (integer)("0x"+(string)llGetOwner());       
    }
    touch_start(integer total_number)
    { string msg = "5d4d5d90-f467-35d1-4850-3bf61a6401e0";
      llRegionSay(cmdChannel, msg);
    }
}

.
Reciever: 

integer  cmdChannel;
default
{
    state_entry()
    { cmdChannel = (integer)("0x"+(string)llGetOwner());
      llListen( cmdChannel, "","","");
    }   
    listen(integer channel, string name, key id, string message) 
    {  llSetTexture( message,ALL_SIDES);
    }     
}

 

Edited by Xiija
  • Like 4
Link to post
Share on other sites

Not to promote paranoia, @Arcadia Fehr, but this approach means that anybody who knows the channel can also know the UUID of the textures. The space of possible channels is vast, but if the script uses one of the cookbook ways of deriving user-specific channels, it could be easy to discover. In actual practice, that's usually not a big deal anyway because textures are only useful on a more or less identical model, but one way to sidestep the issue entirely in cases where the receiver and sender are attached to the same avatar could be to replace llRegionSay() with llRegionSayTo() with the target UUID of the owner, all of whose attachments will then get the message. Another alternative would be to pick an encryption scheme that shares a secret between sender and recipient, although that's not all that different from merely using a channel derived from a shared secret.

  • Like 1
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...