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
Prim Calculator Prim_Counter__Lag_display  

Prim_Counter__Lag_display

Prim_Counter__Lag_display

Category: Prim Calculator
By : Jamie Galliard
Created: 2011-12-10 Edited: 2011-12-10
Worlds: Second Life

the Zip file

Download all files for Prim_Counter__Lag_display
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Prim_Counter__Lag_display_1.lsl
1 // Author: Jamie Galliard
2
3 // This program is free software; you can redistribute it and/or modify it.
4 // License information must be included in any script you give out or use.
5 // by [[Jamie Galliard]], code released to the public domain under GNU GPL version 3.0 license.
6 // you are free to use, but not sell this script. If included in your product, the script
7 // must me full perm.
8
9 // Please leave any authors credits intact in any script you use or publish.
10 ////////////////////////////////////////////////////////////////////
11 //
12 // May not be sold with explicit permission from Jamie Galliard.
13 // script may not be modified without permission from Jamie Galliard
14 //
15 // Most of this comes from the Second Life LSL Portal [ http://wiki.secondlife.com/wiki/LSL_Portal ]
16
17 // And I am sure this could be all be optimized.
18
19 integer decimals_accuracy = 2;
20 integer prim_ammount;
21 float prim_used;
22 float prim_max;
23 integer switch;
24 list parcel;
25 string parcel_owner;
26
27 string Lag()
28 {
30 lag*=100;
31 string lagStr=(string)lag;
32 list cheat=llParseString2List(lagStr,["."],[]);
33 lagStr=llList2String(cheat,0);
34 string text = lagStr + "%";
35 return text;
36 }
37
38 string FPS()
39 {
41 string str=(string)fps;
42 list cheat=llParseString2List(str,["."],[]);
43 str=llList2String(cheat,0);
44 string decimals=llGetSubString(llList2String(cheat,1),0,1);
45 string text = str + "." + decimals;
46 return text;
47 }
48
49 string getFPS()
50 {
52 string str = (string)fps;
53 list cheat = llParseString2List(str, ["."], []);
54 str = llList2String(cheat, 0);
55 string decimals = llGetSubString(llList2String(cheat, 1), 0, 1);
56 string text = str + "." + decimals;
57 return text;
58 }
59
60 string percent(float in)
61 {
62 string str = (string)in;
63 list cheat = llParseString2List(str, ["."], []);
64 str = llList2String(cheat, 0);
65 return str;
66 }
67
68 light(integer on) // Set between Green and Black for On and Off.
69 {
70 if(on)
71 {
72 llSetLinkPrimitiveParamsFast(-2,[PRIM_POINT_LIGHT, TRUE, <0, 1, 0>, 1.0, 0.5, 0.75, PRIM_FULLBRIGHT, ALL_SIDES, TRUE, PRIM_COLOR, ALL_SIDES, <0,1,0>, 1]);
73 }
74 else
75 {
76 llSetLinkPrimitiveParamsFast(-2,[PRIM_POINT_LIGHT, FALSE, <1, 1, 1>, 1.0, 0.5, 0.75, PRIM_FULLBRIGHT, ALL_SIDES, FALSE, PRIM_COLOR, ALL_SIDES, <0,0,0>, 1]);
77 }
78 }
79
80 off()
81 {
82 llSetTimerEvent(0.0);
83 llSetText(" ",<0,0,0>,0.);
84 light(FALSE);
85 }
86
87 default
88 {
90 {
91 llSetTimerEvent(10.0);
92 light(FALSE);
93 llSetText("Initializing..",<1,1,1>,1);
94 }
95
96 touch_start(integer total_number)
97 {
98 //if(llDetectedKey(0)!=llGetOwner())return;//work only for owner
99 switch =! switch;
100 if(switch)
101 {
102 llSetTimerEvent(1.0);
103 }
104 else
105 {
106 off();
107 }
108 }
109
110 timer()
111 {
116 parcel_owner = llKey2Name(llList2Key(parcel,1));
117
118 float percent_used = (prim_used / prim_max) * 100;
119
120 if(percent_used > 90.0) // Set to max percent used before changing color.
121 {
122 llSetLinkPrimitiveParamsFast(-2,[PRIM_POINT_LIGHT, TRUE, <0, 1, 0>, 1.0, 0.5, 0.75, PRIM_FULLBRIGHT, ALL_SIDES, TRUE, PRIM_COLOR, ALL_SIDES, <1,0,0>, 1]); // RED
123 }
124 else
125 {
126 light(TRUE);
127 }
128
129 if(parcel_owner == "")
130 {
131 parcel_owner = "(Group Owned)";
132 }
133 "\nParcel Owner: " + parcel_owner + " \n" +
134 "Lag: " + Lag() +
135 "\nFPS: " + FPS() + "\n" +
136 "Time Dilation: " + getFPS() + "\n" +
137 "Max Prims Allowed: " + percent(prim_max) + "\n" +
138 "Prims Used: " + percent(prim_used) + "\n" +
139 "Prims Un-used: " + (string)prim_ammount + "\n" +
140 "Percent Used: " + percent(percent_used) + "%",<1.0,1.0,1.0>,1);
141 }
142 }

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