NawaliaTrea Posted June 13, 2018 Share Posted June 13, 2018 Hey there, so i just started to learn scripting and start with a simple draw/holster script and now trying to put animation in it. actually i managed to insert an animation and work just fine. what i am wondering is is it possible to insert another animation/pose after the first one. so the script goes like this (i tried several option after browsed the wiki and all over internet but still didnt work most of the time the script only run 1 animation.) : integer IsBowie_L = TRUE; integer ChatChan = 0; string DrawCmd = "pull"; string HolsterCmd = "bag"; integer IsVisible; integer hListen; default { state_entry() { llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION); } attach(key id) { if (id != NULL_KEY) { hListen = llListen(ChatChan, "", id, ""); } else { llListenRemove(hListen); } } listen(integer chan, string name, key id, string msg) { if (chan == ChatChan) { if (llToLower(msg) == llToLower(DrawCmd)) { if (IsBowie_L) { if (llGetLinkNumber() == LINK_ROOT) llSetLinkAlpha(LINK_SET, 1.0, ALL_SIDES); else llSetAlpha(1.0, ALL_SIDES); llStartAnimation("dualdrawblades"); } else { if (llGetLinkNumber() == LINK_ROOT) llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES); else llSetAlpha(0.0, ALL_SIDES); } } else if (llToLower(msg) == llToLower(HolsterCmd)) { if (IsBowie_L) { if (llGetLinkNumber() == LINK_ROOT) llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES); else llSetAlpha(0.0, ALL_SIDES); llStopAnimation("dualdrawblades"); } else { if (llGetLinkNumber() == LINK_ROOT) llSetLinkAlpha(LINK_SET, 1.0, ALL_SIDES); else llSetAlpha(1.0, ALL_SIDES); } } } } } is it possible to add another animation after the first one that already here . Thank you soo much for any input... Link to comment Share on other sites More sharing options...
Rolig Loon Posted June 13, 2018 Share Posted June 13, 2018 Ah.... one reason it's not working is that you haven't been careful with marking the scope of various actions in the script. Specifically, you wrote 8 hours ago, NawaliaTrea said: if (llGetLinkNumber() == LINK_ROOT) llSetLinkAlpha(LINK_SET, 1.0, ALL_SIDES); else llSetAlpha(1.0, ALL_SIDES); llStartAnimation("dualdrawblades"); , leaving out all the important {curly brackets} that tell where the if and else blocks start and end. As a result, the if block will work, because it only has one statement in it, but the script will fail after that because the else is missing brackets. The animation will only start unpredictably, if at all. Get in the habit of always putting curly brackets around the scope of any block of commands, even if it's just one line. Other than that, the script ought to work. I don't see any syntax errors, and the logic seems OK. If you try sending your two trigger messages in chat, the script ought to recognize them and play one anim or the other. When you are though testing, of course, replace your ChatChan with something other than PUBLIC_CHANNEL so that you don't overwork the servers and contribute to local lag. Link to comment Share on other sites More sharing options...
NawaliaTrea Posted June 14, 2018 Author Share Posted June 14, 2018 11 hours ago, Rolig Loon said: Ah.... one reason it's not working is that you haven't been careful with marking the scope of various actions in the script. Specifically, you wrote , leaving out all the important {curly brackets} that tell where the if and else blocks start and end. As a result, the if block will work, because it only has one statement in it, but the script will fail after that because the else is missing brackets. The animation will only start unpredictably, if at all. Get in the habit of always putting curly brackets around the scope of any block of commands, even if it's just one line. Other than that, the script ought to work. I don't see any syntax errors, and the logic seems OK. If you try sending your two trigger messages in chat, the script ought to recognize them and play one anim or the other. When you are though testing, of course, replace your ChatChan with something other than PUBLIC_CHANNEL so that you don't overwork the servers and contribute to local lag. Thank you for the tips i'll change the chat channel to more private that's just because i am too lazy to type/#chan before type the trigger ;D. this script i posted is working just fine what i am wondering is if its possible to play another animation after 1 animation finished. i read in wiki it is possible using timer but i tried that and still only play 1 animation instead of 2 in sequence. i want to play another animation after the first animation fires (in this case another one after the ("dualdrawblades") fires. anyway thank you very much for your help. Link to comment Share on other sites More sharing options...
Berksey Posted June 20, 2018 Share Posted June 20, 2018 (edited) If I want two animations to play in sequence, I look at how long it takes the first one to play, and tell the script to sleep exactly that long right after starting to play the first animation. Then, immediately after the llSleep(), I call the second animation to play. I use the same trick in timing the toggling of alphas when drawing a sword, or similar, so that the one in the scabbard vanishes as the one in the hand appears; the animation is started, the script sleeps until it's played to the right point in the animation, and then the script kicks back in with the secondary visual effect. It might be a little clunky compared to more elegant techniques, but it's the best way I've found for making it work for me, at least with timing animations, sounds, and particle effects. Naturally, you'd not want to use llSleep() if the script needs to do other things while the animation is playing. Edited June 20, 2018 by Berksey 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