| Script Library Post useful scripts here. |
| |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 (permalink) |
| stored in the cloud ![]() ![]() ![]() ![]() ![]() ![]() SLU Supporter ![]() ![]() ![]() ![]()
PHIL LINDEN SKULLF*CKED ME
RIGHT HERE
| Simple 3-Button HUD Example First, you'll need a prim. I recommend the following dimensions: Size X: 0.15 Y: 0.05 Z: 0.01 Rotation X: 0.00 Y: 270.00 Z: 270.00 Taper: X: 0.66 Y: 0.00 The prim is, quite tiny, HUDs tend to be. Now, attach it. I recommend 'Center' as it's nice and easy to see, but put it where you're comfortable. Bottom and Top can be hard to see when you attach.Edit the prim, choose 'New Script' from the Content tab and put this in there: Code: // 3-Button HUD Shell
// by Kristian Ming 2009-10-22
// License: Public Domain (but a credit in your product documentation would be nice)
// We need to remap the faces to a more logical order...
integer return_button(integer f)
{
if (f == 4) return 1;
if (f == 0) return 2;
if (f == 2) return 3;
else return 0;
}
default
{
touch_end(integer num_detected)
// Not the most robust way of handling the touch event.
// If this object was rezzed in world, it would be a problem
// but HUDs can only be touched by the wearer
{
integer touchedFace = llDetectedTouchFace(num_detected);
llOwnerSay((string)return_button(touchedFace));
// or you could assign it to a variable...
}
}
Not the most exciting HUD ever, but with a little work and research on <a href="http://wiki.secondlife.com/LSL_Portal">the LSL Portal</a> you'll be able to build more complex HUDs in no time. Also, I'm making this and my other examples available in-world, time permitting. You can now visit 'Ming's Things' at http://slurl.com/secondlife/Stargazer/232/232/1501. I also have a blog. |
| | |
| 1 User Said Yay!: |
| 1 User Said Thanks: |
![]() |
| Thread Tools | |
| Display Modes | |
| |