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 Scrollable_ImageHUD  

Scrollable_ImageHUD

The script goes in the "back" control object

Category: HUD
By : Valect
Created: 2012-07-22 Edited: 2012-07-22
Worlds: Second Life

the Zip file

Download all files for Scrollable_ImageHUD
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Scrollable_ImageHUD_1.lsl
Get file # 2. Scrollable_ImageHUD_2.lsl
Get file # 3. Scrollable_ImageHUD_3.lsl
Get file # 4. Scrollable_ImageHUD_4.lsl
1
2 // rescales the linked set by the specified factor. factor > 1 makes it larger, < 1 smaller
3 // example: "/9 2.5"
4 vector start_size = <0.2,0.2,0.2>;
5
6 // getting too large will really mess shit up
7 vector max_size = <2.0,2.0,2.0>;
8
9 // so will getting to small
10 vector min_size = <0.2,0.2,0.2>;
11 float pan_dist = 0.3;
12
13 // control link numbers
14 // these will need to be changed based on your object
15 integer left = 48;
16 integer right = 49;
17 integer down = 2;
18 integer up = 45;
19 integer plus = 47;
20 integer minus = 46;
21 integer reset = 44;
22
23 vector current_scale = start_size;
24 key owner = NULL_KEY;
25 // this function is so we don't get an odd delay. hopefully will cause this
26 // to resize first and avoid a lag issue
27 // ** i think the lag issue was due to calling llsetprimitiveparams on EVERY link message, however i like this new solution better
28 scale_self(float scale) {
29 list primparams = [];
30 vector new_scale = llGetScale();
31 new_scale.y = new_scale.y * scale;
32 new_scale.z = new_scale.z * scale;
33 new_scale.x = 0.2;
34 vector new_pos = llGetLocalPos();
35 new_pos.y = new_pos.y * scale;
36 new_pos.z = new_pos.z * scale;
37 primparams = [];
38 primparams += [PRIM_SIZE, new_scale]; // resize
39 llSetPrimitiveParams(primparams);
40 }
41 Resize(float scale, integer resize) {
42 scale_self(scale);
43 llMessageLinked(LINK_SET, resize, (string)scale, NULL_KEY);
44 }
45 calc_zoom(vector current_scale, float scale) {
46 // if our current size is greater than 2, and user wants to increase more, don't
47 if((current_scale.z >= max_size.z) && (scale > 1.0)) {
48 llOwnerSay("Sorry, we can't zoom in any further");
49 return;
50 // if our current size is less than 0.5 and the user wants to decrease, don't
51 } else if((scale < 1.0) && (current_scale.z <= min_size.z)) {
52 llOwnerSay("Sorry, we can't zoom out any further");
53 return;
54 } else {
55 // if the user wants to increase, set current scale
56 if(scale > 1.0) {
57 current_scale = (current_scale * scale);
58 //llOwnerSay("Zooming in "+(string)scale+" units.");
59 // if the user wants to decrease, set current scale
60 } else if(scale < 1.0) {
61 //llOwnerSay("Zooming out "+(string)scale+" units.");
62 current_scale = (current_scale * scale);
63 }
64 }
65 if( scale == 0.0 ) return; // we don't resize by factor 0.0
66 // if we are within our limits...
67 if(((current_scale.z * scale) >= min_size.z) || ((current_scale.z * scale) <= max_size.z)) {
68 // resize everything
69 Resize(scale,0);
70 }
71 }
72 pan(integer direction,string dist) {
73 llMessageLinked(LINK_SET, direction, dist, NULL_KEY);
74 }
75 default {
76 attach(key id) {
77 if(llGetAttached() == 35) {
78 Resize(0.0,1);
79 owner = llGetOwner();
81 } else if(llGetAttached() != 0) {
82 llOwnerSay("Attached to wrong spot.");
83 }
84 }
85 state_entry() {
86 if(owner == NULL_KEY) {
87 llListen(9, "", llGetOwner(), "");
88 } else {
89 llListen(9, "", owner, "");
90 }
91 }
92 // don't listen for commands from av, listen for commands from the buttons
93 // listen(integer channel, string name, key id, string message) {
94 link_message(integer sender_num, integer num, string str, key id) {
95 float scale = 0;
96 vector current_scale = llGetScale();
97 // if reset..
98 if(sender_num == reset) {
99 // send reset
100 Resize(0.0,1);
101 } else {
102 // if zoom in..
103 if(sender_num == plus) {
104 // set scale to 1.2
105 scale = 1.2;
106 // do calculations..
107 calc_zoom(current_scale,scale);
108 // if zoom out..
109 } else if(sender_num == minus) {
110 // set scale to 0.8
111 scale = 0.8;
112 // do calculations
113 calc_zoom(current_scale,scale);
114 } else if(sender_num == left ) {
115 pan(10,(string)pan_dist);
116 } else if(sender_num == right ) {
117 pan(11,(string)pan_dist);
118 } else if(sender_num == down ) {
119 pan(12,(string)pan_dist);
120 } else if(sender_num == up ) {
121 pan(13,(string)pan_dist);
122 }
123
124 }
125 }
126 }

