RSS SL
Second Life Community - All Activity
-
script help
hi im trying to create a sim radar script with advance features but it keeps giving me a syntax error. please help // ================= CONFIG ================= list lastMoveTime; list lastPos; list knownAvatars; list previousAgents; integer radarOn = TRUE; integer menuChannel; integer listenHandle; // ================= MENU ================= showMenu() { list buttons = [ "Radar ON/OFF", "Avatar Report", "Ground TP", "Close" ]; llDialog(llGetOwner(), "Crystal HUD Menu", buttons, menuChannel); } // ================= REGION STATS ================= string getRegionStats() { integer fps = (integer)llGetRegionFPS(); float td = llGetRegionTimeDilation(); return "FPS: " + (string)fps + " | TD: " + (string)td; } // ================= ENTER & LEAVE CHECK ================= // ================= ENTER & LEAVE ALERTS (ALWAYS ON) ================= updateRegionAlerts() { list agents = llGetAgentList(AGENT_LIST_REGION, []); integer i; // ================= ENTER ================= for (i = 0; i < llGetListLength(agents); i++) { key id = llList2Key(agents, i); if (llListFindList(previousAgents, [id]) == -1) { string name = llGetDisplayName(id); if (name == "") name = llKey2Name(id); llOwnerSay( "➡️ " + name + " entered region\n" + "secondlife:///app/agent/" + (string)id + "/about" ); } } // ================= LEAVE ================= for (i = 0; i < llGetListLength(previousAgents); i++) { key id = llList2Key(previousAgents, i); if (llListFindList(agents, [id]) == -1) { string name = llKey2Name(id); if (name == "") name = "unknown"; llOwnerSay( "⬅️ " + name + " left region\n" + "secondlife:///app/agent/" + (string)id + "/about" ); } } previousAgents = agents; } // ================= WEARER REPORT ONLY ================= showWearerReport() { key me = llGetOwner(); string name = llGetDisplayName(me); if (name == "") name = llKey2Name(me); string username = llGetUsername(me); if (username == "") username = "unknown"; string uuid = (string)me; // SL clickable profile link string profileLink = "secondlife:///app/agent/" + uuid + "/about"; // Dashboard link string dashboard = "https://www.my.secondlife.com/" + username; // Estimated height (avatar bounding box approximation) vector size = llGetAgentSize(me); float height = size.z; // "Avatar weight" (heuristic only — not real SL stat) float weight = (size.x + size.y + size.z) * 25.0; string report = "════ AVATAR INTELLIGENCE REPORT ════\n\n" + "Name: " + name + "\n" + "Username: " + username + "\n" + "UUID: " + profileLink + "\n\n" + "Distance: 0m (SELF)\n" + "Dashboard: " + dashboard + "\n\n" + "Estimated Height: " + (string)height + "m\n" + "Avatar Weight: " + (string)weight + "\n"; llOwnerSay(report); } // ================= GROUND TP ================= groundTP() { vector pos = llGetPos(); float groundZ = llGround(ZERO_VECTOR); vector target = <pos.x, pos.y, groundZ + 1.0>; llSetRegionPos(target); llOwnerSay("Ground TP executed."); } // ================= HOVERTEXT ================= updateHovertext() { list data; // must exist here or globally integer a; integer b; for (a = 0; a < llGetListLength(data); a += 4) { for (b = a + 4; b < llGetListLength(data); b += 4) { float distA = llList2Float(data, a); float distB = llList2Float(data, b); if (distB < distA) { list temp = llList2List(data, a, a + 3); data = llListReplaceList( data, llList2List(data, b, b + 3), a, a + 3 ); data = llListReplaceList( data, temp, b, b + 3 ); } // ================= COLLECT DATA ================= list agents = llGetAgentList(AGENT_LIST_REGION, []); vector myPos = llGetPos(); list data = []; integer i; for (i = 0; i < llGetListLength(agents); i++) { key id = llList2Key(agents, i); if (id == llGetOwner()) jump skip; list posData = llGetObjectDetails(id, [OBJECT_POS]); if (llGetListLength(posData)) { vector pos = llList2Vector(posData, 0); float dist = llVecDist(myPos, pos); string name = llGetDisplayName(id); if (name == "") name = llKey2Name(id); string lang = llGetAgentLanguage(id); if (lang == "") lang = "xx"; // ================= AFK (SAFE VERSION) ================= integer afk = FALSE; integer idx = llListFindList(lastPos, [id]); integer now = llGetUnixTime(); if (idx != -1) { vector oldPos = llList2Vector(lastPos, idx + 1); if (llVecDist(oldPos, pos) < 0.5) { integer timeIdx = llListFindList(lastMoveTime, [id]); if (timeIdx != -1) { integer last = llList2Integer(lastMoveTime, timeIdx + 1); if ((now - last) >= 300) // 5 min afk = TRUE; } } else { integer tIdx = llListFindList(lastMoveTime, [id]); if (tIdx != -1) lastMoveTime = llListReplaceList(lastMoveTime, [id, now], tIdx, tIdx + 1); else lastMoveTime += [id, now]; } lastPos = llListReplaceList(lastPos, [id, pos], idx, idx + 1); } else { lastPos += [id, pos]; lastMoveTime += [id, now]; } data += [dist, name, lang, afk]; } @skip; } // ================= SORT BY DISTANCE ================= data = llListSort(data, 4, TRUE); // TRUE = ascending (closest first) string text = ""; integer shown = 0; // ================= BUILD OUTPUT ================= for (i = 0; i < llGetListLength(data) && shown < 10; i += 4) { float dist = llList2Float(data, i); string name = llList2String(data, i + 1); string lang = llList2String(data, i + 2); integer afk = llList2Integer(data, i + 3); // ================= COLOR ================= string colorTag; if (dist <= 20.0) colorTag = "🟢"; else if (dist <= 60.0) colorTag = "🟡"; else colorTag = "🔴"; string afkTag = ""; if (afk) afkTag = " (AFK)"; text += colorTag + " " + name + afkTag + " " + (string)((integer)dist) + "m " + lang + "\n"; shown++; } // ================= REGION STATS ================= updateHovertext() { // REGION STATS integer fps = (integer)llGetRegionFPS(); float td = llGetRegionTimeDilation(); text += "~~~\n"; text += "FPS: " + (string)fps + " | TD: " + (string)td; llSetText(text, <0.2, 1.0, 0.2>, 1.0); } // ================= MAIN ================= default { state_entry() { menuChannel = -1 - (integer)llFrand(1000000); listenHandle = llListen(menuChannel, "", llGetOwner(), ""); llSetTimerEvent(5.0); } touch_start(integer n) { showMenu(); } listen(integer channel, string name, key id, string msg) { if (msg == "Radar ON/OFF") { radarOn = !radarOn; radarMessage(); } else if (msg == "Avatar Report") { showWearerReport(); } else if (msg == "Ground TP") { groundTP(); } else if (msg == "Close") { return; } } timer() { updateHovertext(); } changed(integer c) { if (c & CHANGED_REGION_START) { llOwnerSay("HUD reset on region change."); } } } -
Commercial Bellisseria
@Fay Moonchild I greatly admire your patience... Sending some moral support your way, in case you could do with some. -
Commercial Bellisseria
Don't worry too much she is just a little bit erratic. -
What is peeving you now, while logged into Second Life
Grumpy old know it alls are peeving me, while im logged into sl. -
What is peeving you now, while logged into Second Life
How about i just do what I want.
