- Forums
- :
- Creation Forum
- :
- LSL Scripting
- :
- Re: HUD work separately for different objects?
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
HUD work separately for different objects?
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-06-2013 02:30 AM - edited 02-06-2013 02:34 AM
So I just accomplished creating an HUD that will select the different sections of an object for you and change there color. Right now it is made to work with furniture and the furniture listens for the HUD. This causes a problem when you have more than one furniture piece out because the HUD effects all furniture set up to work with the HUD.
I can only think of one way to do this and it is not prefered. I don't really want to make people click on the furniture but if I can somehow have a random channel be created when you click on the furniture and the HUD will read that and replace the channels that effect the color changing then I would be fine adding something like that. Is do able without much extra work and adding to the scripts I already have?
Though this can also be a problem because you can click on the furniture and choose what face you want to change the color of. I imagine with a click channel changer the channel would be changing constantly while your choosing your face. Would this be bad? If it isn't bad I might look into a click change but I'm trying to see if there is a better way to set up the scripts.
Any suggestions on how I should go about making the HUD work seperately for different objects?
Re: HUD work separately for different objects?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Reply to Syle Devin - view message
02-06-2013 03:06 AM
I don't see clearly how you separate clicking the HUD and clicking the rezzed objects (furniture)
The most simple and straight forward way to separate objects would be by their object name
You can have a list of object names from which you pick the one you want
Using a sensor you can make a list if you don't want to make it manually
You would need a sensor anyway to make a list of object keys
With name and key lists at hand you can say your command to any specific piece of furniture by llRegionSayTo()
![]()
![]()
![]()
Re: HUD work separately for different objects?
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Reply to Dora Gustafson - view message
02-06-2013 03:20 AM - edited 02-06-2013 03:24 AM
Hmm, sounds like I could do it tht way but hte only problem is that it involves having a set amount of items and there names. I want this to work with multiple items regardless of the quantity or names. One reason, but not the only, being that the objects will be modifyable and so the name might change.
That sensor is pretty interesting though, didn't know sensors were possible.
Re: HUD work separately for different objects?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Reply to Syle Devin - view message
02-06-2013 03:56 AM
You don't have to keep lists if you don't want to
You can type in the object name, use sensor to find the key and use llRegionSayTo to say your command
![]()
![]()
![]()
Re: HUD work separately for different objects?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Reply to Dora Gustafson - view message
02-06-2013 01:44 PM
But then that takes chat commands. Isn't there some way I can just have the HUD register the couch by clicking on it? I think it would be hard to code but I am up for it.
Re: HUD work separately for different objects?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Reply to Syle Devin - view message
02-06-2013 01:59 PM
You could do it all with dialogs, if you were clever enough. Tell your sensor to look for all objects within a 15m radius and put their names on dialog buttons.
Re: HUD work separately for different objects?
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Reply to Rolig Loon - view message
02-06-2013 02:33 PM - edited 02-06-2013 02:34 PM
Interesting though that would get me a bunch of objects that wouldn't be associated with the HUD? Would there be a way to keep that from happening? Maybe some sort of message and return message to associate certain objects with the HUD?
Also I am testing out my original idea. When you click on the furniture it sends out a message with a random whole number. The scripts will read that and then put it as the channel that they speak on. Though is it possible to set a random number as an integer to replace the listen channel?
Such as this? Though I am getting erros and I can't see why.
integer random;
default
{
state_entry()
{
random = (integer) llFrand (7.0);
}
touch_start(integer total_number)
{
llSay(PUBLIC_CHANNEL, random");
}
}
Re: HUD work separately for different objects?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Reply to Syle Devin - view message
02-06-2013 02:45 PM
If you do that, just remember that a chat message is always a string, so you'll have to recast that integer variable to send it and then convert it back to an integer on the other end. (Also, use a high negative number, not a positive number in the range from 0 to 6.)
Yes, doing a raw sensor scan would get you the 16 closest objects within range, not just your sofas. You could always filter for objects named "Sofa" though, as in
llSensor ("Sofa","",ACTIVE|PASSIVE,15.0,PI);
or scan for everything but only make dialog buttons
if (~llSubStringIndex(llDetectedName(i),"Sofa"))
Re: HUD work separately for different objects?
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Reply to Rolig Loon - view message
02-06-2013 03:19 PM - edited 02-06-2013 03:25 PM
Yea I was thinking about that, detect name or something, but if the user ever changes the name of the object and decides, for whatever reason, to remove sofa, then the HUD wouldn't work.
Also I am not sure what you mean by recast? I did manage to get the script working. I just changed it to
touch_start(integer total_number)
{
random = (integer) llFrand (-500.0);
llSay(PUBLIC_CHANNEL, (string) random);
}
Also is it possible to have listen look for a set of numbers or a (string) on a specific channel or would I have to set the script to listen for anything?
Re: HUD work separately for different objects?
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Reply to Syle Devin - view message
02-06-2013 03:48 PM - edited 02-06-2013 03:49 PM
Yes, you recast the integer properly to a string in the llSay statement. (See https://wiki.secondlife.com/wiki/Typecast. )
As for listening for a specific string .... The LSL wiki is your friend. Study the syntax for llListen.
llListen (-18477284,"","","A_specific_string");