Scrollable_ImageHUD

The script goes in the "back" control object

Category: HUD
By : Valect
Created: 2012-07-22 Edited: 2012-07-22
Worlds: Second Life

1 vector local_pos;
2 default {
3 state_entry() {
4 local_pos = <0.0,0.0,0.0>; //llGetLocalPos();
5 }
6 link_message(integer sender_num, integer num, string str, key id) {
7 list primparams = [];
8 // 1 means reset
9 if(num == 1) {
10 primparams += [PRIM_SIZE, <0.2,0.2,0.2>, PRIM_POSITION, local_pos];
11 llSetPrimitiveParams(primparams);
12 }
13 }
14 }

Scrollable_ImageHUD

This script goes in all the segments of the image

Category: HUD
By : Valect
Created: 2012-07-22 Edited: 2012-07-22
Worlds: Second Life

1
2 // something to keep in mind: depending on how the object is built, the axes may change on you. just use x or y or z instead on the required direction
3 // increase x and z for the map blocks
4 vector local_pos;
5
6 default {
7 state_entry() {
8 local_pos = llGetLocalPos();
9 }
10 link_message(integer sender_num, integer num, string str, key id) {
11 list primparams = [];
12 // 1 means reset
13 if(num == 1) {
14 primparams += [PRIM_SIZE, <0.2,0.2,0.2>, PRIM_POSITION, local_pos];
15 // 10 means left
16 } else if(num == 10) {
17 vector pan = llGetLocalPos();
18 pan.y = pan.y - (float)str;
19 primparams += [PRIM_POSITION, pan];
20 // 11 means right
21 } else if(num == 11) {
22 vector pan = llGetLocalPos();
23 pan.y = pan.y + (float)str;
24 primparams += [PRIM_POSITION, pan];
25 // 12 means down
26 } else if(num == 12) {
27 vector pan = llGetLocalPos();
28 pan.z = pan.z - (float)str;
29 primparams += [PRIM_POSITION, pan];
30 // 13 means up
31 } else if(num == 13) {
32 vector pan = llGetLocalPos();
33 pan.z = pan.z + (float)str;
34 primparams += [PRIM_POSITION, pan];
35 } else if(num == 0) {
36 float scale; // size factor
37 scale = (float)str;
38 vector new_scale = llGetScale();
39 new_scale.x = new_scale.x * scale;
40 new_scale.z = new_scale.z * scale;
41 new_scale.y = 0.2;
42 vector new_pos = llGetLocalPos();
43 new_pos.z = new_pos.z * scale;
44 new_pos.y = new_pos.y * scale;
45 primparams = [];
46 primparams += [PRIM_SIZE, new_scale]; // resize
47 if(llGetLinkNumber() > 1) { // only move if we're not the root object
48 primparams += [PRIM_POSITION, new_pos]; // reposition
49 }
50 }
51 llSetPrimitiveParams(primparams);
52 }
53 }

Scrollable_ImageHUD

This script goes in each direction control prim

Category: HUD
By : Valect
Created: 2012-07-22 Edited: 2012-07-22
Worlds: Second Life

1
2 default
3 {
4 touch_start(integer total_number)
5 {
7 llMessageLinked(1, 0, "blank", NULL_KEY);
8 }
9 }

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