Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Help With Multi-User HUD

Jaydin Normandy
Registered User
Join date: 1 Apr 2006
Posts: 19
05-19-2008 06:45
I have a project where a user wears a HUD. The user than clicks on a prim on my land and the prim sends out a message on a channel. The message is then heard by the HUD and loads the appropriate textures on the HUD. This works great with a single user but I want it to work with multiple users. For example, if two people are wearing the HUD near the prim and one person clicks on it, I don't want both their HUDs to load the textures, just the avatar that originally clicked it.
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
05-19-2008 07:17
Either include the clicking avatars UUID in your message or set the listen channel on the HUD based on the User's UUID key or name. That way you would get a unique listen channel for each user and the touched prim could just talk on that particular channel by calculating it the same way as the HUD does.
Haruki Watanabe
llSLCrash(void);
Join date: 28 Mar 2007
Posts: 434
05-19-2008 07:17
When the user clicks on the prim, get his key (llDetectedKey()) and send this with the message to the HUD. There, you split up the message and check whether the Owner of HUD is the one who clicked the prim...

This would look something like this:

CODE


// in the sender prim:

touch_start(integer num){

llSay(-12345, (string)llDetectedKey(0) + "|" + my_message; // where my_message is whatever you wanna tell the HUD

// we've got a message that contains the AVs Key followed by your message and divided with a pipe-sign (|)

}


// in the HUD

listen(integer channel, string name, key id, string message){

if(channel == -12345){
list tmp = llParseString2List(message, ["|"], []); // Split up the message into a list

key hudOwner = llList2Key(tmp, 0);
string myMessage = llList2String(tmp, 1);

if(hudOwner == llGetOwner()){
// Do whatever you need to do here
}
}

}



HTH
Jaydin Normandy
Registered User
Join date: 1 Apr 2006
Posts: 19
05-19-2008 08:13
Thank you so much for the information. I can't believe I didn't think of that before!