[sldev] Incorporating multiple animations in an object
Dana Moore
dana.virtual at gmail.com
Wed May 23 09:43:02 PDT 2007
Harold and colleagues/
Thanks so much for the gorgeous and succinct script example.
Makes wonderful sense (now that you laid it all out for me :-)
Can't wait for the grid to come back up so I can try it out.
LSL really rox as a domain specific language.
On 5/23/07, Harold Brown <labrat.hb at gmail.com> wrote:
>
> float maxTime = 10; // Maximum time between animation changes
>
>
> // Function to randomly select and play an animation
> function randomAnimation()
> {
> // Get the total number of animations in the inventory
> integer max = llGetInventoryNumber(INVENTORY_ANIMATION);
>
> // Pick a random animation to play
> integer anim = (integer)llFrand(max);
>
> // Start the animation
> llStartAnimation(llGetInventoryName(INVENTORY_ANIMATION,anim));
>
> llSetTimerEvent(llFrand(maxTime));
> }
>
> default()
> {
> state_entry()
> {
> // Do setup code here
> }
>
> changed(integer change)
> {
> if(change & CHANGED_LINK)
> {
> avatar = llAvatarOnSitTarget();
> if(llKey2Name(avatar))
> {
> if(trigger != avatar)
> llRequestPermissions(avatar,
> PERMISSION_TRIGGER_ANIMATION);
> }
> else if(trigger)
> {
> llSetTimerEvent(0);
> if(trigger == llGetPermissionsKey())//right user?
> if(llGetPermissions() &
> PERMISSION_TRIGGER_ANIMATION)//got permissions?
> if(llKey2Name(trigger)) //user in the sim? modern
> permision system makes this last check unnecessary.
> llStopAnimation(animation);
> }
> }
> }
>
> run_time_permissions(integer perm)
> {
> avatar = llAvatarOnSitTarget();
> if(perm & PERMISSION_TRIGGER_ANIMATION && llKey2Name(avatar) != ""
> && avatar == llGetPermissionsKey())
> {
> trigger = avatar;
> llStopAnimation("sit");
> randomAnimation();
> llSetTimerEvent(llFrand(maxTime));
> }
> }
>
> timer()
> {
> randomAnimation();
> }
>
> }
>
>
> On 5/23/07, Dana Moore <dana.virtual at gmail.com> wrote:
>
> > Forgive what is probably a nOOb question, but I have googled for an
> > answer and poked about in the FAQs and can't seem to get this one.
> > Suppose I have a pose ball attached to a chair and I have several
> > individual sit animations.
> > I would like them to fire randomly, and perhaps have a stock sit action
> > to tween.
> > I thought perhaps that simply including them in the content of the pose
> > ball might be all I would need to do (silly me).
> > Perhaps someone with a larger cranial capacity could suggest the right
> > way to do this?
> >
> >
> > Dana Moore
> > Division Scientist
> > BBN Technologies
> > YM: dana_virtual
> > SL: ElectricSheep Expedition
> >
> > _______________________________________________
> > Click here to unsubscribe or manage your list subscription:
> > /index.html
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.secondlife.com/pipermail/sldev/attachments/20070523/b99e1755/attachment-0001.htm
More information about the SLDev
mailing list