MSTRPLN Posted August 9, 2017 Share Posted August 9, 2017 (edited) Hello, i was wondering the following: 1. Can you attach/enable a HUD by clicking on an object? (im making a road system and i would like a HUD to pop-up when you click a road which will give you a texture changer HUD) Why? Because, if possible i'd like to create a hud to style it how i like instead of using a dialog (also the person would see whichtexture is which) but only changing the texture of the object that's been clicked/selected 2. How would one select different elements in a HUD? for example those texture changer HUD's that let's you select which parts you want to change the texture of (for example a shirt you could enable/disable the front, back, sleeves, extras) Thanks in advance Edited August 9, 2017 by MSTRPLN Link to comment Share on other sites More sharing options...
Rolig Loon Posted August 9, 2017 Share Posted August 9, 2017 (edited) Second question first: Use llDetectedTouchST, which you will find described in the LSL wiki. The first question is harder, but only because I'm not sure that I understand your question. I think you are asking about whether you can script some object that will enable a HUD when you click on it in world. So, you wear the HUD and it is invisible or otherwise inactive until you click on a tree or something. If that's what you mean, yes. All you have to do is script the tree to send a message that can only be heard by something you are wearing, and tell your HUD to listen for it. So the tree says: llRegionSayTo(llDetectedKey(0),secret_HUD_channel,"I'm a tree!"); If your HUD is scripted to listen to secret_HUD_channel, it will be the only one to hear the message, even if there are 20 other people around with the same HUD. So.. listen (integer channel, string name, key id, string message) { if (~llSubStringIndex(message,"tree")) { llSetAlpha(1.0,ALL_SIDES); llOwnerSay("You just touched a tree."); } } If I have completely missed your meaning, let's try again. Edited August 9, 2017 by Rolig Loon Link to comment Share on other sites More sharing options...
MSTRPLN Posted August 9, 2017 Author Share Posted August 9, 2017 1 hour ago, Rolig Loon said: Second question first: Use llDetectedTouchST, which you will find described in the LSL wiki. The first question is harder, but only because I'm not sure that I understand your question. I think you are asking about whether you can script some object that will enable a HUD when you click on it in world. So, you wear the HUD and it is invisible or otherwise inactive until you click on a tree or something. If that's what you mean, yes. All you have to do is script the tree to send a message that can only be heard by something you are wearing, and tell your HUD to listen for it. So the tree says: llRegionSayTo(llDetectedKey(0),secret_HUD_channel,"I'm a tree!"); If your HUD is scripted to listen to secret_HUD_channel, it will be the only one to hear the message, even if there are 20 other people around with the same HUD. So.. listen (integer channel, string name, key id, string message) { if (~llSubStringIndex(message,"tree")) { llSetAlpha(1.0,ALL_SIDES); llOwnerSay("You just touched a tree."); } } If I have completely missed your meaning, let's try again. Hmm not really. More like (keeping it simple for now): Item A has 2 items in it's contents: 1. Script - 2. Item B ( called HUD) when clicking on item A it will attach item B as a HUD. I managed to do something like this with llAttachToAvatarTemp but it attaches "Item A" rather than "Item B" default { state_entry() { llRequestPermissions( llGetOwner(), PERMISSION_ATTACH ); llSay(0, "Hello, Avatar!"); } touch_start(integer total_number) { integer totalItems = llGetInventoryNumber(INVENTORY_ALL); integer index; while (index < totalItems) { if(PERMISSION_ATTACH) { string itemName = llGetInventoryName(INVENTORY_OBJECT, 0); integer type = llGetInventoryType(itemName); if (itemName == "HUD") { llAttachToAvatarTemp((integer)ATTACH_HUD_CENTER_1); llSay(0,"Attached!"); } else { llSay(0,"Not attached :("); } } } } } Not really going deep into permissions etc, just trying to get the attaching to work. i tried adding the item name, type etc in the "" llAttachToAvatarTemp" but that gave me the following error "Function call mismatches type or number of arguments" and the wiki only says it needs a integer & attach point, not an example of attaching a different object. Link to comment Share on other sites More sharing options...
arton Rotaru Posted August 9, 2017 Share Posted August 9, 2017 We are all waiting for such functionality to attach an object from another objects inventory directly. Until then we have to rez the object first. Once rezzed, the HUD itself will have to ask for permissions to attach. If it's supposed to work for the owner only, it's easy. If it's supposed to attach to non owners as well, you need some communication between the rezzer and the HUD, to pass along the key of the touching agent, so that the HUD knows to which agent it has to send the perm request. Link to comment Share on other sites More sharing options...
MSTRPLN Posted August 9, 2017 Author Share Posted August 9, 2017 3 minutes ago, arton Rotaru said: We are all waiting for such functionality to attach an object from another objects inventory directly. Until then we have to rez the object first. Once rezzed, the HUD itself will have to ask for permissions to attach. If it's supposed to work for the owner only, it's easy. If it's supposed to attach to non owners as well, you need some communication between the rezzer and the HUD, to pass along the key of the touching agent, so that the HUD knows to which agent it has to send the perm request. Hmm, any pointers how i would do that? (yes owner only, because i want to use this to change between different decals on the roads. I'd rather have a hud with thumbnails than a dialog) Link to comment Share on other sites More sharing options...
arton Rotaru Posted August 9, 2017 Share Posted August 9, 2017 Touching item A > llRezObject("HUD") In the rezzed HUD in the on_rez() event request perms to attach to the owner. Once perms are granted, call llAttachToAvatarTemp() in the HUDs run_time_permissions() event. Link to comment Share on other sites More sharing options...
MSTRPLN Posted August 9, 2017 Author Share Posted August 9, 2017 (edited) Oh, that was less hard than i thought. Edited August 9, 2017 by MSTRPLN Link to comment Share on other sites More sharing options...
Lucia Nightfire Posted August 9, 2017 Share Posted August 9, 2017 5 hours ago, arton Rotaru said: We are all waiting for such functionality to attach an object from another objects inventory directly. Until then we have to rez the object first. Once rezzed, the HUD itself will have to ask for permissions to attach. If it's supposed to work for the owner only, it's easy. If it's supposed to attach to non owners as well, you need some communication between the rezzer and the HUD, to pass along the key of the touching agent, so that the HUD knows to which agent it has to send the perm request. It's a shame LL decided to shelve temp attaching from object inventory. "What might have been..." 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