Jump to content

Roxanne Sassypants

Resident
  • Posts

    3
  • Joined

  • Last visited

Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. This script has an odd issue when if people leave the sim it breaks the tracking, but if people enter the sim the tracking fixes itself. Im not sure whats going wrong here, Ive tried asking some scripting friends I know and we havent gotten to anything conclusive yet. The script is below, any thoughts/suggestions would be appreciated! float MAX_RANGE = 80.0; integer SKIP_MOUSELOOK_CHECKS = FALSE; integer GOT_FOV; float gFOV = 1.0; float viewAngle = 0.64; string owner; list trackerBlocks; integer MOUSELOOK_STATE; list friends; string curNote; integer curLine; string req; vector Region2HUD(vector objPos) { vector camPos = llGetCameraPos(); rotation camRot = llGetCameraRot(); objPos = (objPos - camPos) / camRot; objPos = <-objPos.y, objPos.z, objPos.x>; if( llFabs(objPos.z) < .01 ) return <-1,-1,-1>; float Xcrosshair = (objPos.x * gFOV) / objPos.z; if (Xcrosshair > -3. && Xcrosshair < 3.) { float Ycrosshair = (objPos.y * gFOV) / objPos.z; if (Ycrosshair > -1. && Ycrosshair < 1.) { float Zcrosshair = (objPos.z - 2) / objPos.z; if (Zcrosshair > -1. && Zcrosshair < 1.) { return <0, -Xcrosshair / 2., Ycrosshair / 2.> - llGetLocalPos(); } } } return <-1,-1,-1>; } list trackAgent(string id, integer index) { if( index >= llGetListLength(trackerBlocks) ) return []; vector color = <1,1,1>; integer find = llListFindList(friends,[id]); if(~find) color = llList2Vector(friends,find+1); vector tpos = getpos(id); vector pos = llGetCameraPos(); float dist = llVecMag(tpos-pos); float maxDistFactor = 64.0; float minDistFactor = 8.0; if( dist > maxDistFactor ) dist = maxDistFactor; if( dist < minDistFactor) dist = minDistFactor; dist -= minDistFactor; maxDistFactor -= minDistFactor; float sFactor = 1.0 - (dist / maxDistFactor); return [ PRIM_LINK_TARGET, llList2Integer(trackerBlocks,index), PRIM_POS_LOCAL, Region2HUD(tpos), PRIM_COLOR, -1, color, 1, PRIM_TEXT, llGetDisplayName(id), color, 1, PRIM_TEXTURE, -1, "f40fac0b-3924-ed66-df74-2133c8875ac5", <1,1,0>, <0,0,0>, 0, PRIM_SIZE, llGetScale() * sFactor ]; } list resetBlock(integer link) { return [ PRIM_LINK_TARGET, link, PRIM_POS_LOCAL, ZERO_VECTOR, PRIM_COLOR, -1, <1,1,1>, 0, PRIM_TEXT, "", <0,0,0>, 0 ]; } vector getpos(key i) {return llList2Vector(llGetObjectDetails(i,[3]),0);} list distanceSort(list ids) { list out; vector pos = llGetPos(); integer x; integer n = llGetListLength(ids); for(x=0;x<n;++x) { string id = llList2String(ids,x); vector tpos = getpos(id); float dist = llVecMag(tpos-pos); out += [dist,id]; } out = llListSort(out,2,TRUE); while(n>=2) { n -= 2; out = llDeleteSubList(out,n+1,n+1); } return out; } update() { if(GOT_FOV==FALSE) return; if(!SKIP_MOUSELOOK_CHECKS) { integer info = llGetAgentInfo(owner); if( MOUSELOOK_STATE == TRUE ) { if(((~info) & AGENT_MOUSELOOK) == AGENT_MOUSELOOK ) { MOUSELOOK_STATE = FALSE; reset(); return; } } else { if( ( info & AGENT_MOUSELOOK ) == AGENT_MOUSELOOK ) MOUSELOOK_STATE = TRUE; else return; } } list instructions; list a = llGetAgentList(AGENT_LIST_REGION,[]); integer x; a = distanceSort(a); integer findOwner = llListFindList(a,[(string)llGetOwner()]); if(~findOwner) a = llDeleteSubList(a,findOwner,findOwner); integer n = llGetListLength(a); vector pos = llGetCameraPos(); for (x=0;x<n;x++) { string id = llList2String(a,x); vector tpos = getpos(id); float dist = llVecMag(tpos-pos); if( dist < MAX_RANGE ) instructions += trackAgent(id,x); else instructions += resetBlock(llList2Integer(trackerBlocks,x)); } n = llGetListLength(trackerBlocks); for (x;x<n;x++){ instructions += resetBlock(llList2Integer(trackerBlocks,x)); } llSetLinkPrimitiveParamsFast(LINK_THIS,instructions); } reset() { llSetLinkPrimitiveParamsFast ( LINK_ALL_OTHERS, [ PRIM_POS_LOCAL, ZERO_VECTOR, PRIM_SIZE, llGetScale()*.5, PRIM_TEXT, "", <0,0,0>, 0, PRIM_TEXTURE, -1, TEXTURE_BLANK, <1,1,0>, <0,0,0>, 0, PRIM_COLOR, -1, <1,1,1>, 0 ] ); } integer parse(string d) { if( d == EOF ) return 0; d = llStringTrim(d,STRING_TRIM); if( d == "" ) return 1; if( llSubStringIndex(d,"//") == 0 ) return 1; list w = llParseString2List(d,["|"],[]); string id = llList2String(w,0); vector col = (vector)llList2String(w,1); friends += [id,col]; return 1; } loadNote() { friends = []; curNote = llGetInventoryName(INVENTORY_NOTECARD,0); curLine = -1; loadLine(); } loadLine() { ++curLine; req = llGetNotecardLine(curNote,curLine); } getPerms() { if( owner != llGetOwner() ) llResetScript(); if( llGetAttached() ) llRequestPermissions(owner,PERMISSION_TAKE_CONTROLS|PERMISSION_TRACK_CAMERA); } findStuff() { trackerBlocks = []; integer x; integer n = llGetNumberOfPrims(); for(x=1;x<=n;++x) { string name = llGetLinkName(x); if(name=="BufferPrim") trackerBlocks += [x]; } } boot(vector st, vector tp) { GOT_FOV = TRUE; vector scale = llGetScale(); vector off_point = llGetLocalPos(); vector face_pos = st; vector screen_pos = tp; gFOV = (1.0/viewAngle) * ((face_pos.x-.5)*scale.y-off_point.y+screen_pos.y)*2; gFOV = 1920.0 / 1028.0 / 1.04; llOwnerSay((string)gFOV); findStuff(); } default { state_entry() { llSetText("",<0,0,0>,0); owner = llGetOwner(); reset(); getPerms(); } attach(key i) { if(i) getPerms(); } on_rez(integer r) { getPerms(); } run_time_permissions(integer p) { if(!p) return; boot(<1,1,1>,<1,1,1>); llTakeControls(CONTROL_RIGHT,1,1); llSetTimerEvent(.01); loadNote(); } timer() { update(); } control(key i, integer h, integer c) {} dataserver(key i, string d) { if(i==req) { if(parse(d)) loadLine(); else llOwnerSay("Friends list loaded!"); } } changed(integer c) { if( ( c & CHANGED_INVENTORY ) == CHANGED_INVENTORY ) { friends = []; loadNote(); } } }
  2. fadeOut() { float f = 1.0; while(f > 0) { f -= .025; llAdjustSoundVolume(f); llSleep(.05); } } default { state_entry() { llSetSoundQueueing(TRUE); llListen(-53535,"","",""); } listen(integer c, string n, key i, string m) { if( llGetOwnerKey(i) != llGetOwner() ) return; list p = llParseString2List(m,["|"],[]); string cmd = llList2String(p,0); if( cmd == "PLAY" ) { llPlaySound(llList2String(p,1),1); } else if( cmd == "FADE" ) { fadeOut(); } } } I already had that in there, and I still hear the de-synicing.
  3. The system I am using works by llPlaySound with a slave/master node setup. What I am noticing is that when I walk around/cam around, sounds/songs in these nodes desynchronize from one another, resulting in one node being "ahead" while another might be "behind". I read somewhere that this might have something to do with rendering, but a similar system by the name of SCM mewsic player uses a similar setup with sound repeaters and from what I can tell it doesnt desynchronize. I understand that there might be other causes such as lag that might contribute to the desynchronization, but I am working in a controlled area, so that's been accounted for. Are there workarounds to this? Would llTriggerSound eliminate this desynchronization issue, or at least make it much less likely to do so? Let me know what your thoughts are.
×
×
  • Create New...