Jump to content

Texture Change HUD From Scratch


You are about to reply to a thread that has been inactive for 3080 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I've made a mesh object that has 18 different textures. I've also made the HUD image that i'd like users to change the texture from.

I've never scripted, i only know where scripts live within an object. But I do know other scripting languages so I'll be able to learn easily.

I'm just looking for a 'from scratch' tutorial or the basic tools I will need to walk my way through this. I understand I need to get the HUD image attached to the screen and connected to the object I want to change, and then for specific coordinates of the HUD image to call each texture from I'm assuming the HUD object's folder.

A push in the right direction would be swell - thank you!

Link to comment
Share on other sites

For simplicity, you may want to break up you mesh image into sectors such that they will be individual objects. While you can use llDetectedTouchUV to determine where was touched, the mapping on an oddly shaped object would be potentially a lot of work compared with detecting a touched link.

 

You'll want to look at llSay (or variants) to send the texture via a message and the listen function to hear.

 

Finally, llSetLinkPrimitiveParamsFast to set texture or llSetTexture. It depends on how the mesh object is made.

 

A HUD is just an object attached to HUD. DO NOT develop it while attached! If you crash out the sim does, you'll lose all your script edits. Been there done that far too often.

Link to comment
Share on other sites

Thank you for responding Sassy.

So let me see if I understand, Instead of having one image with all of my texture swatches and mapping coordinates, it may be easier to make each swatch an individual image/object and link them together.. interesting. I can see why this would be easier as far as calling textures.

Maybe my issue is at the point you said 'mesh image'. I have it created in photoshop. Is it as simple as attaching this to a box in world?

I still am uncertain where to start, i.e. formatting an object to appear attached to your screen when attached to your avatar. I *think* at that point when all of the individual images are linked.. I should be able to figure out the scripting involved to make them each call their appropriate texture. It is noted to not script while attached!

Thanks agian, I'm getting closer.

 

Link to comment
Share on other sites

As Sassy says, a HUD is nothing more than an object that is attached to your screen instead of being rezzed loose in world.  As a result, you only see whatever is facing you, as a flat image.  From a building standpoint, then, creating a HUD is no different than creating any other object.  You only need to remember that your own perspective is always "forward" or local East.  If you put a cube on your screen in ZERO_ROTATION, therefore, you will always see its face #4.  From a scripting standpoint, the only thing that is different from working on rezzed objects is that you have only two dimensions: X (sideways) and Y (vertical).  It's all explained in http://wiki.secondlife.com/wiki/HUD .  And Sassy's suggestion of using a single mappable texture is described in the LSL wiki as llDetectedTouchST. There are other useful llDetectedTouch functions as well, but that's likely to be the one you'll need.

Link to comment
Share on other sites

Thank you! I believe I'm most of the way there, just need to get a script working. I'm doing some specific research on that and may have questions, but I think I get the jist - which was exactly what this thread was for. 

I do have one other general question. The object that I want to texture will be copyable. So someone could essentially put one out in every room of their house. I'm assuming the HUD will change every object in the vicinity to the selected texture - maybe I'm wrong here? Is there any way to specify which object to change, or is it generally accepted that this is how it works and buyers expect this functionality? Just imagining if users wanted to set up different colors in different rooms.

Thanks again!

Link to comment
Share on other sites

Your HUD can only do one of two things: (1) send a texture to another person or object, or (2) send a signal to another person or object.  Regardless of which one of those it does, the receiving object or person will not do anything at all with what it gets unless you have told it what to do.  That is, if you want to texture a wall by clicking on your HUD, the wall has to have a script in it that is capable of doing something with the message ot texture ir receives.  So, for example, your HUD has a touch_start event like this...

touch_start(integer num){    llRegionSay(gSpecial_channel, "343109bf-cb84-1b6c-fbb1-1bb0de84ba44~4");}

And your wall has a listen event that looks like this ...

listen(integer channel, string name, key id, string msg){    list temp = llParseString2List(msg,["~"],[]);    string Texture = llList2String(temp,0);    integer Face = (integer)llList2String(temp,1);    llSetTexture(Texture,Face);}

When you click the HUD, its message is broadcast throughout the region, but only the wall knows what to do with it, because only the wall is listening (assuming that you are using the same channel (gSpecial_channel) in each).  If you had the same receiving script in two or more walls, they would all hear and they would all change to the same texture.

Now, suppose you wanted to change the texture on only one wall but you have listening scripts in several walls?  You have loads of options.  For example .... You could make each wall's script ONLY turn on and listen when you touch it.  Or you could include the wall's name or some unique label as part of the HUD message and then tell each wall, "Do NOT texture anything unless you hear a message with your name in it."  Or you could use a different communication channel for each wall, so that it only hears messages on its own private channel.  Or you could take a completely different approach:  Put a suite of textures in each wall and then make your HUD send a message to ALL walls that says, "Put texture #1 from your suite onto face #2".  If the suites are all different, each wall will apply its own texture #1 and you will have retextured the whole house thematically with a single click on the HUD.  You can play these and other script design possibilities in many different ways, depending on what options you want for whoever is using the HUD.

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3080 days.

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
 Share

×
×
  • Create New...