Jump to content

Miranda Umino

Resident
  • Posts

    390
  • Joined

  • Last visited

Everything posted by Miranda Umino

  1. Nevertheless , there are no function llSetLinkClickAction( nolink ). And it won t help to have a 50 prims linkset without indicators to show which prims may be used to sit
  2. I m not sure to understand you . Your problem is "when I click the vehicle to sit two avatars are sitting in the same position". But the numerical orders to link prims won t change anything about this point . If you have several seats , you will need to have set an appropriate llSitTarget and eventually llSetClickAction . The scripts to set the sittarget and the clickaction can be deleted after . The infos are kept in the prims .
  3. It depends of the value of the timer in parameter of llSetTimerEvent . If the value is big ( as for rollig where the value is 60 seconds ) , probability to get both people in and out : First tick : there are 15 avatars . between the first tick and second tick , there are one avatar who leaves , and one avatar who enters Second tick : there are always 15 avatars . If the value of the timer is short , probabilty that the new list is equal with the old list is big . And we may optimize this , avoiding to call too much llfindlist. To check quickly if the lists are the same, we may call llFindList with the full new list and the ful old list , and compare their length The idea is there : IN PSEUDOCODEif ( llListFindList(beforeList, nowList) == 0 ){ if ( llGetListLength(beforeList) == llGetListLength(nowList)) { // NO UPDATE OF OLDLIST WITH NEWLIST. And New avatars is EMPTY } else { // UPDATE OLDLIST WITH NEWLIST . And New avatars is EMPTY }}else{// WE DON T KNOW IF New Avatars is empty or not , WE NEED TO ITERATE THE LISTS} list gHereAlready ;integer WhoIsNew( ){ list AllAvs = llGetAgentList(AGENT_LIST_PARCEL,[]);// if this test > 0 , so the whole AllAvs list is included in gHereAlready // with one block if ( llListFindList(gHereAlready , AllAvs ) >= 0 ) { // if lists have different lengths , // AllAvs is included in gHereAlready // It means there are some people who have left // So we need to update gHereAlready if ( llGetListLength(gHereAlready) != llGetListLength(AllAvs)) { gHereAlready = AllAvs; } // if lists have equal lengths // gHereAlready is already equal to AllAvs // We non t need to update it. // This is what will happen the most often // In the 2 cases , we may return directly without doing a loop // because we know the AllAvs is included in gHereAlready return FALSE; } if ( llGetListLength(gHereAlready) == 0 ) { gHereAlready = AllAvs; return TRUE; } list NewAvs; integer IsHere; integer i = llGetListLength(AllAvs); key k; while(i--) { if ( !~llListFindList(gHereAlready,llList2List(AllAvs,i,i)) ) { NewAvs += llList2List(AllAvs,i,i); IsHere = TRUE; } } gHereAlready = AllAvs; return IsHere;} It won t optimize a lot of . It depends of the number of avatars . Around 35-45 avatars , i ve got around 40-60 ms with the original version , and 25-35 ms with this version.
  4. Just change the status of your listener manually , "on" when you want to listen your other avatar ( he is on the sim ) , "off" when you don t want to listen him ( he is not in the sim ) ; for instance in touching your attachment . You have not 200 attachments // constants : change these two lines integer channel = -84552147;key otherAvatarKey = "f7ce2caa-dca0-44f7-8326-7eff69b33060";// variablesinteger handle;integer toggle;default{ state_entry() { handle = llListen(channel, "", otherAvatarKey, ""); llListenControl(handle, TRUE); llOwnerSay("Listening "+(string)otherAvatarKey + " on channel " + (string)channel ); } touch_end(integer total_number) { toggle = !toggle; // Make the listener active or inactive as required llListenControl(handle, toggle); if(toggle) { llOwnerSay("Listening "+(string)otherAvatarKey + " on channel " + (string)channel ); } else { llOwnerSay("Not Listening "+(string)otherAvatarKey + " on channel " + (string)channel ); } } listen(integer channel, string name, key id, string message) { llOwnerSay( name + " just said " + message); }}
  5. To demonstate better my opinion that the problem with llsetkeyframedmotion is the same with other physics rotations : i ve done 2 seamless scripts : It fixes a rotation while 5 seconds and tests with different angular velocities . It returns when ( in frames of simulator ) the motion has been stopped ( more precisely when llGetOmega is null vector ) By defaut , an iteration of test is 0.5 seconds , so 0.5 * 45 FPS = 225 frames of simulator Rez a prim ; move it to let it float on the air without friction with the ground or other objects ; put the script inside and touch it to start the tests / / we ll do succesive tests// From an angularvelocity of INITIALANGULARVELOCITY =0.5, we are turning along STEPTIMETEST seconds.// A timer is setup to count the number of frames in simulator :// if STEPTIMETEST is reached , we stop the motion , wait until it stops rotation and we go to the next test // If STEPTIMETEST is not reached and we reach a NULL llGetOmega before this, we stop the current test and we start the next test .// At every test , we display the angular velocity and the time in frames between the start of the current test and when the object has stopped to turn with llGetOmega = ZERO_VECTORfloat STEPANGULARVELOCITY = 0.01;float STEPTIMETEST = 5.0;float INITIALANGULARVELOCITY = 0.5;float angularvelocity;integer count;integer framestart;integer frameend;list keyframes;list buildKeyframes(float seconds, float angular_velocity){list l;rotation r = llEuler2Rot(<0,0,PI_BY_TWO>);float totalangle = seconds * angular_velocity;while ( totalangle > PI_BY_TWO ){l += [ r, PI_BY_TWO / angular_velocity ];totalangle -= PI_BY_TWO;}if ( totalangle > 0.0){float timekeyframe = totalangle / angular_velocity;if ( timekeyframe <= 0.111111 ) timekeyframe = 10/9.0;l += [ llEuler2Rot(<0,0,totalangle>), timekeyframe ] ;}return l;}default{state_entry(){llSetObjectName("test keyframemotion - low angular velocity");llSetStatus(STATUS_PHYSICS, FALSE);llSetRot(ZERO_ROTATION);llSetStatus(STATUS_PHANTOM, TRUE);llSetStatus(STATUS_BLOCK_GRAB, TRUE);}touch_end(integer total_number){llResetTime();llSetTimerEvent(2/45.0);angularvelocity = INITIALANGULARVELOCITY; framestart = (integer)llGetEnv("frame_number");llSetKeyframedMotion( buildKeyframes( STEPTIMETEST, angularvelocity ) , [ KFM_DATA, KFM_ROTATION ] );}timer(){if ( llGetTime() > STEPTIMETEST ){llSetKeyframedMotion( [], [ ] );while ( llGetOmega() != ZERO_VECTOR ) llSleep( 1/45.0);llResetTime();}frameend = (integer)llGetEnv("frame_number");if ( ( llGetOmega() == ZERO_VECTOR ) && ( frameend - framestart > 3 ) ){llOwnerSay(llList2CSV(["angularvelocity", RAD_TO_DEG* angularvelocity, "frames", frameend-framestart ]));angularvelocity -= STEPANGULARVELOCITY; if ( angularvelocity > 0.0 ){framestart = (integer)llGetEnv("frame_number");llSetKeyframedMotion( buildKeyframes( 5.0, angularvelocity ) , [ KFM_DATA, KFM_ROTATION ] );}else {llSetTimerEvent(0.0);llOwnerSay("end test");}}}} Results with llSetKeyframemotion angularvelocity, 28.647890, frames, 225[16:16] test keyframemotion - low angular velocity: angularvelocity, 28.074932, frames, 226[16:16] test keyframemotion - low angular velocity: angularvelocity, 27.501976, frames, 226[16:16] test keyframemotion - low angular velocity: angularvelocity, 26.929018, frames, 226[16:16] test keyframemotion - low angular velocity: angularvelocity, 26.356062, frames, 226[16:16] test keyframemotion - low angular velocity: angularvelocity, 25.783104, frames, 226[16:16] test keyframemotion - low angular velocity: angularvelocity, 25.210146, frames, 226[16:16] test keyframemotion - low angular velocity: angularvelocity, 24.637190, frames, 226[16:16] test keyframemotion - low angular velocity: angularvelocity, 24.064232, frames, 226[16:16] test keyframemotion - low angular velocity: angularvelocity, 23.491274, frames, 226[16:16] test keyframemotion - low angular velocity: angularvelocity, 22.918318, frames, 226[16:16] test keyframemotion - low angular velocity: angularvelocity, 22.345360, frames, 226[16:17] test keyframemotion - low angular velocity: angularvelocity, 21.772404, frames, 226[16:17] test keyframemotion - low angular velocity: angularvelocity, 21.199446, frames, 226[16:17] test keyframemotion - low angular velocity: angularvelocity, 20.626488, frames, 226[16:17] test keyframemotion - low angular velocity: angularvelocity, 20.053532, frames, 226[16:17] test keyframemotion - low angular velocity: angularvelocity, 19.480574, frames, 226[16:17] test keyframemotion - low angular velocity: angularvelocity, 18.907618, frames, 226[16:17] test keyframemotion - low angular velocity: angularvelocity, 18.334660, frames, 226[16:17] test keyframemotion - low angular velocity: angularvelocity, 17.761702, frames, 226[16:17] test keyframemotion - low angular velocity: angularvelocity, 17.188745, frames, 226[16:17] test keyframemotion - low angular velocity: angularvelocity, 16.615788, frames, 225[16:17] test keyframemotion - low angular velocity: angularvelocity, 16.042831, frames, 225[16:17] test keyframemotion - low angular velocity: angularvelocity, 15.469873, frames, 224[16:18] test keyframemotion - low angular velocity: angularvelocity, 14.896916, frames, 224[16:18] test keyframemotion - low angular velocity: angularvelocity, 14.323958, frames, 225[16:18] test keyframemotion - low angular velocity: angularvelocity, 13.751000, frames, 226[16:18] test keyframemotion - low angular velocity: angularvelocity, 13.178042, frames, 226[16:18] test keyframemotion - low angular velocity: angularvelocity, 12.605084, frames, 225[16:18] test keyframemotion - low angular velocity: angularvelocity, 12.032126, frames, 225[16:18] test keyframemotion - low angular velocity: angularvelocity, 11.459168, frames, 225[16:18] test keyframemotion - low angular velocity: angularvelocity, 10.886210, frames, 226[16:18] test keyframemotion - low angular velocity: angularvelocity, 10.313251, frames, 226[16:18] test keyframemotion - low angular velocity: angularvelocity, 9.740294, frames, 226[16:18] test keyframemotion - low angular velocity: angularvelocity, 9.167336, frames, 126[16:18] test keyframemotion - low angular velocity: angularvelocity, 8.594378, frames, 100[16:18] test keyframemotion - low angular velocity: angularvelocity, 8.021420, frames, 15[16:18] test keyframemotion - low angular velocity: angularvelocity, 7.448462, frames, 72[16:18] test keyframemotion - low angular velocity: angularvelocity, 6.875504, frames, 42[16:18] test keyframemotion - low angular velocity: angularvelocity, 6.302546, frames, 48[16:18] test keyframemotion - low angular velocity: angularvelocity, 5.729589, frames, 43[16:18] test keyframemotion - low angular velocity: angularvelocity, 5.156631, frames, 4[16:18] test keyframemotion - low angular velocity: angularvelocity, 4.583673, frames, 56[16:18] test keyframemotion - low angular velocity: angularvelocity, 4.010715, frames, 50[16:19] test keyframemotion - low angular velocity: angularvelocity, 3.437758, frames, 60[16:19] test keyframemotion - low angular velocity: angularvelocity, 2.864800, frames, 36[16:19] test keyframemotion - low angular velocity: angularvelocity, 2.291842, frames, 22[16:19] test keyframemotion - low angular velocity: angularvelocity, 1.718884, frames, 25[16:19] test keyframemotion - low angular velocity: angularvelocity, 1.145927, frames, 35[16:19] test keyframemotion - low angular velocity: angularvelocity, 0.572969, frames, 34[16:19] test keyframemotion - low angular velocity: angularvelocity, 0.000011, frames, 4[16:19] test keyframemotion - low angular velocity: end test The same test with llsetangularvelocity. Rez a prim ; move it to let it float on the air without friction with the ground or other objects ; put the script inside and touch it to start the tests . The script is lightly different because the motion is full physics , but it s the same algorithm // we ll do succesive tests// From an angularvelocity of INITIALANGULARVELOCITY =0.5, we are turning along STEPTIMETEST seconds.// A timer is setup to count the number of frames in simulator :// if STEPTIMETEST is reached , we stop the motion , wait until it stops rotation and we go to the next test // If STEPTIMETEST is not reached and we reach a NULL llGetOmega before this, we stop the current test and we start the next test .// At every test , we display the angular velocity and the time in frames between the start of the current test and when the object has stopped to turn with llGetOmega = ZERO_VECTORfloat STEPANGULARVELOCITY = 0.01;float STEPTIMETEST = 5.0; float INITIALANGULARVELOCITY = 0.5;float angularvelocity;integer count;integer framestart;integer frameend; default{state_entry(){llSetObjectName("test setangularvelocity - low angular velocity");llSetStatus(STATUS_PHYSICS, FALSE);llSetRot(ZERO_ROTATION);llSetStatus(STATUS_PHYSICS, TRUE);llSetStatus(STATUS_PHANTOM, TRUE);llSetStatus(STATUS_BLOCK_GRAB, TRUE);llSetPhysicsMaterial(GRAVITY_MULTIPLIER, 0.0,0.0,0.0,0.0);}touch_end(integer total_number){llResetTime();llSetTimerEvent(2/45.0);angularvelocity = INITIALANGULARVELOCITY; framestart = (integer)llGetEnv("frame_number");llSetAngularVelocity(<0,0,angularvelocity>, TRUE);}timer(){if ( llGetTime() > STEPTIMETEST ){llSetAngularVelocity(ZERO_VECTOR,TRUE);while ( llGetOmega() != ZERO_VECTOR ) llSleep( 1/45.0);llResetTime();}frameend = (integer)llGetEnv("frame_number");if ( ( llGetOmega() == ZERO_VECTOR ) && ( frameend - framestart > 3 ) ){llOwnerSay(llList2CSV(["angularvelocity", RAD_TO_DEG* angularvelocity, "frames", frameend-framestart ]));angularvelocity -= STEPANGULARVELOCITY; if ( angularvelocity > 0.0 ){framestart = (integer)llGetEnv("frame_number");llSetAngularVelocity(<0,0,angularvelocity>, TRUE);}else {llSetTimerEvent(0.0);llOwnerSay("end test");}}}} Results angularvelocity, 28.647890, frames, 228[16:25] test setangularvelocity - low angular velocity: angularvelocity, 28.074932, frames, 230[16:25] test setangularvelocity - low angular velocity: angularvelocity, 27.501976, frames, 229[16:25] test setangularvelocity - low angular velocity: angularvelocity, 26.929018, frames, 227[16:25] test setangularvelocity - low angular velocity: angularvelocity, 26.356062, frames, 228[16:25] test setangularvelocity - low angular velocity: angularvelocity, 25.783104, frames, 227[16:25] test setangularvelocity - low angular velocity: angularvelocity, 25.210146, frames, 210[16:25] test setangularvelocity - low angular velocity: angularvelocity, 24.637190, frames, 228[16:25] test setangularvelocity - low angular velocity: angularvelocity, 24.064232, frames, 227[16:25] test setangularvelocity - low angular velocity: angularvelocity, 23.491274, frames, 227[16:26] test setangularvelocity - low angular velocity: angularvelocity, 22.918318, frames, 228[16:26] test setangularvelocity - low angular velocity: angularvelocity, 22.345360, frames, 226[16:26] test setangularvelocity - low angular velocity: angularvelocity, 21.772404, frames, 228[16:26] test setangularvelocity - low angular velocity: angularvelocity, 21.199446, frames, 227[16:26] test setangularvelocity - low angular velocity: angularvelocity, 20.626488, frames, 227[16:26] test setangularvelocity - low angular velocity: angularvelocity, 20.053532, frames, 227[16:26] test setangularvelocity - low angular velocity: angularvelocity, 19.480574, frames, 227[16:26] test setangularvelocity - low angular velocity: angularvelocity, 18.907618, frames, 228[16:26] test setangularvelocity - low angular velocity: angularvelocity, 18.334660, frames, 227[16:26] test setangularvelocity - low angular velocity: angularvelocity, 17.761702, frames, 228[16:26] test setangularvelocity - low angular velocity: angularvelocity, 17.188745, frames, 226[16:26] test setangularvelocity - low angular velocity: angularvelocity, 16.615788, frames, 227[16:27] test setangularvelocity - low angular velocity: angularvelocity, 16.042831, frames, 228[16:27] test setangularvelocity - low angular velocity: angularvelocity, 15.469873, frames, 227[16:27] test setangularvelocity - low angular velocity: angularvelocity, 14.896916, frames, 227[16:27] test setangularvelocity - low angular velocity: angularvelocity, 14.323958, frames, 227[16:27] test setangularvelocity - low angular velocity: angularvelocity, 13.751000, frames, 228[16:27] test setangularvelocity - low angular velocity: angularvelocity, 13.178042, frames, 228[16:27] test setangularvelocity - low angular velocity: angularvelocity, 12.605084, frames, 226[16:27] test setangularvelocity - low angular velocity: angularvelocity, 12.032126, frames, 227[16:27] test setangularvelocity - low angular velocity: angularvelocity, 11.459168, frames, 228[16:27] test setangularvelocity - low angular velocity: angularvelocity, 10.886210, frames, 221[16:27] test setangularvelocity - low angular velocity: angularvelocity, 10.313251, frames, 6[16:27] test setangularvelocity - low angular velocity: angularvelocity, 9.740294, frames, 205[16:27] test setangularvelocity - low angular velocity: angularvelocity, 9.167336, frames, 22[16:27] test setangularvelocity - low angular velocity: angularvelocity, 8.594378, frames, 93[16:27] test setangularvelocity - low angular velocity: angularvelocity, 8.021420, frames, 114[16:27] test setangularvelocity - low angular velocity: angularvelocity, 7.448462, frames, 22[16:27] test setangularvelocity - low angular velocity: angularvelocity, 6.875504, frames, 49[16:27] test setangularvelocity - low angular velocity: angularvelocity, 6.302546, frames, 40[16:28] test setangularvelocity - low angular velocity: angularvelocity, 5.729589, frames, 40[16:28] test setangularvelocity - low angular velocity: angularvelocity, 5.156631, frames, 48[16:28] test setangularvelocity - low angular velocity: angularvelocity, 4.583673, frames, 51[16:28] test setangularvelocity - low angular velocity: angularvelocity, 4.010715, frames, 63[16:28] test setangularvelocity - low angular velocity: angularvelocity, 3.437758, frames, 68[16:28] test setangularvelocity - low angular velocity: angularvelocity, 2.864800, frames, 68[16:28] test setangularvelocity - low angular velocity: angularvelocity, 2.291842, frames, 30[16:28] test setangularvelocity - low angular velocity: angularvelocity, 1.718884, frames, 5[16:28] test setangularvelocity - low angular velocity: angularvelocity, 1.145927, frames, 68[16:28] test setangularvelocity - low angular velocity: angularvelocity, 0.572969, frames, 36[16:28] test setangularvelocity - low angular velocity: angularvelocity, 0.000011, frames, 36[16:28] test setangularvelocity - low angular velocity: end test In the both motions , with llsetangularvelocity or with llsetkeyframedmotion , the problems appear below 9 degrees per seconds of simulator. I ve not done a script with llTargetomega , but , by experience , i ve met the same comportment there too. No , the question is not purely academic : a clock turning at 60 beats per minute , so 6 degrees per seconds , and everybody can visually count the motions. It s neither the rotation of a wheel , neither the rotation of a motor, rotations who are undetectable to the sight. The error on rotations is huge. Personnaly i have no ideas how developpers on other games deal this case : are they switching non-physics motions ? are they changing the size of floats ? are they using some accumulators ? are they changing dynamically the interpolation time : not 1/45 per second but 1/22.5 seconds to avoid floating errors? The stuttering is done because havarrik does a KFM_LOOP, and llsetkeyframedmotion will send to the viewer every tiny impulsion. If he did without KFM_LOOP ; the motion will be stopped
  6. Dora , i am talking about frames of simulator ( so 45 frames per seconds ) ; i am not talking about frames as input/ parameters of llsetkeyframedmotion. If you prefer it s the time in seconds of your frame as input of llsetkeyframemotion multiplied by 45 : if i take your script dated at 12/Nov/14 12:55 PM : rotation r = llAxisAngle2Rot( <0.0, 1.0, 0.0>, TWO_PI/(float)frams); float angle = llRot2Angle® * RAD_TO_DEG; float time = 60.0/(float)frams; float velocity_by_frame = angle / time; llOwnerSay(llList2CSV( [ "angle (deg)", angle, "time (seconds)", time, "velocity rotation (deg/frame )",velocity_by_frame ])); => will display angle (deg), 120.000008, time (seconds), 20.000000, velocity rotation (deg/frame ), 6.000000 you are at 6 deg per seconds< 9 deg per seconds => so , you meet the problem here If i take you second daatas : rotation r = <0.000000, 0.087156, 0.000000, 0.996195>; float angle = llRot2Angle® * RAD_TO_DEG; float time = 1.666667 ; float velocity_by_frame = angle / time; llOwnerSay(llList2CSV( [ "angle (deg)", angle, "time (seconds)", time, "velocity rotation (deg/frame )",velocity_by_frame ])); => will display angle (deg), 9.999578, time (seconds), 1.666667, velocity rotation (deg/frame ), 5.999746 you are at 5.997 deg per seconds< 9 deg per seconds => so , you meet the problem here too In your script in your link , your move does both a translation and a rotation . So to compute the velocity of rotation in the right coordinates ; in local coordinates the velocity is different of region coordinates Change your linear( translation) Velocity vector Velocity = <0.0, -0.10471975512, 0.0>; by vector Velocity = <0.0, -0.01471975512, 0.0>; and you will watch your prim starting and stopping // frames for circular motion, plane, script by Dora Gustafson, Studio Dora 2014// function computes relative moves and rotations for a Key Framed Motion// function takes arguments: velocity, some radius-vector and angle for motion in degrees// the turning can be in any plane in space. Plane given by the two vectors// The two vectors must not point in same or opposite direction// turns prim forward before motion startvector Velocity = <0.0, -0.01471975512, 0.0>;vector Radius = <1.0, 0.0, 0.0>;float Angle = 360;integer rev;list L;list framesCircular( vector velocity, vector radius, float angle ){ // Compute circle center and first position vector center = llVecMag(radius)*llVecNorm((velocity%radius)%velocity); vector startRadiusVector = -center; // Compute time per step float arch = angle*DEG_TO_RAD; float steps = (float)llRound(arch/(10.0*DEG_TO_RAD)); float dT = arch*llVecMag(radius)/llVecMag(velocity)/steps; dT = llRound(45.0*dT)/45.0; if ( dT < 0.11111111 ) dT = 0.11111111; // initialize loop list KFMlist = []; vector axis = velocity%radius; rotation baserot = llGetRot(); vector U = center+startRadiusVector; rotation rotU = baserot; vector V; rotation rotV; float step = 0.0; while ( step < steps ) { step += 1.0; rotV = llAxisAngle2Rot( axis, arch*step/steps); V = center+startRadiusVector*rotV; rotV = baserot*rotV; KFMlist += [V-U, rotV/rotU, dT]; rotU = rotV; U = V; } return KFMlist;}default{ touch_start( integer n) { llSetKeyframedMotion( [], []); llSleep(0.2); if ( rev ) llSetKeyframedMotion( L, [KFM_MODE, KFM_REVERSE]); else { // first turn prim correct, X-axis in velocity's direction llSetRot( llAxes2Rot( llVecNorm( Velocity), llVecNorm(( Velocity%Radius)%Velocity), llVecNorm( Velocity%Radius))); // then do the motion L = framesCircular( Velocity, Radius, Angle); llSetTimerEvent(1/45.0); llSetKeyframedMotion( L, []); } rev = !rev; } timer() { llSetLinkPrimitiveParamsFast(LINK_THIS, [ PRIM_TEXT, llList2CSV([ llVecMag(llGetVel()), llGetOmega()]), <1.0,1.0,1.0>, 1.0 ]); }} And i repeat : with llTargetOmega , we meet the same problem , and with llSetAngularVelocity we meet the same problem. it stops too soon for low velocity. It s a common bug/limit for every rotations in second life
  7. No , there is no link with the translations Your rotation velocity is too small and the half cosinus , or half sinus needed to compute the intermediar rotations may be rounded to 1 or 0: llOwnerSay(llList2CSV( [ "angle (radians)", llRot2Angle(normRot(<0.00000, 0.99996, 0.00000, -0.00873>)), "\n", "angle (rad) / frame",llRot2Angle(normRot(<0.00000, 0.99996, 0.00000, -0.00873>))/(20.0*45), "\n", "half cosinus angle / frame ", llCos( 0.5 * llRot2Angle(normRot(<0.00000, 0.99996, 0.00000, -0.00873>))/(20.0*45) ) ])); angle (radians), 3.124133, , angle (rad) / frame, 0.003471, , cosinus half angle / frame , 0,99999849379559389750526410095037 <--- may be rounded to 1 and so make no rotations LLSetKeyframedMotion work by an impulsion; if the rotation impulsion is very small , your object can move and stop at the half of its run Watch my Jira https://jira.secondlife.com/browse/SVC-7471 It s the same problem for every physical rotations : there is a limit to 9 degrees per seconds. Maybe use 64 bits float and not 32 bits float may fix it
  8. Thank you , but i ve maybe explained incorrectly my goal : i don t want some plants who are inside the object inventory . I want the plants ( trees and grasses ) who are the ones when you own a land and you choose in build tool directly. It seems they consume less prims and are less laggy ; i don t know why . Do you think they are objects as every other objects , or are there special objects ?
  9. I have the rights to modify trees and grasses in a sim . But filling a whole sim manually is boring and inaccurate . In addition , i want my trees follow a geometric pattern , a kind of the Baroque Gardens in Europe . Is there a waay to do this task by script ?
  10. google spreadsheet and google document allows you to export your document as plain text . Or as JSON text . So , maybe you will get less difficulties to parse your document . Nevertheless you need to consult the documention of google about the URLs . Your actual fields are "edit?sharing=xxx" . But with LSL , you don t want to edit it . To export a document , the fields are export?exportFormat=txt Change too the mimetype to text/plain Let's fix your script: key http_request_id; // URL for my google document string BASE_URL = "https://docs.google.com/document/d/1CkDj9dCAfK46J9I_AjNI-_7EvSGmRuGzSev2NRx7v8A"; // fields to add to the URL for a google document to watch it as text string SUFFIXE_URL = "/export?exportFormat=txt"; default { state_entry() { string URL = BASE_URL + SUFFIXE_URL; http_request_id = llHTTPRequest(URL , [HTTP_METHOD, "GET", HTTP_MIMETYPE, "text/plain", HTTP_BODY_MAXLENGTH,16384, HTTP_PRAGMA_NO_CACHE,TRUE], ""); } http_response(key request_id, integer status, list metadata, string body) { if (request_id != http_request_id) return;// exit if unknown vector COLOR_BLUE = <0.0, 1.0, 0.0>; float OPAQUE = 1.0; llSetText(body, COLOR_BLUE, OPAQUE); llOwnerSay("\nstat : " + (string)status + "\nmeta : " + llDumpList2String(metadata," , ") ); } } You may export to to tsv( tab separated text), csv( comma separated text ) etc .... For spreadsheet , by default the first sheet of the speadsheet is returned . If you want an another sheet you will need to specify the number of the sheet in the url ( &gid=2 or 3 or 4 etc .. ) With spreadsheets , you may specify too a range . So you won t need to fetch the whole sheet ; you will get only the interesting cells for you lsl script If you use too google charts , you may use "named ranges" too . So if your range is dynamic and not static , you won t need to change your lsl script If you are not english and you try to export to csv or tsv , fill the regional and international setteings for US English in your document ( inside the google page) . For instance , in Europe , we use "," and not "." to decimate numbers . So when we export to csv, if we have not changed the international settings , it will separate the frac and the non-frac. And finally , the hover text defined by llSetText is limited to 254 characters . Inside your httpèresponse , maybe you can save the body of the http response in a string and write your string in several parts
  11. To convert radians in degrees : angle_in_degrees = RAD_TO_DEG * angle_in_radians ; To convert degrees in radians : angle_in_radians = DEG_TO_RAD * angle_in_degrees ; Or , if you don t use the constants RAD_TO_DEG and DEG_TO_RAD , think that PI radians = 180 degrees , so angle_in_degrees = 180 * angle_in_radians / PI; angle_in_radians = PI * angle_in_degrees / 180.0; A rotation is the combination of an angle and an axis : the axis of rotation ( you may get it by llRot2Axis ) and the angle ( relative this axis . ( you may get it by llRot2Angle ) An another equivalent definition of rotation is the combination of 3 axis : the LOCALS axis x , y and z. You may get them by respectively llRot2Fwd , llRot2Left , llRot2Up For instance : float magnitude = 3.0 ; // speed is 3 meters per seconds llSetPhysicsMaterial(GRAVITY_MULTIPLIER, 0 , 0, 0, 0); // ignores the gravity llSetStatus(STATUS_PHYSICS, TRUE ); // turns on physics // moves to a constant velocity in the local X direction and with a speed equals to magnitude( 3meter/second)llSetVelocity( magnitude * llVecMag( llRot2Fwd( llGetRot () ) , TRUE ); llSleep(2.0) ; waits 2 seconds before to stop physicsllSetStatus(STATUS_PHYSICS, FALSE ); // turns off physics
  12. There is faster . You need some preparation in the rezzed prim . In the rezzed prim , you have already wroten a tiny script who request permission and link to the root prim. After it has linked to the root prim , it deletes its script In the root prim , you don try to link .. You only rez . Finally : with the Ron Khondi's version : - it s easier to setup ( no need to prepare the permissions ) : - it s slow : N * 1/45 second because you can t enter in the same event twice in the same simulator frame + N * 1 second : delay for the link + N * 0.1 second : delay for the rez For instance , for 100 prims , it will take 100/45 + 100*1 +100*0.1 = 112 seconds for 255 prims , it will take 255/45 + 255*1 +255*0.1 = 286 seconds With one version where it s the rezzed prim who tries to link to the root : - it s more difficult to setup ( need to prepare permissions ) - it s difficult to transfer to someone ( it s a big inconvenient ) because we can t change the permissions inside a content when it s not rezzes and when we change the owner of the object - it s faster : N * 1/45 s + N * 0.1 s .. for 100 prims , it will take 100/45 + 100*1 = 12 seconds . So 9 to 10 X faster for 255 prims , it will take 255/45 +255*0.1 = 31 seconds This is the script to put in the rezzer object integer count;integer channel = -44451552;string objectName = "Object";string message = "ack";default{ touch_start(integer total_number) { llResetTime(); llRezObject( objectName, llGetPos() + <.0, .0, (float)count/10 + .1>, ZERO_VECTOR, ZERO_ROTATION, (integer)("0x"+llGetSubString(llGetKey(),-8,-1)) ); } object_rez( key child_id ) { ++count; llRegionSayTo (child_id, channel, message); if (count < 90) { llRezObject( objectName, llGetPos() + <.0, .0, (float)count/10 + .1>, ZERO_VECTOR, ZERO_ROTATION, (integer)("0x"+llGetSubString(llGetKey(),-8,-1)) ); } else { llOwnerSay("Time = " +(string)llGetTime()); state dummy; } llSetText("Number of prims = "+(string)llGetNumberOfPrims(), <1,1,1>, 1); } }state dummy{ state_entry() {}} And this is the script to put in the rezzed prim . Save it , grant the permissions , take the object in your inventory . and copy it inside the content inventory of the rezzer integer channel = -44451552;string message = "ack";default{ state_entry() { llRequestPermissions(llGetOwner(), PERMISSION_CHANGE_LINKS); llListen(channel, "", NULL_KEY, message); } listen(integer channel , string name , key k, string m) { if ( (integer)("0x"+llGetSubString(k,-8,-1)) == llGetStartParameter() ) { if ( llGetOwner() == llGetOwnerKey(k ) ) { llCreateLink(k, FALSE); } } } changed(integer c) { if ( c & CHANGED_LINK ) { if ( llGetNumberOfPrims() > 1 ) { llRemoveInventory(llGetScriptName()); } } }} Of course , you can even link faster - if you don t rez individual prim but bulk prims ( but bulk objects add one constraint too ) - if you have already rezzed all your prims and know all the keys ( other constraint too )
  13. I am using the change event and i check with it CHANGED_INVENTORY . When i remove ( or when i add) several items in the content inventory of the prim , for instance 30 objects , several change events are triggered . Not one per item added or deleted but one by "block" Does someone know if the size of the number items changed before to trigger an another change event is fixed ? Is it variable ? What is the rule exactly ?
  14. Your script is probably incorrect , so . When you call llRequestPermissions , it revokes the old permissions . So , when you call llRequestPermissions to control animations for the second avatar , you loose the previous premissions granted to the first avatar To animate your second avatar , use a second separated script
  15. Now, imagine you are driving up a very steep spiral mountain road to the summit, which is three miles above the base. Your speedometer reads 60mph (Slow down! Are you crazy?). After one hour of driving up that mountain. You look at your GPS screen and see you've gone only 10 miles. How the hell did that happen? Part of the answer is obvious. The road was spiral, so we spent a lot of time driving in circles. You could drive on a roundabout all day and get nowhere (something Parhelion Palou and I recently discussed, and want to try). So ,for GPS : vector v = llGetVel();v.z = 0.0;llOwnerSay((string)llVecMag(v)); ?? I ve got an another question : do the speedometer ( or the GPS ) work on a local frame or a world frame ? When you drif for instance and you cut the motor , do they report velocity on the frame of the vehicle or the velocity in the world by the drift ? Should it be llVecMag( llGetVel() / llGetOmega() ) ?
  16. First point : don t be confused by CONTROL_ML_LBUTTON ( triggered only on mouselook mode and a left click mouse ) and CONTROL_LBUTTON ( triggered only in normal view mode and a left click mouse ) Second point : If it happens when you use the keyboard AND if you handle the keyboard : it s because your rates for your hardware are different between the keyboard and the mouse : generally , keyboard triggers 45 events per seconds , mouse triggers 26 events per seconds. (It can be different on some different computers) I tell this because you can move your avatar on clicking on the land and without use the keyboard in normal view ; in mouselook you are obliged to use the keyboard to move your avatar So , maybe your count is not correct and you count some keyboard events in mouselook mode
  17. Tasty ! Damn . I m hungry , now ...
  18. llFrand(-1000000000.0) is totally valid : default{ state_entry() { integer channelDialog1 = (integer)(llFrand(-1000000000.0) - 1000000000.0); integer channelDialog2 = (integer)(llFrand(-1000000000.0) - 1000000000.0); llOwnerSay(llList2CSV([ channelDialog1, channelDialog2 ])); }} outputs -1384138496, -1555145472 as expected There are two errors , the both are in using llDetectedName(i ) or llDetectedName(0) inside the listen event : state secondDialog{........... listen( integer i, string n , key k, string m) { string avName; string origName = llGetObjectName();// llDetectedName(i) returns NULL_KEY// because llDetectedName doesn t run inside the"listen" event// llDetectedName runs inside touch* , collision*, sensor event// Error ------> avName = llDetectedName(i); avName = llList2String( llParseString2List( avName, [" "], [] ), 0 ); llSetObjectName( avName ); // llDetectedName(0) returns NULL_KEY// because llDetectedName doesn t run inside the"listen" event// llDetectedName runs inside touch* , collision*, sensor event// Error : -------> string detectedName = llDetectedName(0); llSay(0, avName + " " + choicedOption + "ed " + m + " "); llSetObjectName( origName ); state default; } I am not sure if the final message is the first name of the toucher has pickpocket/confused the fist name of the menu displayed But the code should be closed to this : list listOptions = [ "picpocket", "confuse" ];list listAvatarsSensor;list listAvatarsFullNameSensor;integer channelDialog ;integer handleListener;string choicedOption ;string avatarNameHavingMenu;key avatarKeyHavingMenu;float timerDialog = 15.0;float range = 5.0;// Function with// input : full name of one avatar// output : first name of this avatarstring fullName2firstName(string fullName){ return llList2String( llParseString2List( fullName, [" "], [] ), 0 );}default{ touch_end(integer total_number) { avatarNameHavingMenu = llDetectedName(0); avatarKeyHavingMenu =llDetectedKey(0); state firstDialog; }}state firstDialog{ state_entry() { channelDialog= (integer)(llFrand(-1000000000.0) - 1000000000.0); handleListener = llListen(channelDialog, avatarNameHavingMenu , avatarKeyHavingMenu , ""); llDialog(avatarKeyHavingMenu, "Choose an option:" , listOptions, channelDialog ); llSetTimerEvent(timerDialog); } listen( integer i, string n , key k, string m) { choicedOption = m; llSensor("",NULL_KEY,AGENT,range,PI); } sensor(integer n) { integer i ; listAvatarsSensor = []; listAvatarsFullNameSensor = []; do { listAvatarsSensor += [ llGetSubString(llDetectedName(i), 0, 23) ] ; listAvatarsFullNameSensor += [ llDetectedName(i) ] ; i++; } while ( i < n); state secondDialog; } timer() { state default; } state_exit() { llListenRemove(handleListener); llSetTimerEvent(0.0); }}state secondDialog{ state_entry() { channelDialog= (integer)(llFrand(-1000000000.0) - 1000000000.0); handleListener = llListen(channelDialog, avatarNameHavingMenu, avatarKeyHavingMenu , ""); llDialog( avatarKeyHavingMenu, "Choose an avatar:" , listAvatarsSensor, channelDialog ); llSetTimerEvent(timerDialog); } listen( integer i, string n , key k, string m) { integer index = llListFindList(listAvatarsSensor, [ m ]); if ( index != -1 ) { string pickpocketed = llList2String( listAvatarsFullNameSensor, index ); pickpocketed = fullName2firstName(pickpocketed); string pickpocketer = fullName2firstName( avatarNameHavingMenu ); string origName = llGetObjectName(); llSetObjectName( pickpocketer ); llSay(0, pickpocketer + " " + choicedOption + "ed " + pickpocketed + " "); llSetObjectName( origName ); state default; } } timer() { state default; } state_exit() { llListenRemove(handleListener); llSetTimerEvent(0.0); }}
  19. Has anyone succeded to "create" a script with Experience ? I have got the XP viewer ; the script editor has always the "use experience" toggle disabled. The Documentation tells i need to be "a crontibutor experience" but doesn t tell how to become a "contributor experience" Scripts in the Wiki inside the LSL portal fail because they don t find any experience To sum : nothing work
  20. Cloud party was all so using javascript Yes .... But a total nerfed version of javascript &colon; One instance amongst several : the last time i went there , the loops structures ( do.. while ; for ; repeat ) didn t exist . At cloudparty , they did the repetitive tasks with a timer ... boring ... If i remember , there were no possibilities to create some libraries too , to avoid the repetition of code. No interest to have a OOP language if the code is limited to the current script With High Fidelity , there is this possibility to include scripts : https://github.com/highfidelity/hifi/blob/master/examples/includeExample.js There is nevertheles something i can t find in the examples : how they deal errors when there is a call to a service ? Is an exception triggered ? Is there an example ? There are some events to listen the keyboard and the mouse , but are there some events to listen an action in-world ( an action not fired by the script but by other scripts in-world) or an execution of a service ? Is there an example ? Pretty nice job for the moment . A good way
  21. yes , logarithmic . Indeed : - at the start, you have your hud who wontains the new script , and the list of keys of objects you want updated - aat the iteration 1 , you send the script to one object , but this object can too work in parallelism with your hud to send the new nscript to the others , so you send too the half of list of keys - iteration 2 , your hud send the half of the half of initial list to an another object and the new script ; the first object sends too one half of half of the initial list to an another object ; and as it has got now the new script , it gives it to an another object . so 2 objects will be updated at this time . as the last step , they can work in parallelism with the hud and the 1st object tosend the new script too to other objects - iteration 3, your hud continues to work with the 1/8th of the iitial list . the 3 other objects do the same . so 4 objects will be updated at this step . Total of objects with the new script is 4 + 2 + 1 = 7 - iteration 4 : 8 objects will be updated at this step ; Total of objects with the new script is 8 + 4 + 2 + 1 = 15 - iteration 5 : 16 objects will be updated at this step ; Total of objects with the new script is 31 - iteration 6 : 32 objects will be updated at this step ; Total of objects with the new script is 63 - iteration 7 : 64 objects will be updated at this step ; Total of objects with the new script is 127 7 steps are enough to update your 100 objects ., so 21 secondes are caused by the delay . In a general formule , total time of the delay is 3 secondes * LN base 2 ( 100) . Of course in practice there will be some other seconds by overhead , but you will be very far from 5 minutes
  22. Yes , but Wandering SoulStar wants to use llRemoteloadScriptPin So the state_entry will be the first event triggered . And llGetStartparemeter will know wich parameter we have sent to llRemoteloadScriptPin
  23. As you can see the issue is the 3 sec delay caused by llRemoteLoadScriptPin. In a building project it would not be unheard of to have more than 100 building prims, and having it take 5 minutes to distribute one script is just not workable. No , it won t be 3 s * 100 = 5 minutes : it will be around 3 s * LN(100) / LN( 2 ) = 20 seconds
  24. You don t need to have the same number of giver scripts as the number of given scripts. If you have 10 givers and 100 given , it will divide your time by 10 . Not neglectible Extreme ? Maybe ... As much as it is to give 100 scripts ... Question ? is it the same script given 100 times ? In this case , the script given can give itself too . The recursivity will make replicate scripts in few steps : 2,4,8,16 etc ..
×
×
  • Create New...