Reply
Member
Syle Devin
Posts: 197
0 Kudos

HUD work separately for different objects?

[ Edited ]

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?

Dora Gustafson
Posts: 1,895
Registered: ‎10-05-2009
0 Kudos

Re: HUD work separately for different objects?

Reply to Syle Devin - view message

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()

:smileysurprised::smileyhappy::smileyvery-happy:

Member
Syle Devin
Posts: 197
0 Kudos

Re: HUD work separately for different objects?

[ Edited ]

Reply to Dora Gustafson - view message

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.

Dora Gustafson
Posts: 1,895
Registered: ‎10-05-2009
0 Kudos

Re: HUD work separately for different objects?

Reply to Syle Devin - view message

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

:smileysurprised::smileyhappy::smileyvery-happy:

Member
Syle Devin
Posts: 197
0 Kudos

Re: HUD work separately for different objects?

Reply to Dora Gustafson - view message

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.

Rolig Loon
Posts: 25,595
Registered: ‎10-05-2009
0 Kudos

Re: HUD work separately for different objects?

Reply to Syle Devin - view message

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.

Not as dumb as I look
Member
Syle Devin
Posts: 197
0 Kudos

Re: HUD work separately for different objects?

[ Edited ]

Reply to Rolig Loon - view message

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");
    }
}

 

Rolig Loon
Posts: 25,595
Registered: ‎10-05-2009
0 Kudos

Re: HUD work separately for different objects?

Reply to Syle Devin - view message

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"))

Not as dumb as I look
Member
Syle Devin
Posts: 197
0 Kudos

Re: HUD work separately for different objects?

[ Edited ]

Reply to Rolig Loon - view message

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?

Rolig Loon
Posts: 25,595
Registered: ‎10-05-2009
0 Kudos

Re: HUD work separately for different objects?

[ Edited ]

Reply to Syle Devin - view message

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");

Not as dumb as I look