Files

209 lines
4.4 KiB
Plaintext

//reads through a notecard with UUID then name line by line
//then it checks if they're online and shows it
// Generated by 'particles-lsl-generator.bashora.com', Zeja Pyle, 2008.
// DECLARATION ==============================
string Texture;
integer Interpolate_Scale;
vector Start_Scale;
vector End_Scale;
integer Interpolate_Colour;
vector Start_Colour;
vector End_Colour;
float Start_Alpha;
float End_Alpha;
integer Emissive;
float Age;
float Rate;
integer Count;
float Life;
integer Pattern;
float Radius;
float Begin_Angle;
float End_Angle;
vector Omega;
integer Follow_Source;
integer Follow_Velocity;
integer Wind;
integer Bounce;
float Minimum_Speed;
float Maximum_Speed;
vector Acceleration;
integer Target;
key Target_Key;
// BASIC FUNCTION ==============================
Particle_System()
{
list Parameters =
[
PSYS_PART_FLAGS,
(
(Emissive * PSYS_PART_EMISSIVE_MASK) |
(Bounce * PSYS_PART_BOUNCE_MASK) |
(Interpolate_Colour * PSYS_PART_INTERP_COLOR_MASK) |
(Interpolate_Scale * PSYS_PART_INTERP_SCALE_MASK) |
(Wind * PSYS_PART_WIND_MASK) |
(Follow_Source * PSYS_PART_FOLLOW_SRC_MASK) |
(Follow_Velocity * PSYS_PART_FOLLOW_VELOCITY_MASK) |
(Target * PSYS_PART_TARGET_POS_MASK)
),
PSYS_PART_START_COLOR, Start_Colour,
PSYS_PART_END_COLOR, End_Colour,
PSYS_PART_START_ALPHA, Start_Alpha,
PSYS_PART_END_ALPHA, End_Alpha,
PSYS_PART_START_SCALE, Start_Scale,
PSYS_PART_END_SCALE, End_Scale,
PSYS_SRC_PATTERN, Pattern,
PSYS_SRC_BURST_PART_COUNT, Count,
PSYS_SRC_BURST_RATE, Rate,
PSYS_PART_MAX_AGE, Age,
PSYS_SRC_ACCEL, Acceleration,
PSYS_SRC_BURST_RADIUS, Radius,
PSYS_SRC_BURST_SPEED_MIN, Minimum_Speed,
PSYS_SRC_BURST_SPEED_MAX, Maximum_Speed,
PSYS_SRC_TARGET_KEY, Target_Key,
PSYS_SRC_ANGLE_BEGIN, Begin_Angle,
PSYS_SRC_ANGLE_END, End_Angle,
PSYS_SRC_OMEGA, Omega,
PSYS_SRC_MAX_AGE, Life,
PSYS_SRC_TEXTURE, Texture
];
llParticleSystem (Parameters);
}
// YOUR PARTICLES FUNCTION ==============================
particles(){
Interpolate_Scale = FALSE;
Start_Scale = <0.04,0.04, 0>;
End_Scale = <0.04,0.04, 0>;
Interpolate_Colour = FALSE;
Start_Colour = color;
End_Colour = color;
Start_Alpha = 0.5;
End_Alpha =1;
Emissive = TRUE;
Age = theAge;
Rate = 0;
Count = 1;
Life = 0;
Pattern = PSYS_SRC_PATTERN_EXPLODE;
Radius = 0.1;
Begin_Angle = 0;
End_Angle = 3.14159;
Omega = < 0, 0, 0 >;
Follow_Source = TRUE;
Follow_Velocity = FALSE;
Wind = TRUE;
Bounce = FALSE;
Minimum_Speed = 0.1;
Maximum_Speed = 1;
Acceleration = < 0.1, 0.1, 0.1 >;
Target = TRUE;
Target_Key = llGetKey();
Particle_System();
}
update() {
color = llGetColor(ALL_SIDES);
vector size = llGetScale();
theAge = (size.x * 100) / 5;
particles();
}
vector color;
float theAge;
list keys;
list names;
list status;
integer name;
key oQ;
integer x;
key ncQ;
string ncN = "units";
integer ncL;
list ncC;
integer time;
start() {
llSetTimerEvent(1.0);
update();
keys = [];
names = [];
status = [];
name = FALSE;
ncC = [];
ncL = 0;
ncQ = llGetNotecardLine(ncN, ncL);
}
next() {
name = !name;
++ncL;
ncQ = llGetNotecardLine(ncN, ncL);
}
checkOnline() {
if (x > llGetListLength(keys)) { displayStatus(); }
else {
oQ = llRequestAgentData(llList2Key(keys,x),DATA_ONLINE);
}
}
displayStatus() {
string text = "Units Online\n----------\n";
integer n;
for (n = 0; n < llGetListLength(status)-1; n++) {
if (llList2Integer(status,n) == TRUE) {
text += llList2String(names,n) + "\n";
}
}
llSetText(text, <1,1,1>, 1.0);
}
default {
state_entry() {
start();
}
touch_end(integer n) {
start();
}
dataserver(key q, string d) {
if (q == ncQ) {
if (d == EOF) {
x = 0;
checkOnline();
}
else if (!name) { keys += (key)d; next(); }
else { names += d; next(); }
}
if (q == oQ) {
status = llListInsertList(status, [d], x);
++x;
checkOnline();
}
}
changed(integer c) {
if (c && CHANGED_SCALE) { update(); }
if (c && CHANGED_INVENTORY) { start(); }
}
timer() {
++time;
if (time%300 == 0) { start(); }
}
}