Rolig Loon Posted March 6, 2011 Share Posted March 6, 2011 Sometimes you need a pose stand with more than one pose. Perhaps you need a versatile modeling stand, or a dance pad. This script lets you cycle through as many animations or poses as you load into the one-prim stand, using either touch or chat commands. See internal comments for the available commands. //Multipose Stand -- Rolig Loon -- 7/09/09 -- Updated March 2011 // Place this script and your animations in a prim pose stand. // Touch pose stand to select the next animation in inventory or // type chat commands in channel 47. // Type /47 HELP to see a list of chat commands. integer ThisAnim = 0; integer NumAnims = 0; string CurrAnim = "turn_180"; string HoldName; key agent; default { on_rez(integer start_param) { llResetScript(); } state_entry() { HoldName = llGetObjectName(); llSetAlpha(1.0,ALL_SIDES); llSetObjectDesc("Chat commands on channel 47"); NumAnims = llGetInventoryNumber(INVENTORY_ANIMATION); llListen(47,"","",""); llSetSitText( "Stand" ); llSitTarget( <0.00, 0.00, 0.80>, ZERO_ROTATION ); } listen(integer channel, string thing, key id, string message) { if(id == agent) { if (llToUpper(message) == "ON") // Make the stand visible { llSetAlpha(1.0,ALL_SIDES); } else if (llToUpper(message) == "OFF") // Make ths stand invisible { llSetAlpha(0.0,ALL_SIDES); } else if (llToUpper(message) == "LIST") // LIST all available animations by number { integer j; for (j=0;j<= NumAnims-1;j=j+5) { llInstantMessage(id,"/me " + (string)(j+1) + " = " + llGetInventoryName(INVENTORY_ANIMATION,j) +" \n" + (string)(j+2) + " = " + llGetInventoryName(INVENTORY_ANIMATION,j+1) +" \n" + (string)(j+3) + " = " + llGetInventoryName(INVENTORY_ANIMATION,j+2) +" \n" + (string)(j+4) + " = " + llGetInventoryName(INVENTORY_ANIMATION,j+3) +" \n" + (string)(j+5) + " = " + llGetInventoryName(INVENTORY_ANIMATION,j+4)); } } else if (llToUpper(message) == "SHOW") //SHOW the currently active animation in chat { llInstantMessage(id,"/me Current Animation " + (string)ThisAnim + " = " + CurrAnim); } else if (llToUpper(message) == "NOTE") { llGiveInventory(id,"MultiPose Instructions"); // Give instruction notecard } else if (llToUpper(message) == "HELP") { llInstantMessage(id,"/me Left click the pose stand to advance poses or use chat commands on channel 47:"); llInstantMessage(id,"/me LIST produces a list of available poses with key numbers.\n" + " Typing a key number advances immediately to that pose in the LIST.\n" + " SHOW displays the key number and name of the current animation.\n" + " ON makes the pose stand visible.\n" + " OFF makes the pose stand invisible.\n" + " NOTE offers instructions on a notecard. \n" + " HELP produces this message."); } else { ThisAnim = (integer)message -1; //Listen for an optional direct command to apply animation #message if ((integer)message > NumAnims | (integer)message <= 0) { llInstantMessage(id,"/me Please type a number between 1 and " + (string)(NumAnims)); ThisAnim = 0; } else { llStopAnimation(CurrAnim); CurrAnim = llGetInventoryName(INVENTORY_ANIMATION, ThisAnim%NumAnims); llStartAnimation(CurrAnim); llInstantMessage(id,"/me " +(string)(ThisAnim+1) + " = " + CurrAnim); ++ThisAnim; ThisAnim = ThisAnim%NumAnims; } } } } touch_start(integer num_detected) { if (llDetectedKey(0) == agent) { llStopAnimation(CurrAnim); if(NumAnims != 0) { CurrAnim = llGetInventoryName(INVENTORY_ANIMATION, ThisAnim%NumAnims); llStartAnimation(CurrAnim); llInstantMessage(llDetectedKey(0),"/me " + (string)(ThisAnim+1) + " = " + CurrAnim); ++ThisAnim; ThisAnim = ThisAnim%NumAnims; } else { llStartAnimation("turn_180"); // The default if there are no stored animations is the SL Appearance stance } } } changed(integer change) { if (change & CHANGED_LINK) { agent = llAvatarOnSitTarget(); if (agent) { llInstantMessage(agent,"Click the pad to start and advance animations. Type \"/47 help\" for chat commands."); llRequestPermissions(agent,PERMISSION_TRIGGER_ANIMATION); } else { if ( llGetPermissions() == PERMISSION_TRIGGER_ANIMATION) { llStopAnimation(CurrAnim); llSetObjectName(HoldName); } llResetScript(); } } else if (change & CHANGED_INVENTORY) { llResetScript(); } } run_time_permissions(integer parm) { if(parm == PERMISSION_TRIGGER_ANIMATION) { llStopAnimation("sit"); llSetAlpha(0.0,ALL_SIDES); //Make the pose stand invisible llSetObjectName(""); llStartAnimation(CurrAnim); } } } 6 Link to comment Share on other sites More sharing options...
Emma Krokus Posted March 11, 2011 Share Posted March 11, 2011 Thank you Rolig! I have found this very useful!! The pose stand disappears when first sat on - I preferred to have it visible until I finished choosing an animation to use in my picture and only then making the stand disappear. Link to comment Share on other sites More sharing options...
Rolig Loon Posted March 11, 2011 Author Share Posted March 11, 2011 I'm glad it's helpful for you, Emma. All you need to do is remove the line right near the bottom of the script that says llSetAlpha(0.0,ALL_SIDES); //Make the pose stand invisible Link to comment Share on other sites More sharing options...
Emma Krokus Posted March 14, 2011 Share Posted March 14, 2011 Thank you Rolig! I had managed to do it by changing the alpha value to 1.0 - I was too scared to go removing lines from a script! Hehehe - your help might turn me into a scripter yet... Link to comment Share on other sites More sharing options...
Sion Pearl Posted April 4, 2011 Share Posted April 4, 2011 I've used it too. It's ace. Link to comment Share on other sites More sharing options...
Maar Auer Posted August 2, 2011 Share Posted August 2, 2011 This is cool... Stumbled into this script looking for something else. That is, i need to place anims on a prim, u sit on it or wear it, and then it plays the animation list automatically. With timer, for example: anim1: 5,3s, anim2: 12,13s... etc. etc. I'm not a scripter, so forgive my dumb questions... How difficult it'd be to modify this script to do that? Thanks, if you bother to answer Link to comment Share on other sites More sharing options...
Rolig Loon Posted August 7, 2011 Author Share Posted August 7, 2011 Maar Auer wrote: This is cool... Stumbled into this script looking for something else. That is, i need to place anims on a prim, u sit on it or wear it, and then it plays the animation list automatically. With timer, for example: anim1: 5,3s, anim2: 12,13s... etc. etc. I'm not a scripter, so forgive my dumb questions... How difficult it'd be to modify this script to do that? Thanks, if you bother to answer Sorry, I didn't spot your note until just now. You shouldn't have any trouble doing that. It's basically a matter of adding a timer event to take the place of the touch_start event. It would trigger the next animation every X seconds just as if you had clicked the stand. You'd probably want to keep just enough of the touch_start event to use as a switch to toggle the timer on and off. If all you want is a stand that cycles through the animations in its inventory, though, you can probably write a stripped down script that's simpler even than this one to do the job. Link to comment Share on other sites More sharing options...
ellerc Posted November 22, 2011 Share Posted November 22, 2011 Thanks for posting this and thanks to you I was able to build my first model pose stand - yay! I've loaded the poses I wanted into the prim and they advance as they should. However, when its in use, my subjects sink into the prim. Also, I'm not able to advance it if someone is on it which I will need to do as the photographer. Am I missing a step? How can I get the subject to "stand" and not sink and how do I advance it while someone is on it? Elle Link to comment Share on other sites More sharing options...
Rolig Loon Posted November 22, 2011 Author Share Posted November 22, 2011 You're free to modify it any way you like. If you remove the if statement at the start of the touch_start event, then it won't just work when llDetectedKey(0) == agent. The reason I wrote it that way was so that other people couldn't mess with my poses while I was on the stand, that's all. As far as "sinking" is concerned, ...... the pose stand turns transparent when you stand on it, if that's what you mean. That's another one of those things you can change if you want. Just change any llSetAlpha statements to 1.0 to be sure that the stand stays visible. If you really do sink in the stand, though, check to see that you didn't make it phantom. Link to comment Share on other sites More sharing options...
ellerc Posted November 23, 2011 Share Posted November 23, 2011 Thanks again Rolig, the prim is not set to phantom. I'll try to create a new prim and see if I have the same problem and of course I'll try your suggestions! I can totally see now how people become addicted to building Link to comment Share on other sites More sharing options...
Charolotte Caxton Posted November 25, 2011 Share Posted November 25, 2011 Rolig, how do I make the default animation not be the editing appearance animation? Thank you. Link to comment Share on other sites More sharing options...
Rolig Loon Posted November 25, 2011 Author Share Posted November 25, 2011 That's easy. Where it says llStartAnimation("turn_180"); // The default if there are no stored animations is the SL Appearance stance just change it to something other than "turn_180," which is the editing appearance pose. 1 Link to comment Share on other sites More sharing options...
Charolotte Caxton Posted November 25, 2011 Share Posted November 25, 2011 Thanks, Rolig! New question: Is it possible to go backwards as well? Clicking pose stand goes to next pose, how would I make it so I can go back to the previous one? Thanks! Link to comment Share on other sites More sharing options...
Rolig Loon Posted November 25, 2011 Author Share Posted November 25, 2011 Instead of incrementing ThisAnim each time you click on it ( ++ThisAnim ), decrement it ( --ThisAnim ). If you want a way to pick whether you go forward or backward, the cleanest way is to use two buttons and then detect which one was touched, as in, for example ... if (llDetectedLinkName(0) == "Forward"){ ++ThisAnim;}else if (llDetectedLinkName(0) == "Back"){ --ThisAnim;} 1 Link to comment Share on other sites More sharing options...
Charolotte Caxton Posted November 25, 2011 Share Posted November 25, 2011 Awesome. Thank you so very much. Link to comment Share on other sites More sharing options...
Charolotte Caxton Posted November 30, 2011 Share Posted November 30, 2011 Rolig, can this pose stand be made into a hud, for those times when I can't rez a stand? Link to comment Share on other sites More sharing options...
Rolig Loon Posted December 1, 2011 Author Share Posted December 1, 2011 Yes, it can. It takes a little work, though. 1 Link to comment Share on other sites More sharing options...
Charolotte Caxton Posted December 1, 2011 Share Posted December 1, 2011 Cool. Thank you. Link to comment Share on other sites More sharing options...
Charolotte Caxton Posted February 3, 2012 Share Posted February 3, 2012 ellerc wrote: Thanks for posting this and thanks to you I was able to build my first model pose stand - yay! I've loaded the poses I wanted into the prim and they advance as they should. However, when its in use, my subjects sink into the prim. Also, I'm not able to advance it if someone is on it which I will need to do as the photographer. Am I missing a step? How can I get the subject to "stand" and not sink and how do I advance it while someone is on it? Elle Hey, I figured out how to make the avatar not sink into the prim. On line 28, where it says llSitTarget( <0.00, 0.00, 0.80>, ZERO_ROTATION ); Change 0.80 to 1.00, so that you end up with llSitTarget( <0.00, 0.00, 1.00>, ZERO_ROTATION ); That is on an object that has been flattened down to 0.0100 (the Z size) My assumption is that messing with that number will help you if you don't have a flattened prim, I am not certain what the reference point is for that number, I guess the center of the prim? Link to comment Share on other sites More sharing options...
Charolotte Caxton Posted February 3, 2012 Share Posted February 3, 2012 Rolig, the poses I put into the prim cause my avatar to stand at a 180 rotation upon standing on the prim. So, if I am facing the camera and then stand on the prim, I have my back to the camera. Is there a way to make it so I don't do a 180, or is that the animation at play? Thanks. Link to comment Share on other sites More sharing options...
Darkie Minotaur Posted February 3, 2012 Share Posted February 3, 2012 You also use the llSitTarget for that. Rotations are expressed in a way that is a little confusing for most people (including me), but there are ways to make them more readable - 1. You use Euler rotations instead of quaternions and then convert euler to quaternions (llEuler2Rot), 2. You enter degrees instead of radiants in the llEuler2Rot function and conver them by multiplying the degrees by the built in variable DEG_TO_RAD. In the line below, you just enter the degrees you want to rotate the ava in the x, y and z axes respectively: llSitTarget( <0.00, 0.00, 1.00>, llEuler2Rot(<x, y, z> * DEG_TO_RAD) ); 1 Link to comment Share on other sites More sharing options...
Rolig Loon Posted February 3, 2012 Author Share Posted February 3, 2012 That's the way that standard LL animation works. It's even called "turn_180". I suppose that I could add a camera control code to flip the camera around too, though..... Never thought of that. ETA: Oh, wait.. I see what you're doing. (Thanks for the kick, Darkie.... :smileytongue: ) See right at the top of the script where the sit target is defined? It says llSitTarget( <0.00, 0.00, 0.80>, ZERO_ROTATION ); So just change it to say llSitTarget( <0.00, 0.00, 0.80>, llEuler2Rot(<0.0,0.0,PI> ); Link to comment Share on other sites More sharing options...
Charolotte Caxton Posted February 3, 2012 Share Posted February 3, 2012 Rolig Loon wrote: That's the way that standard LL animation works. It's even called "turn_180". I suppose that I could add a camera control code to flip the camera around too, though..... Never thought of that. I got rid of the turn 180 pose (at least I think I did). I don't want the camera flipped, that would not be beneficial if say I had a cool background I was trying to capture, you know? Or using some sort of backdrop. The pose stand I have been using forever which I love with all of my heart but only has a t pose does not turn me about, so I was trying to figure out how to do that. Link to comment Share on other sites More sharing options...
Charolotte Caxton Posted February 3, 2012 Share Posted February 3, 2012 At your ETA, cool, I will try that. Thanks, D Minotaur! Link to comment Share on other sites More sharing options...
Charolotte Caxton Posted February 3, 2012 Share Posted February 3, 2012 You know what, Rolig? After some messin around, it turns out the 180 flip is a good thing. When my avatar walks up to the pose stand, her back is towards me (the camera) so that when I click to stand, I am suddenly facing the camera, sooo, that's pretty cool. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now