haruspero Posted March 29, 2020 Share Posted March 29, 2020 So, for the past 6 hours I've been attempting to make a "HUD" (just a block on my UI) that will switch my avatar when I click it. I've searched the MP and the wiki for readily made things. I'm very new to LSL but I have some experience with scripting in other languages. What I'm asking is, can anyone tell me how they would be able to get this to work? I don't need some grand overview. Just a few pointers? I'm not aiming for role-play, just to be clear. Link to comment Share on other sites More sharing options...
KT Kingsley Posted March 29, 2020 Share Posted March 29, 2020 (edited) This script uses RLV to change your current outfit to whatever is in the RLV folder called "My outfit" when you click on the object (rezzed in-world or worn as a HUD) it's in. The folder "My outfit" should be a sub-folder of the "#RLV" folder in your inventory. string target_folder = "My outfit"; default { touch_end (integer count) { llOwnerSay ("@detach=n"); //don't detach this HUD llOwnerSay ("@detachthis:" + target_folder + "=n"); //don't detach anything you're already wearing that's also in the target folder llOwnerSay ("@detach=force"); //detach all your other attachments llOwnerSay ("@remoutfit=force"); //remove all your other system clothing llOwnerSay ("@attachall:" + target_folder + "=force"); //attach everything in the target folder llOwnerSay ("@detachthis:" + target_folder + "=y"); //reenable detaching items in the target folder llOwnerSay ("@detach=y"); //reenable detaching this HUD } } Also, here's a link to the RLV API in the wiki: http://wiki.secondlife.com/wiki/LSL_Protocol/RestrainedLoveAPI. Edited March 29, 2020 by KT Kingsley 3 Link to comment Share on other sites More sharing options...
haruspero Posted April 1, 2020 Author Share Posted April 1, 2020 Thanks! It worked like a charm. I have one additional question. How would I go about making a selection screen pop up? That way I can have multiple options? Link to comment Share on other sites More sharing options...
KT Kingsley Posted April 1, 2020 Share Posted April 1, 2020 I have a sub-folder in my "#RLV" folder called "Outfits". I use the RLV command "@getinv:Outfits=2222" to get the names of the individual outfit sub-folders in that. The RLV command returns their names as a CSV (comma separated values) chat message on, in this example, channel 2222. I convert those CSVs, using llCSV2List, to a list of button names that goes into the menu function llDialog. And the return from that, plus the outfit folder name, goes into the example I gave. integer rlv_listener; integer dialog_listener; default { touch_end (integer total_number) { rlv_listener = llListen (2222, "", "", ""); // create a listener to listen for the result of the RLV command llOwnerSay ("@getinv:Outfits=2222"); // get a list of the folders inside the folder "#RLV/Outfits" } listen (integer channel, string name, key id, string message) { if (channel == 2222) // this is the result of the RLV folder query { llListenRemove (rlv_listener); // remove the listener list buttons = llCSV2List (message); // convert the result to a list dialog_listener = llListen (3333, "", "", ""); // create a listener to listen for the result of the dialog llDialog (llGetOwner (), "\nSelect an outfit:", buttons, 3333); // create a dialog using the buttons list } else if (channel == 3333) // this is the result of the dialog { llListenRemove (dialog_listener); // remove the listener llOwnerSay ("@detach=n"); //don't detach this HUD llOwnerSay ("@detachthis:Outfits/" + message + "=n"); //don't detach anything you're already wearing that's also in the target folder llOwnerSay ("@detach=force"); //detach all your other attachments llOwnerSay ("@remoutfit=force"); //remove all your other system clothing llOwnerSay ("@attachall:Outfits/" + message + "=force"); //attach everything in the target folder llOwnerSay ("@detachthis:Outfits/" + message + "=y"); //reenable detaching items in the target folder llOwnerSay ("@detach=y"); //reenable detaching this HUD } } } This is a pretty basic script without any error handling or error prevention. It doesn't include any timeouts, it doesn't check the RLV message contents for suitability as button labels, and it doesn't do anything about multiple unexpected clicks. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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