Difference between revisions of "Avatar Radar (NewAge)"
Line 5: | Line 5: | ||
// New Age Radar Script | // New Age Radar Script | ||
// By Asia Snowfall | // By Asia Snowfall | ||
// Version 1.0 | // Version 1.1 | ||
///////////////////////////////// | |||
// v1.1; | |||
// ------ | |||
// (Added) - Agent Count in Region when no agents in sensor range | |||
// (Added) - Lag Status when no agents in sensor range | |||
///////////////////////////////// | |||
// v1.0 | |||
// ------ | |||
// (Initial Release) | |||
///////////////////////////////// | ///////////////////////////////// | ||
Line 14: | Line 23: | ||
integer show_total_agents_in_region = TRUE; | integer show_total_agents_in_region = TRUE; | ||
integer show_lag_status = TRUE; | integer show_lag_status = TRUE; | ||
integer handler; | integer handler; | ||
string people; | string people; | ||
list people_in_sensor_range; | list people_in_sensor_range; | ||
list people_in_sensor_vectors; | list people_in_sensor_vectors; | ||
list chat_range; | list chat_range; | ||
integer max_people = 7; | integer max_people = 7; | ||
string lag_status; | string lag_status; | ||
vector text_color; | vector text_color; | ||
llLagStatus() | llLagStatus() | ||
Line 50: | Line 60: | ||
lag_status = "Excellent"; | lag_status = "Excellent"; | ||
text_color = <0.0,1.0,1.0>; | text_color = <0.0,1.0,1.0>; | ||
} | |||
} | |||
all_status() | |||
{ | |||
if(show_total_agents_in_region == TRUE) | |||
{ | |||
people += "Region Agent Count = "+(string)llGetRegionAgentCount()+"\n"; | |||
} | |||
if(show_total_agents_in_chat_range == TRUE) | |||
{ | |||
people += "Agents in Range = "+(string)llGetListLength(chat_range)+"\n"; | |||
} | |||
if(show_lag_status == TRUE) | |||
{ | |||
people += "Lag Status = "+lag_status; | |||
} | } | ||
} | } | ||
Line 148: | Line 174: | ||
}while(i++<x); | }while(i++<x); | ||
llLagStatus(); | llLagStatus(); | ||
all_status(); | |||
llSetText(people, text_color, 1.0); | llSetText(people, text_color, 1.0); | ||
people = ""; | people = ""; | ||
Line 172: | Line 187: | ||
people = "No People In Range"; | people = "No People In Range"; | ||
llLagStatus(); | llLagStatus(); | ||
all_status(); | |||
llSetText(people, text_color, 1.0); | llSetText(people, text_color, 1.0); | ||
people = ""; | people = ""; | ||
Line 179: | Line 195: | ||
llSensor("", "", AGENT, scan_range, PI); | llSensor("", "", AGENT, scan_range, PI); | ||
} | } | ||
}</lsl> | } | ||
</lsl> |
Revision as of 02:53, 21 July 2010
Just copy and paste this script into an object that will be your hud!
<lsl> ///////////////////////////////// // New Age Radar Script // By Asia Snowfall // Version 1.1 ///////////////////////////////// // v1.1; // ------ // (Added) - Agent Count in Region when no agents in sensor range // (Added) - Lag Status when no agents in sensor range ///////////////////////////////// // v1.0 // ------ // (Initial Release) /////////////////////////////////
float scan_range = 100; float speed = 2; integer channel = 1; integer show_total_agents_in_chat_range = TRUE; integer show_total_agents_in_region = TRUE; integer show_lag_status = TRUE;
integer handler;
string people; list people_in_sensor_range; list people_in_sensor_vectors; list chat_range;
integer max_people = 7;
string lag_status; vector text_color;
llLagStatus()
{
float time_dilation = llGetRegionTimeDilation(); if(time_dilation <= 0.3) { lag_status = "Laggy"; text_color = <1.0,0.0,0.0>; } else if(time_dilation > 0.3 && time_dilation <= 0.5) { lag_status = "Not Bad"; text_color = <1.0,1.0,0.0>; } else if(time_dilation > 0.5 && time_dilation <= 0.8) { lag_status = "Good"; text_color = <0.0,1.0,0.0>; } else if(time_dilation > 0.8 && time_dilation <= 1.0) { lag_status = "Excellent"; text_color = <0.0,1.0,1.0>; }
}
all_status() {
if(show_total_agents_in_region == TRUE) { people += "Region Agent Count = "+(string)llGetRegionAgentCount()+"\n"; } if(show_total_agents_in_chat_range == TRUE) { people += "Agents in Range = "+(string)llGetListLength(chat_range)+"\n"; } if(show_lag_status == TRUE) { people += "Lag Status = "+lag_status; }
}
default {
state_entry() { llSensor("", "", AGENT, scan_range, PI); llSetTimerEvent(speed); } attach(key id) { if(id == llGetOwner()) { handler = llListen(channel, "", "", ""); llOwnerSay("Find location of avatar within sensor range by typing either their full or partial name on channel "+(string)channel + ", example; /"+(string)channel+" Mark"); } else if(id == NULL_KEY) { llListenRemove(handler); } } listen(integer channel, string name, key id, string str) { if(id == llGetOwner()) { str = llToLower(str); integer index = llListFindList(people_in_sensor_range, [str]); if(index != -1) { llOwnerSay(llList2String(people_in_sensor_range, index)+" is located at "+llList2String(people_in_sensor_vectors, index)); } else if(index == -1) { integer i = 0; integer length = llGetListLength(people_in_sensor_range); integer ind; do { if(llStringLength(llList2String(people_in_sensor_range, i)) > 0) { ind = llSubStringIndex(llList2String(people_in_sensor_range, i), str); if(ind != -1) { llOwnerSay(llList2String(people_in_sensor_range, i) + " is located at "+llList2String(people_in_sensor_vectors, i)); return; } } }while(i++<length); llOwnerSay("No Avatars Found by the name or partial name of "+str); } } } changed(integer h) { if(h & CHANGED_OWNER) { llResetScript(); } } sensor(integer x) { people_in_sensor_range = []; people_in_sensor_vectors = []; integer i = 0; integer index; --x; if(x > max_people) { x = max_people-1; } do { index = llListFindList(chat_range, [llDetectedName(i)]); if(llStringLength(llDetectedName(i)) >! 0) { if(llVecDist(llDetectedPos(i), llGetPos()) <= 20) { if(index == -1) { chat_range += llDetectedName(i); llOwnerSay(llDetectedName(i) + " has entered chat range"); } } else { if(index != -1) { llOwnerSay(llDetectedName(i) + " has left chat range"); chat_range = llDeleteSubList(chat_range, index, index); } } people_in_sensor_range += llToLower(llDetectedName(i)); people_in_sensor_vectors += llDetectedPos(i); people += llDetectedName(i) + " - " + llGetSubString((string)llVecDist(llDetectedPos(i), llGetPos()), 0, 4)+"m\n"; } }while(i++<x); llLagStatus(); all_status(); llSetText(people, text_color, 1.0); people = ""; } no_sensor() { if(llGetListLength(chat_range) > 0) { chat_range = []; } people += "Region Agent Count = "+(string)llGetRegionAgentCount()+"\nAgents in Range = "+(string)llGetListLength(chat_range)+"\n"; people = "No People In Range"; llLagStatus(); all_status(); llSetText(people, text_color, 1.0); people = ""; } timer() { llSensor("", "", AGENT, scan_range, PI); }
} </lsl>