Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
HUD Nonrotating_HUD_positioner  

Nonrotating_HUD_positioner

Nonrotating_HUD_positioner

Category: HUD
By : Ferd Frederix
Created: 2012-07-08 Edited: 2012-07-08
Worlds: Second Life

the Zip file

Download all files for Nonrotating_HUD_positioner
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Nonrotating_HUD_positioner_1.lsl

This script by Ferd Frederix may be used in any manner, modified, and republished.  Unless specified otherwise, my scripts are always free and open source.  Objects made with these scripts may be sold with no restrictions.  All I ask is that you point others to this location should they ask you about it and to not sell this script, unless it is for $0 L. Please help improve my work by reporting bugs and improvements.

1
2 integer lasttarget;
3
4 default
5 {
6
7 attach( key id)
8 {
9
10 if(id)
11 {
12 integer target = llGetAttached();
13
14 vector position = llGetLocalPos();
15
16 if(target == lasttarget )
17 return;
18
19 lasttarget = target; // save the position we just set
20
21 float Y = 0.0;
22 float Z = 0.0;
23 float trYoffset = 0.185; // right edge
24 float brYoffset = 0.125; // right edge
25 float otherYoffset = 0.080; // move right from left edge
26 float VerticalOffset = 0.2; // move down for room for hover text
27 float CenterOffset = 0.7; // left and right center offset to left and right edge
28 float BVerticalOffset = 0.080; // Bottom Z.
29
30
31 if(target == ATTACH_HUD_CENTER_2)
32 {
33 Y = CenterOffset; Z = 0.0; // move to left edge
34 }
36 {
37 Y = trYoffset; Z = -VerticalOffset; // down for room for hovertext
38 }
40 {
41 Y = 0; Z = -VerticalOffset;
42 }
43 else if(target == ATTACH_HUD_TOP_LEFT)
44 {
45 Y = -otherYoffset; Z = -VerticalOffset;
46 }
47 else if(target == ATTACH_HUD_CENTER_1)
48 {
49 Y = -CenterOffset; Z = 0.0; // move to right edge
50 }
51 else if(target == ATTACH_HUD_BOTTOM_LEFT)
52 {
53 Y = -otherYoffset; Z = BVerticalOffset;
54 }
55 else if(target == ATTACH_HUD_BOTTOM)
56 {
57 Y = 0.0; Z = BVerticalOffset;
58 }
59 else if(target == ATTACH_HUD_BOTTOM_RIGHT)
60 {
61 Y = brYoffset; Z = BVerticalOffset ; // 2 x to miss buttons
62 }
63 else
64 {
65 llOwnerSay("You must attach this as a HUD");
66 return;
67
68 }
69
70 vector newtarget = <0.0,Y,Z>;
71 llSetPos(newtarget);
72
73 }
74 }
75
76
77 }

Back to the Best Free Tools in Second Life and OpenSim.