Jump to content

Recommended Posts

Hi there to everyone.

i am try to found some scipt to make simple dancer in object. Now i will try to explain more...

It try to make my own dacer script and it should looks like that:
1. You wear this object on your avatar.
2. You write in chat "play" or "on".
3. You listen music and you avatar dancing. 

So, i got some code but i am still don't know how to make "silent acept permition animation", cuz when you wear object on avat that asks you about to acept animation.
How much dancers like this i see before they are never ask me about permision and you just write "play" in chat an it works.
Please, help with this code to make silent permistion (and i know this code are not perfect, but i will fix it) 

integer ON = 0;
integer perm;
//string animation = "Dance"; 
string song = "song";

default
{
    on_rez(integer startup)
    {
        llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION);
    }
    state_entry()
    {
        llListen(0,"","","");    
    }
    
    listen(integer perm, string name, key id, string msg)
    {
        if(llGetPermissions()&PERMISSION_TRIGGER_ANIMATION)
        {
        msg = llToLower(msg);
        if (ON == 0 && msg == "on")
        {
            llOwnerSay("in progress");
            ON = 1;
            llSetTimerEvent(2.0);
            llStartAnimation(llGetInventoryName(INVENTORY_ANIMATION,0));   
        }else if(msg == "off")
        {
            llStopSound();
            llStopAnimation("Dance 14");
            llOwnerSay("stoped");
        }
        }
    }
}

Thanks in advance =^_^=

Share this post


Link to post
Share on other sites

There are more knowledgeable scripters in this forum that may help you better, but here is my go at it

First, llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION); should go into an attach(id) handler and check whether it is attached already or not

 attach(key id)
    {
        if (id)     // if it is a valid key and not NULL_KEY
        {
            // request permissions here
        }
        else //no valid id or NULL key, works when detaching the item from avatar too
        {
            //you may want to stop animations in this case
        }
    }

second, you should always use a runtime permission check and never rely on the auto permissions feature for attached and sittable object, similar to this

   run_time_permissions(integer perm)
    {
        if(PERMISSION_TRIGGER_ANIMATION & perm)
        {
            // do something here
// like initializing the listener

        }
    }

  Then perhaps you'd like to use that "integer perm" by defining it from "llGetPermissions()&PERMISSION_TRIGGER_ANIMATION" somewhere in your script
to simplify things... surely the listener has to listen to a channel that you called "perms" and most likely isn't a good idea to use that way, it's just confusing. Set the channel in the global variables area calling it "channel" and use that in the llListen function

http://wiki.secondlife.com/wiki/LlListen

 

Edited by OptimoMaximo
  • Like 2

Share this post


Link to post
Share on other sites
2 hours ago, demon007006 said:

So, i got some code but i am still don't know how to make "silent acept permition animation", cuz when you wear object on avat that asks you about to acept animation.

PERMISSION_TRIGGER_ANIMATION is always granted silently when you sit on or attach an object.  See the table in the LSL wiki at http://wiki.secondlife.com/wiki/LlRequestPermissions

You do still need to llRequestPermissions even though they are granted automatically, of course, but you should not be seeing that request in a dialog box.  In this case, however, you are not requesting permission in an attached or changed event.  You have put the request in an on_rez event, where the script has no way of knowing whether you are sitting on or wearing the object.

Share this post


Link to post
Share on other sites

What she said, plus you might want to look for the old "flashdance" script and take a look at it. It's an older dancer script which is still in use by many people, though a couple of the opening global integers are better as floats... Integers don't handle hundredths of a second very well when trying to compile. <-<;

It's available in several free script repositories online, pretty much unchanged since it was put up, as far as I can tell.

EDIT: And while yes, you could probably use it as-is, you'll still want to make your own. Just use it as a learning tool, it's a bit dated.

Edited by PheebyKatz

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...