Jump to content

Nescolet

Resident
  • Posts

    54
  • Joined

Everything posted by Nescolet

  1. Hello, I need a script that can detect if a global vector variable has any value different than ZERO_VECTOR assigned. If I write this: vector alfa; llSay(0,(string)alfa;Script will say alfa is <0,0000, 0,0000, 0,0000>. If I write this: vector alfa; if(alfa = ZERO_VECTOR){ llSay(0,(string)alfa;} else {llSay(0,"alfa is set");}The script will say alfa is set! If I write this: vector alfa; vector blankvector = <0,0000, 0,0000, 0,0000>; if(alfa = blankvector){ llSay(0,(string)alfa;} else {llSay(0,"alfa is set");}The script won't say alfa is set again!! Is there a way to check if vector alfa is ZERO_VECTOR?
  2. Instead of llUnSit(); I could use "llStopAnimation(anim2play);" and I will get the same sit target change behavior. The test bench is just one elongated cube and there is no llSetLinkPrimparamsfast declaration. The relevant parts of the script are as follow: // [...] state_entry() { anim2play = anim1; //llSitTarget(Sitpos1,Sitrot1); curpos = Sitpos1; currot = Sitrot1; llSitTarget(curpos,currot); } touch_start(integer total) // [...] listen(integer channel, string name, key id, string msg) { // [...] // switches between anims via menu: else if (msg == "Sit1"){ llStopAnimation(anim2play); anim2play = anim1; curpos = Sitpos1; currot = Sitrot1; llSitTarget(curpos,currot); llStartAnimation(anim2play); } else if (msg == "Sit2"){ llStopAnimation(anim2play); anim2play = anim2; curpos = Sitpos2; currot = Sitrot2; llSitTarget(curpos,currot); llStartAnimation(anim2play); } // [ ...] changed(integer change) { // something changed if(change & CHANGED_LINK){ // and it was a link change key user = llAvatarOnSitTarget(); if(user != NULL_KEY){ //We have an avatar sitting llRequestPermissions(user,PERMISSION_TRIGGER_ANIMATION); // [...] } else{ //they've got up if(llGetPermissions()&PERMISSION_TRIGGER_ANIMATION){ llUnSit(user); anim2play = anim1; // reset sit target for next use: llSitTarget(Sitpos1,Sitrot1); // curpos and currot does not work here. // That's why I'm resetting to first anim and sit target on unsit. } } } } run_time_permissions(integer perm) { if (perm & PERMISSION_TRIGGER_ANIMATION){ llStopAnimation("sit"); llStartAnimation(anim2play); } } timer() { close_menu(); } }
  3. Hello, I am scripting a multi-pose sitter and testing it in a bench long enough to seat 2 or 3 avis and I noticed that after sitting on the right side of the bench, where the sit target is set by code, and changing from one animation to another via a menu, the next time an avi sits on the bench he ends up sitting in the left side. That's strange because my script only sets up one sit target in the prim. After sitting on the "new" sit target, changing animations keeps the avi in that side, until the avi stands and sits again, in that occasion the avi sits back on the right side. Is there a way to prevent the sit target from changing location like this? So far the only workaround I've found to avoid this change of location of the sit target is to reinstate the sit target after unsitting like this: if(user != NULL_KEY){ llUnSit(user); anim2play = anim1; // reset sit target for next use: llSitTarget(Sitpos1,Sitrot1); }But this prevents the bench "to remember" which animation was used the last time I seated. I could buy a nice sitter script but I prefer to have fun learning how to code one for myself and learn more on scripting in the process :)
  4. Hello, I am scripting a multi-pose sitter and testing it in a bench long enough to seat 2 or 3 avis and I noticed that after sitting on the right side of the bench, where the sit target is set by code, and changing from one animation to another via a menu, the next time an avi sits on the bench he ends up sitting in the left side. That's strange because my script only sets up one sit target in the prim. After sitting on the "new" sit target, changing animations keeps the avi in that side, until the avi stands and sits again, in that occasion the avi sits back on the right side. Is there a way to prevent the sit target from changing location like this? So far the only workaround I've found to avoid this change of location of the sit target is to reinstate the sit target after unsitting like this: if(user != NULL_KEY){ llUnSit(user); anim2play = anim1; // reset sit target for next use: llSitTarget(Sitpos1,Sitrot1); }But this prevents the bench "to remember" which animation was used the last time I seated. I could buy a nice sitter script but I prefer to have fun learning how to code one for myself and learn more on scripting in the process :)
  5. Can you figure out how the Aria chairs located at http://maps.secondlife.com/secondlife/Abiss/237/142/23 store the adjusted positions? I don't see that it updates any object name or description. At the root prim it seems to have one notecard for each animation. If you reset all the scripts you still get the adjusted position but if another avi tries the same animation he/she gets the default adjustment. So the adjusted position seems to be stored somewhere per user and even persists between sessions. I would like to know how it's done.
  6. I could manage to produce a DAE with no missing pieces if instead of exporting to DAE directly, first I export the piece as OBJ, import this into Blender and then export this as DAE. Strangely, with a simplified version of the rails this technique proceduced a piece with missing items, but I've found that if I remove all duplicate vertices from every selectable piece before exporting to OBJ, then finally I got a complete DAE.
  7. I applied "smooth" using the Shading: Smooth button under the Object Tools when the whole piece was selected. After smooth is applied the numbers for the whole piece are the following: Verts:20542 | Faces: 38048 | Tris:38048 | Objects:34/34 I haven't created any materials because I don't know how to do that yet. My knowledge of Blender is below basic so far so I will keep your suggestions for when I know how to apply them. Thank you very much for the details Drongle.
  8. Hello, I used the latest version of Blener to smooth some rails, before making sure all the piece was seleted. Exported the piece as DAE and when I use latest LL viewer to preview and import I get a piece of rails that has missing sections. I can also see the missing parts of the DAE piece if i open the file with MeshLab. Any idea why could this happen or what I may be doing wrong? Thanks
  9. Finally I got it right as follows, thanks everyone for the help list sound = ["sound1", "sound2", "sound3", "sound4", "sound5", "sound6"];integer index; // used to track which sound to playinteger length; // used to cound number of soundslist ST = [7.5, 8.5, 7.5, 8.5, 6.0]; // Aproximate length of each sound default{ on_rez(integer start_param){ llResetScript(); } state_entry(){ llSetSoundQueueing( TRUE ); length = llGetListLength(sound); llSetTimerEvent( 0.0 ); } touch_end( integer vIntTch ){ if (index != 0){ llSay( 0, "wait for it to finish" ); }else if (index == 0){ llPlaySound( llList2String( sound, index ), 1.0 ); llSetTimerEvent(llList2Float( ST, index )); ++index; } } timer(){ if (index < (length-1)){ llPlaySound( llList2String( sound, index ), 1.0 ); llSetTimerEvent(llList2Float( ST, index )); ++index; }else{ llPlaySound( llList2String( sound, index ), 1.0 ); index = 0; llSetTimerEvent(0.0); } } }
  10. If I place integer index = (-llGetlistLength( sound ));integer indexSndLength = (-llGetlistLength( SndLength)); Before "default{" I get Error: syntax error. So far I just left "Sound2Play" as it is since the original script says its used to track which sound to play. I'll deal with that after I know how to set a global variable.
  11. I am trying to use a timer for dealing with sounds with different length but I get ERROR: Name not defined within scope in // line 22 list sound = ["sound1", "sound2", "sound3", "sound4", "sound5", "sound6"];list SndLength = [7.5, 8.5, 7.5, 8.5, 6.0]; // Aproximate length of each sound integer Sound2Play; //-- used to track which sound to playdefault{ state_entry(){ llSetSoundQueueing( TRUE ); } touch_end( integer vIntTch ){ if (Sound2Play){ llSay( 0, "wait for it to finish" ); }else{ integer index = (-llGetlistLength( sound )); integer indexSndLength = (-llGetlistLength( SndLength)); llPlaySound( llList2String( sound, index ), 1.0 ); llSetTimerEvent(llList2Float( SndLength, indexSndLength )); } } timer(){ if (++Sound2Play){ // Line 22 below: llPlaySound( llList2String( sound, index ), 1.0 ); llSetTimerEvent(llList2Float( SndLength, indexSndLength )); }else{ llSetTimerEvent( 0.0 ); } }}
  12. To play a sequence of sounds having different lengths you could use a code like this: // Variableslist sound = ["sound1","sound2","sound3"];list sleep = [7.5, 8.5, 7.5, 8.5, 6.0]; integer index; default{ state_entry(){ llSetSoundQueueing( TRUE ); } touch_end( integer vIntTch ) { integer length = (llGetListLength(sound)-1); while (index < length) { llPlaySound( llList2String( sound, index ), 1.0 ); llPreloadSound(llList2String( sound, (index+1))); llSleep(llList2Float( sleep, index )); ++index; } if (index == length) { llPlaySound( llList2String( sound, index ), 1.0 ); llSleep(llList2Float( sleep, index )); llResetScript(); } }}
  13. Thank you Cerise for your helpful reply.
  14. Hello, I want an attachment to desapear as soon as I start to fly. For that I would need to find a way to detect when the Home key is pressed on the keyboard or detect when the avatar starts flying. llTakeControls function is useful just for detecting jumps, when pressing the PgUp key but does not support the Home key. Any ideas how a script could detect flying? Thanks!
  15. Thank you Rolig and Cerise for your replies. Now I feel relieved that it was not me that was failing to find the way to do it as I intended
  16. Hello, is there a way to change the point an object is attached to my avatar by touching the attached object itself?. For example, if the object is attached to my right hand, I want to be able to switch its attach point to ATTACH_HUD_TOP_RIGHT when I touch the object. And vice versa, when the object is attached to ATTACH_HUD_TOP_RIGHT it should attach itself back to ATTACH_RHAND upon touch. That way I could attach a flashlight as a HUD which I could touch to wear it on my hand and then touch again to attach it back as a hud. I'm trying to make it this way because as far as I know there is no way to attach objects from a HUD's inventory without first rezzing the object and I want to be able to attach the flashlight even in no-rez zones without having to look for it in my inventory.
  17. Thank you all for your help, specially to Innula for the clear explanation on what the server knows about animations. Cheers!
  18. Innula, I tried the following script put on a cube attached to my spine: default { touch_start(integer total_number) { llSay(0,(string)(llRot2Euler(llGetRot())*RAD_TO_DEG)); } } But the script seems to report only the rotation in one axis (the last one): <0.00000, 0.00000, -96.84402> And it returns the same value if I apply an inworld animation to the avi making it lay on the floor on its side.
  19. Rolig, thanks for your tip, I added your code to the second follower script found here and it seems to report only the rotation in one axis like this Resident is facing <0.00000, 0.00000, 0.53724, 0.84343>. (That is, <0.00000, 0.00000, 64.99147>. When I trigger an animation applied to the avi inworld that lays my avi sideways on the floor the rotation reported is the same as above. I'd like to have have a report on what is the rotation of the avi when an animation is applied to it inworld.
  20. Is there a way to get an avatar rotation coordinates, like if it were a prim? I tried attaching a cube to an avi's center but when I click edit on the cube the rotation values show all zeros.
  21. Thank you Griffin for your help and insight :catsurprised:
  22. When taking this snapshot I used the option to save it to my PC. I only have the original filename which is original_50571169d33e73579c000001.
  23. Hello, I have taken this picture somewhere while I was a fresh newbie, took no landmark and couldn't find the place in my teleport history. Can anyone id this place? I do remember it is a small island, one house only one floor with an heliport (with helicopter) close by.
  24. What is the difference between prim nails and glove nails? I know that prim nails only look good with a standard hand gesture.
×
×
  • Create New...