Question for any scripters out there?
|
|
Vengeance Ethaniel
Registered User
Join date: 25 Aug 2008
Posts: 12
|
12-02-2009 13:14
Okay i've made an animation but i'd like it to be chat activated. I do have the script but the animation continues to loop until i say the stop word. Here is the script: float delay=0.5; default { on_rez(integer r){llResetScript();} state_entry(){ llMessageLinked(LINK_SET,2,"p0",""  ; //Start is at frame 0 llListen(0,"",llGetOwner(),""  ; //**// llListen(0,"","",""  ; } listen(integer c,string n,key id,string m){ if(m=="start"  { llSetTimerEvent(5); //activates ever 5 seconds! } if(m=="stop"  { llSetTimerEvent(0); llMessageLinked(LINK_SET,2,"p0",""  ; //back to frame 0 } } timer() { llMessageLinked(LINK_SET,2,"p1",""  ; llSleep(delay); llMessageLinked(LINK_SET,2,"p2",""  ; llSleep(delay); llMessageLinked(LINK_SET,2,"p3",""  ; llSleep(delay); llMessageLinked(LINK_SET,2,"p0",""  ; //Back to frame 0 } } //Say "start" to start the timer loop! "stop" to stop it. ///This is an example script that runs when you talk to the object. //it runs only 4 frames, you can easily add as many as you like. //if you want this to listen to everyone,, remove the "//**//" on line 7. Is there any way to remove that loop so that it just activates and de-activates when i say start and stop? Thanks a lot.
|
|
Sassy Romano
Registered User
Join date: 27 Feb 2008
Posts: 619
|
12-02-2009 13:22
I don't understand what you're trying to achieve.
You say you've made an animation but I see no animation calls. Do you mean, you move several prims? Presumably that's where your link messages are going to, scripts in each prim that then move.
You say you don't want it to loop but if it doesn't loop then there's no need to tell it to stop!
Don't use the timer event triggering every 5 seconds.
|
|
Vengeance Ethaniel
Registered User
Join date: 25 Aug 2008
Posts: 12
|
12-02-2009 13:26
From: Sassy Romano I don't understand what you're trying to achieve.
You say you've made an animation but I see no animation calls. Do you mean, you move several prims? Presumably that's where your link messages are going to, scripts in each prim that then move.
You say you don't want it to loop but if it doesn't loop then there's no need to tell it to stop!
Don't use the timer event triggering every 5 seconds. The above script is the trigger for the animation
|
|
Sassy Romano
Registered User
Join date: 27 Feb 2008
Posts: 619
|
12-02-2009 13:28
I'll offer again.. I don't understand what you're trying to achieve. What is this "animation", prims?
Please describe more.
|
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
12-02-2009 13:31
It looks like the script has 3 animations, which it calls frames, that are actually done by some other script.
Did you write this? If all you really want is to start/stop the anim based on chat, there might be a better script to start from..
/me is also a little confused about what you're trying to do. Do you just want to stop when you chat "stop" or do you want it to automatically stop after 5-10 (or whatever) seconds?
Either way, I think (guess) you might want to put this at the start of the timer event:
llSetTimerEvent (0.0);
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!! - Go here: http://jira.secondlife.com/browse/SVC-1224- If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left
|
|
Lunacy Flux
Registered User
Join date: 8 Oct 2009
Posts: 7
|
12-02-2009 13:38
Definitely looks like it's a control script for animating prims. Assuming what you're trying to do is simply play the "animation" once then Sassy is right, you really won't need the stop command for such a short sequence, so the easiest way to remove the loop is to delete the following part of the script: llSetTimerEvent(5); //activates ever 5 seconds! } if(m=="stop"  { llSetTimerEvent(0); llMessageLinked(LINK_SET,2,"p0",""  ; //back to frame 0 } } timer() { that will remove the redundant stop command and the unwanted loop (you'll need to add an extra } to the end of the script).
|
|
Kelli May
karmakanic
Join date: 7 Oct 2006
Posts: 1,135
|
12-02-2009 13:46
From: Vengeance Ethaniel Okay i've made an animation but i'd like it to be chat activated. I do have the script but the animation continues to loop until i say the stop word.
[script snipped]
Is there any way to remove that loop so that it just activates and de-activates when i say start and stop?
Thanks a lot. Do you mean you want it to run once if you say start, but can abort it partway if you say stop?
_____________________
Do worried sheep have nervous ticks?
Karmakanix@Sin-Labs http://slurl.com/secondlife/Circe/170/197/504 Karmakanix on SLX http://www.slexchange.com/modules.php?name=Marketplace&MerchantID=61062
|
|
Lunacy Flux
Registered User
Join date: 8 Oct 2009
Posts: 7
|
12-02-2009 13:53
From: Kelli May Do you mean you want it to run once if you say start, but can abort it partway if you say stop? Considering the delay specified between each frame of the animation is half a second and the animation is only four frames long the entire sequence is only going to last 2 seconds. Hardly enough time to type "stop" and hit enter.  For longer animations the best solution would probably be to use a timer rather than llSleep, which would allow you to interrupt the sequence once it had been started. Seems pointless for an animation this short though.
|
|
Phil Deakins
Prim Savers = low prims
Join date: 17 Jan 2007
Posts: 9,537
|
12-02-2009 13:57
My understanding of the OP is that s/he wants it to start on "start" and just keep on going (looping) until "stop" is issued.
What it is though, I don't know. Like others, I suspect that it's a prim or a texture, and that the word "frame" is misleading. I think "p0" might mean position 0.
|
|
Kelli May
karmakanic
Join date: 7 Oct 2006
Posts: 1,135
|
12-02-2009 13:57
From: Lunacy Flux Considering the delay specified between each frame of the animation is half a second and the animation is only four frames long the entire sequence is only going to last 2 seconds. Hardly enough time to type "stop" and hit enter.  For longer animations the best solution would probably be to use a timer rather than llSleep, which would allow you to interrupt the sequence once it had been started. Seems pointless for an animation this short though. I was wondering that too, but the other option seems to be to have it looping on "start" and stopping on "stop". Which as far as I can tell from the OP's description and looking at the script, it already does.
_____________________
Do worried sheep have nervous ticks?
Karmakanix@Sin-Labs http://slurl.com/secondlife/Circe/170/197/504 Karmakanix on SLX http://www.slexchange.com/modules.php?name=Marketplace&MerchantID=61062
|
|
Nimbus Rau
Salmon pie? Where?
Join date: 15 Apr 2007
Posts: 292
|
12-02-2009 15:17
OK, what that script appears to do (apart from the timer stuff that has already been discussed) is send a series of short messages out to any prims that are linked to the prim containing this script. That's all. On its own, it does nothing that would qualify as "animation". Clearly what's supposed to be going on is that the other prims in the linkset should contain scripts that are listening for these messages, and do something when the message is received. What they do when they get the message could be anything - it depends on what the scripts in the linked prims tell them to do. If you don't have another script to put in the linked prims that is listening for these messages then doing stuff, you're not going to have anything happen, be it animation or anything else.
You'd probably do well to go back to wherever you got this script from and grab a copy of the other scripts that presumably come with it to control the linked prims. (The other option, of course, is writing such a script yourself to do what you want done, but I'm guessing that you're not really fluent in LSL, based on the OP.) Depending on what kind of animation you're after (animating textures on a prim? getting the prims to move? playing an animation for an avatar poseball-fashion?) you may find that there are other scripts freely available that will do what you want better than this one will, but it's hard to know based on the information you've given us so far. If you could specify exactly *what* it is you're hoping to animate, and how, it would help a lot.
|
|
Lunacy Flux
Registered User
Join date: 8 Oct 2009
Posts: 7
|
12-02-2009 15:22
From: Vengeance Ethaniel Is there any way to remove that loop From: Phil Deakins My understanding of the OP is that s/he wants it to start on "start" and just keep on going (looping) I think that the confusion here is probably just down to the OP not considering that stopping the animation wouldn't be an issue after removing the 'loop' from the script. Asking "Is there any way to remove that loop so that it just activates when i say start?" probably would have been a lot clearer. However when dealing with longer sequences where a stop function could be useful a script like this would probably work: integer total_frames = 12; //Change this to total frames/positions/states in animation sequence integer frame = 0; float delay=0.5; reset_anim(){ frame = 0; llMessageLinked(LINK_SET,2,"p0",""  ; llSetTimerEvent(0); } default{ on_rez(integer r){llResetScript();} state_entry(){ reset_anim(); llListen(0,"",llGetOwner(),""  ; } listen(integer c,string n,key id,string m){ if(m=="start"  llSetTimerEvent(delay); else if(m=="stop"  { reset_anim(); } } timer(){ frame++; if (frame < total_frames) llMessageLinked(LINK_SET,2,"p"+(string)frame,""  ; else reset_anim(); } } (Haven't been in world to try compiling or running it but it should at least point the OP in the right direction if that's what they're looking for  )
|
|
Lunacy Flux
Registered User
Join date: 8 Oct 2009
Posts: 7
|
12-02-2009 15:31
From: Nimbus Rau ... You'd probably do well to go back to wherever you got this script from and grab a copy of the other scripts that presumably come with it to control the linked prims. (The other option, of course, is writing such a script yourself to do what you want ... Though your point is an excellent one and well worth remembering if using Puppeteer or one of the other prim-animation systems/scripts in SL I think the OP has already got that far, as he mentions initially that From: Vengeance Ethaniel I do have the script but the animation continues to loop until i say the stop word. which suggests that he has the animation working but just needs it to stop looping.
|
|
ArchTx Edo
Mystic/Artist/Architect
Join date: 13 Feb 2005
Posts: 1,993
|
12-02-2009 15:59
From: Vengeance Ethaniel Okay i've made an animation but i'd like it to be chat activated. I do have the script but the animation continues to loop until i say the stop word. Here is the script: float delay=0.5; default { on_rez(integer r){llResetScript();} state_entry(){ llMessageLinked(LINK_SET,2,"p0",""  ; //Start is at frame 0 llListen(0,"",llGetOwner(),""  ; //**// llListen(0,"","",""  ; } listen(integer c,string n,key id,string m){ if(m=="start"  { llSetTimerEvent(5); //activates ever 5 seconds! } if(m=="stop"  { llSetTimerEvent(0); llMessageLinked(LINK_SET,2,"p0",""  ; //back to frame 0 } } timer() { llMessageLinked(LINK_SET,2,"p1",""  ; llSleep(delay); llMessageLinked(LINK_SET,2,"p2",""  ; llSleep(delay); llMessageLinked(LINK_SET,2,"p3",""  ; llSleep(delay); llMessageLinked(LINK_SET,2,"p0",""  ; //Back to frame 0 } } //Say "start" to start the timer loop! "stop" to stop it. ///This is an example script that runs when you talk to the object. //it runs only 4 frames, you can easily add as many as you like. //if you want this to listen to everyone,, remove the "//**//" on line 7. Is there any way to remove that loop so that it just activates and de-activates when i say start and stop? Thanks a lot. What the F*** is wrong with you? There is a seperate SCRIPTING forum for posting questions about scripts. What part of that do you not understand?
_____________________
 VRchitecture Model Homes at http://slurl.com/secondlife/Shona/60/220/30 http://www.slexchange.com/modules.php?name=Marketplace&MerchantID=2240 http://shop.onrez.com/Archtx_Edo
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
12-02-2009 18:17
From: ArchTx Edo What the F*** is wrong with you? There is a seperate SCRIPTING forum for posting questions about scripts. What part of that do you not understand? yeah, that (plus you get much quicker and more thorough answers about scripting there) PS please for the love of all that is holy use php tags and proper indentation
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|