Jump to content

Emilee Edenflower

Resident
  • Posts

    38
  • Joined

  • Last visited

Everything posted by Emilee Edenflower

  1. OK so after putting the camera script here into my own script, then it goes weird, so it's possibly something I'm doing interfering. This is what I've been trying to give some proper context -- you type an avi username on the listening channel to look them up in the region, then have the camera move to see them (once working, I'd make that an option via a dialog button): integer listenHandle; key name_key_query; string region; key detectedKey; vector agent; vector targetPos; vector targetRot; integer uniqChannel; touch_start(integer num_detected) { detectedKey = llDetectedKey(0); string name = llGetDisplayName(detectedKey); //Create unique channel for avi //uniqChannel = (integer)("0xF" + llGetSubString(llGetOwner(),0,4)); uniqChannel = (integer)(llFrand (99.0) + 1.0); listenHandle = llListen(uniqChannel, "", detectedKey, ""); llOwnerSay("Type the USERNAME (not display name) of the person you want to track down."); llOwnerSay("Listening now to '" + name + "' on channel " + (string)uniqChannel); // llOwnerSay((string)owner); } listen(integer channel, string name, key id, string message) { if (channel == uniqChannel){ llOwnerSay("Searching for target..."); llOwnerSay("Searching for... " + message); name_key_query = llRequestUserKey(message); } remove_listen_handles(); } dataserver(key queryid, string data) { if ( name_key_query == queryid ) { //llSay(0, "The key for this user is : " + data); region = llGetRegionName(); string username = llGetDisplayName(data); agent = llGetAgentSize(data); //list detPos = llGetObjectDetails(data, ([OBJECT_NAME, OBJECT_DESC, OBJECT_POS, OBJECT_ROT, OBJECT_VELOCITY, OBJECT_OWNER, OBJECT_GROUP, OBJECT_CREATOR])); list detPos = llGetObjectDetails(data, [OBJECT_POS, OBJECT_NAME]); vector currentPos = llGetPos(); vector lookAt = ZERO_VECTOR; list getDistance = [llRound(llVecDist(currentPos, llList2Vector(llGetObjectDetails(data, [OBJECT_POS]), 0))),data]; //targetPos = llList2Vector(detPos, 2); //targetRot = llList2Vector(detPos, 3); targetPos = llList2Vector(detPos, 0) + <0.0, 0.0, agent.z*0.4>; if(agent) { //uuid is an avatar in the region llOwnerSay("Target found!"); llOwnerSay(username + " is in the region: " + region + " and is " + (string) llList2Integer(getDistance, 0) + "m away from you."); //Open map to add pointer to the target llMapDestination(region, targetPos, lookAt); //llOwnerSay("Do you want to see your target?"); //llRequestPermissions(detectedKey, PERMISSION_CONTROL_CAMERA); } else { llOwnerSay("Target is not within " + region); //uuid is not an avatar in the region } if (llGetAgentSize (data) == ZERO_VECTOR) { // person_of_interest is no longer in the region, so kill the script or whatever } } } run_time_permissions(integer perm) { if ( perm & PERMISSION_CONTROL_CAMERA ) { llOwnerSay("tracking "+llList2String(detPos, 1)+" at position "+(string)targetPos); llSetCameraParams([ CAMERA_ACTIVE, TRUE, CAMERA_FOCUS, targetPos, CAMERA_FOCUS_LOCKED, FALSE, CAMERA_POSITION, targetPos + llVecNorm(llGetPos()-targetPos), CAMERA_POSITION_LOCKED, FALSE ]); } else { llClearCameraParams(); } }
  2. So far this script has been the one that has worked (mostly). It seems to freak out if the target is quite far away -- are there distance limits to the camera being moved by a script?
  3. I retested this on other sims completely naked to make sure I had no attachments etc interfering, but I still have the same weird issue with the camera. So I'm not really sure what to do now.
  4. I'm wearing the item so the permissions should be fine. Though I only got the permission prompt dialog once and never again, despite detaching the item and updating the script. Is that normal?
  5. I've had the script llSay the coordinates at various points to make sure it's always the same, which it is. Although one may round up the decimal places but that shouldn't interfere much at all. Before this part of the script in just looking up an avatar UUID by username and passing that to the part quoted in the OP. So it all appears to be consistent
  6. ok spoke too soon.. it worked once, and now it just points the camera in the right direction but stays on myself
  7. Just had a breakthrough When adding in the other camera parameters I found elsewhere, it works! The only small issue now is that it focuses on the persons hips, rather than higher up, but it's a start! Maybe something to do with the offset? or the Z positioning of the targetPos vector? llSetCameraParams([ CAMERA_ACTIVE, 1 //1 is active, 0 is inactive ,CAMERA_BEHINDNESS_ANGLE, 0.0 //(0 to 180) degrees //,CAMERA_BEHINDNESS_LAG, 0.05 //(0 to 3) seconds ,CAMERA_DISTANCE, 0.0 //(0.5 to 10) meters ,CAMERA_FOCUS, targetPos //Region-relative ,CAMERA_FOCUS_LAG, 0.05 //(0 to 3) seconds ,CAMERA_FOCUS_LOCKED, TRUE //(TRUE or FALSE) ,CAMERA_FOCUS_THRESHOLD, 0.0 //(0 to 4) meters ,CAMERA_POSITION, targetPos + llVecNorm(llGetPos()-targetPos) //Region-relative position ,CAMERA_POSITION_LAG, 0.05 //(0 to 3) seconds ,CAMERA_POSITION_LOCKED, TRUE //(TRUE or FALSE) ,CAMERA_POSITION_THRESHOLD, 0.0 //(0 to 4) meters ,CAMERA_FOCUS_OFFSET, ZERO_VECTOR //<-10,-10,-10> to <10,10,10> meters ]);
  8. Qie -- I tried that but didn't seem to do much different, and sometimes nothing at all
  9. Hi all! Ok so I'm trying to figure this out and have been going in circles for ages now, searching all of the forums and the interwebs to no avail. Basic outline of my script: I scan a region, detect an avatar, grab their UUID and use that to get their details and location. Then I want to use that info to move MY camera to the detected avi so I can see where they are (possibly even track them if they move would be the better outcome of this). But this script I've made so far does all of that, gets the correct vector location (I also use llMapDestination to open the map to show me the detected avi, and the coordinates are right), but when the camera tries to find them, it just moves backwards from my av and then kinda springs back and gets stuck in a weird position and I can't reset it to default without removing the item from with the the script in it. Camera scripting is new to me so I'm not too sure what is going wrong. Any help would be grand! PS, I know the list building a vector thing looks weird (and maybe pointless) considering i get the same result from targetPos variable. I just did that to make sure it was all returning the same thing. //data = an avatars UUID within the same region as myself //detectedKey = owners UUID /* --- SNIP [other code here etc] --- */ list detPos = llGetObjectDetails(data, ([OBJECT_NAME, OBJECT_DESC, OBJECT_POS, OBJECT_ROT, OBJECT_VELOCITY, OBJECT_OWNER, OBJECT_GROUP, OBJECT_CREATOR])); vector currentPos = llGetPos(); vector lookAt = ZERO_VECTOR; list getDistance = [llRound(llVecDist(currentPos, llList2Vector(llGetObjectDetails(data, [OBJECT_POS]), 0))),data]; targetPos = llList2Vector(detPos, 2); targetRot = llList2Vector(detPos, 3); llRequestPermissions(detectedKey, PERMISSION_CONTROL_CAMERA); run_time_permissions(integer perm) { if ( perm & PERMISSION_CONTROL_CAMERA ) { vector lookAtPos = llGetPos() + (targetPos * llGetRot()); string x; string y; string z; list xyz = llCSV2List((string)targetPos); string xvector = llList2String(xyz,0); x = llGetSubString(xvector,1,3); y = llGetSubString(xvector,12,14); z = llGetSubString(xvector,22,24); integer x_fin = llFloor((integer)x); integer y_fin = llFloor((integer)y); integer z_fin = llFloor((integer)z); vector newVec = <x_fin,y_fin,z_fin>; llClearCameraParams(); // reset camera to default llSetCameraParams([ CAMERA_ACTIVE, TRUE, // (TRUE or FALSE) CAMERA_FOCUS, newVec, // region relative position CAMERA_FOCUS_LOCKED, FALSE, // (TRUE or FALSE) CAMERA_POSITION, lookAtPos, // region relative position CAMERA_POSITION_LOCKED, FALSE // (TRUE or FALSE) ]); } }
  10. ah ok! Thanks for the pointers, I'll give it a whirl and see how it goes
  11. Hi so I've never posted here before but I've made a few scripts in the past (though not for about 2 years, so I'm a bit out of practice!) Anyway, I've been trying to update an old HUD of mine which can scan a region as one of its functions, and return a list of names plus how far away the avi is - eg: Emilee Edenflower [96m] What I want to do now is add the group name of the detect avi to that output. I've pieced together a script (from various other topics on this forum, so it probably needs tidying up later!) which can get the group name from someone clicking on an item, which is all good and well if I just want to print out info into chat. But what I can't seem to figure out is how to get the variables made in http_response back into other output. Here's my script so far (for just detecting group names). You'll see at the end, http_response makes a variable called groupname which is output via llSay and llSetText. But I want to be able to use this variable elsewhere in the script. Is it possible to create a function I can pass the URL and group UUID to which contains the http_response and return the groupname as the functions return value and assign it to a variable to be use within other strings? // Get the active group from the avatar specified by inAvatar. // return the group key, a NULL_KEY is returned if the group // cannot be determined key getAvatarGroup (key inAvatar) { key result = NULL_KEY; // get the the list of attachments for the avatar list parts = llGetAttachedList (inAvatar); if (llGetListLength (parts) > 0) { // If the avatar has any attachments then just get the // group key for the first attachment. list parts2 = llGetObjectDetails (llList2Key (parts, 0), [OBJECT_GROUP]); result = llList2Key (parts2, 0); } return (result); } string groupname; // ------------------------------------------ default { touch_start (integer total_number) { key av = llDetectedKey (0); key groupId = getAvatarGroup (av); //list dets = llGetObjectDetails(llGetKey(),[OBJECT_GROUP]); //key uuid = llList2Key(dets,0); string url = "http://world.secondlife.com/group/"+(string)groupId; //llInstantMessage (av, "group = " + (string) groupId); llSay(0,llGetDisplayName(llDetectedKey(0)) + " is in the group..."); llHTTPRequest(url,[],""); llReleaseURL(url); llSay(0,groupname); } state_entry() { //604f9b3c-a72f-a7a1-421a-3f5d83037218 -> Xoco Reborn (2) llSetText("Touch me!",<255,255,255>,1.0); } http_response(key id, integer status, list data, string body) { list parsed = llParseString2List(body,["<title>","</title>"],[]); string groupname = llList2String(parsed,1); list parsedname = llParseString2List(groupname,[],["&lt;","&rt;","&quote;","&amp;","&cent;","&pound;","&yen;","&eu;","&copy;","&reg;"]); integer len = llGetListLength(parsedname); integer i; list replace = ["&lt;","<","&rt;",">","&quote;","\"","&amp;","&","&cent;","¢","&pound;","£","&yen;","¥","&euro;","€","&copy;","©","&reg;","®"]; for(i = 0;i < len;i++) { string substring = llList2String(parsedname,i); integer idx = llListFindList(replace,[substring]); if(~idx && !(idx%2)) { parsedname = llListReplaceList(parsedname,llList2List(replace,idx+1,idx+1),i,i); } } groupname = llDumpList2String(parsedname,""); llSetText("Last group detected: "+groupname,<255,255,255>,1.0); llSay(0,groupname); } }
×
×
  • Create New...