Jump to content

Axe/Weapon script with multiple slash animations? In need of help


kayla Mekanic
 Share

You are about to reply to a thread that has been inactive for 3743 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hello, I have been using a free weapon script and it is pretty old. It seems as if it lets you have more than one swing animation. I've been trying to get this to work but no luck. It only plays the first animation (EaxeSwing1) and wont switch to the others with each swing. Does anyone know what's wrong with the script and why it won't cycle through the animations? Sorry I'm still a novice at scripting :P

 

The original Script was made by John Linden, I my version is a little big different i think. Here is where you can find the original script.

http://www.free-lsl-scripts.com/cgi/freescripts.plx?ID=863

 

This is the version of the script that I'm trying to fix:

 

integer gAttachPart = ATTACH_RHAND;
vector rez_pos = <0., 0.0, 0.0>;
float height_offset;


integer gDesiredPerm;
//  Indicates whether wearer has yet given permission 
integer gHavePermissions;

// Bullet travel speed
float   gBulletSpeed = 12.0;

// when we last fired a shot
float   gLastFireTime = 0.01;
// how long it takes to reload when tapping 
float   gTapReloadTime = 0.01;
// how long it takes to reload when holding
float   gHoldReloadTime = 0.03;
//the sword animation being used
integer swings;
string anim = "2hand - attack3";
vector  gEyeOffset = <0.0, 0.0, 0.75>;
key owner;




// the gun has only one state

default
{
    on_rez(integer start_param)
    {
         swings = 0;
         anim = "2hand - attack3";
        vector size = llGetAgentSize(llGetOwner());
        gEyeOffset.z = gEyeOffset.z * (size.z / 2.0);
        llListen(0,"",llGetOwner(),"");
        
        
        
        
        
    }
    listen(integer channel,string name, key id, string message)
    {
      if(message=="Dual Mode")
        {
            llStartAnimation("3");  
        }
        if(message=="Heavy Mode")
        {
            llStartAnimation("4");
        }
        if(message=="Normal Mode")
        {
            llStopAnimation("2");
        }
        if(message=="Rest")
        {
            llStartAnimation("1");
        }
    }
        

    state_entry()
    {
      
        gHavePermissions = FALSE;
        // this should be initialized directly with the variable 
        // but I can't do that due to a bug
        gDesiredPerm = (PERMISSION_TAKE_CONTROLS
                        | PERMISSION_TRIGGER_ANIMATION);
                         
        // Start with a full clip
       
        llResetTime();
    }

    // the player has touched us (left-clicked)    
    // give direction
    touch_start(integer tnum)
    {
        
        
        // Guns only work for their owner
        if ( llDetectedKey(0) == llGetOwner() )
        {
            if ( gHavePermissions )
            {
                
            } else
            {
                
            }
        } else
        {
            // Not the owner
           
        }
    }
    
    // Player attaches us, either by dragging onto self or from pie menu
    attach(key av_key)
    {
        

        if (av_key != NULL_KEY)
        {
            // Can't attach if we don't own it
            if ( av_key != llGetOwner() )
            {
               
                return;
            }
            
            //
            //  Always request permissions on attach, as we may be re-rezzing on login
            llRequestPermissions(av_key, gDesiredPerm);
            
            
            // run_time_permissions() is executed after this call
        } else
        {
           
            
            if ( gHavePermissions )
            {
                // we are being detached
                 llStopAnimation("2hand - attack3");
                 llStopAnimation("2hand - attack3");
                 
                llReleaseControls();
                llSetRot(<0.0, 0.0, 0.0, 1.0>);
                gHavePermissions = FALSE;
            }
        }
    }

    // this is called whenever llRequestPermissions() returns
    // i.e. the user has responded or dismissed the dialog
    // perm is the permissions we now have
    run_time_permissions(integer perm)
    {
     
        
        // see if we now have the permissions we need
        if ( (perm & gDesiredPerm) == gDesiredPerm )
        {
           
    
            // we got the permissions we asked for
            gHavePermissions = TRUE;
            llTakeControls(CONTROL_ML_LBUTTON, TRUE, FALSE);
           
        } else
        {
            
            
            // we didn't get them, kill ourselves
            //llDie();
        }
    }


    // the player has used the controls, process them
    control(key owner, integer level, integer edge)
    {
       
        
        // has our gun reloaded?
        float time = llGetTime();

        // see if av has fired
        // (edge & level) == down edges, (edge & !level) == up edges
        // repeat rate is faster for tapping than holding
        if ( ( ((edge & level) & CONTROL_ML_LBUTTON) 
                && (time > gTapReloadTime) )
           || ( (time > gHoldReloadTime) 
               && (level & CONTROL_ML_LBUTTON) ) )
               
        {
            // if player is out of ammo, must wait for reload
               
                 if(swings = 0)
                {
                 anim = "2hand - attack3";  
                }
                else if(swings = 1)
                {
                 anim = "2hand - attack6"; 
                }
                else if(swings = 2)
                {
                 anim = "2hand - attack2";  
                }
                else if(swings = 3)
                {
                 anim = "EAxeSwing1";
                 swings = 0;
                }
                
                llTriggerSound("slash", 0.6);
                 llStartAnimation(anim);
                llResetTime();  // we fired, set timer back to 0

                
                vector      my_pos = llGetPos() + gEyeOffset;
              
                
                 rotation    my_rot = llGetRot();
                vector      my_fwd = llRot2Fwd(my_rot);

                 llRezObject("meele", 
                    my_pos, 
                    my_fwd * gBulletSpeed,
                    my_rot,
                    1);
                    llRezObject("meele", 
                    my_pos + <0,0,0.15>, 
                    my_fwd * gBulletSpeed,
                    my_rot,
                    1);
                    llRezObject("meele", 
                    my_pos + <0,0,-0.15>, 
                    my_fwd * gBulletSpeed,
                    my_rot,
                    1);
               

                
                
          swings = swings + 1; 
       llStopAnimation(anim);
      // llSleep(3.0);
         
    } // control
}
} // default state

 

This is the part that i'm trying to figure out why its not playing the other swinging animations:

 

 if(swings = 0)
                {
                 anim = "2hand - attack3";  
                }
                else if(swings = 1)
                {
                 anim = "2hand - attack6"; 
                }
                else if(swings = 2)
                {
                 anim = "2hand - attack2";  
                }
                else if(swings = 3)
                {
                 anim = "EAxeSwing1";
                 swings = 0;
                }

 So far it only plays EAxeSwing1 and I can't figure out why it won't cycle through the other animations. Can you help me out?

Link to comment
Share on other sites

Apparently I don't have permission to post this free script that I'm trying to fix a problem with. I've been trying desperately for days to fix it but I can't script for my life. :(  I deleted it because I don't want to get in trouble i just need some quick help.

Link to comment
Share on other sites

What is the reason you can't post it?
If it is published as being public and you reference the source I don't see a problem as long as you post it the way the author wants

:smileysurprised::):smileyvery-happy:

Some rules are made by lawyers for lawyers. If they were to be taken literally, we had no scripts left with more than one instruction. I see the rules as 'catch-all rules' and they will hopefully never be enforced.

  • Like 1
Link to comment
Share on other sites


kayla Mekanic wrote:

Apparently I don't have permission to post this free script that I'm trying to fix a problem with. I've been trying desperately for days to fix it but I can't script for my life.
:(
  I deleted it because I don't want to get in trouble i just need some quick help.

The correct forum for finding people to help with a script you have found on the web is the Wanted or (if you're willing to pay) Inworld Emplyment.

Link to comment
Share on other sites

There's nothing wrong with posting a script here as long as

1.  You wrote the script yourself or

2.  The scripter who created it has given permission to distribute it and you give her/him full credit.

A good way to satisfy condition #2 would be to write something like, "I am using this free script written by Hillary Mason, posted at http://www.hilarymason.com/tag/second-life/ ".  

  • Like 1
Link to comment
Share on other sites

Aha!  You have tripped over a common error.  ( I as going to say a "newbie" error, but we all make the same mistake from time to time.  :smileyembarrassed: )  Each of your if tests in that part of the scripts is written with a single "=" sign instead of the double one that you really intended.  Check the nicely-written discussion of "The =/== Mistakes" in the LSL wiki at http://wiki.secondlife.com/wiki/If

Link to comment
Share on other sites

I like to see the script is back and the OP is given a hand

:smileysurprised::):smileyvery-happy:

Some rules are made by lawyers for lawyers. If they were to be taken literally, we had no scripts left with more than one instruction. I see the rules as 'catch-all rules' and they will hopefully never be enforced. It is unsympathetic and outside the framework of the Forum when a debater rebukes other debaters as if he had authorization to do so

Link to comment
Share on other sites

While respecting people's intellectual property rights, and teaching new scripters to respect these, is obviously very important, I would hate to see people frightened off asking for help here because they get shouted at for making a mistake out of ignorance and experience.   

We don't scold people for not understanding how rotations work (thank heavens, or I'd have given up scripting ages ago and never understood them) and I think we should also be able to explain to people when they get IP issues wrong without making a huge issue of it.

Sometimes we need, after all, to see how the OP has altered the original script -- as in this case -- to see where the problem is.

Link to comment
Share on other sites


Innula Zenovka wrote:

...

Sometimes we need, after all, to see how the OP has altered the original script -- as in this case -- to see where the problem is.

And it should be pointed out that, in this case, a simple link to the script the OP was working on would've sufficed. Which is always the legitimate way of handling any content published elsewhere on the web. But of course that was hashed out back in the mid-nineties, when this was called WWW.

Link to comment
Share on other sites

Now here is a great Mystery.

I don't know the whole history of the LSL Library & Wiki but why a script like this by a Linden is not in the official Wiki I don't know.  (Of course I don't know if the poster in Phaze's Library was an actual Linden, I do understand that).

But what I do know is that many of the early Linden's made textures, wrote scripts, etc, that were available for all Residents to use.  A couple of years ago Shug was working on collecting them all (link).  She specifically names a flame texture by John Linden.

Now the puzzle here is that John Linden does not come up in name search.  Nor is there a Bear for him in the Bear Library.  However, Tim Guest in "Second Lives: A Journey Through Virtual Worlds," published 2008, specifically mentions meeting together with Phillip and John Linden.  So now I'm like, 'who was John Linden?'

But bottom line, getting to my point, any Script, Texture, etc, made by a Linden as a Linden would be the property of Linden Lab and these were as I understood freely available for any Resident to use.  Torley's were probably the best known. 

I do understand still that we would need to be cautious about anything posted outside of Linden Labs domains, etc.  Any one could use any name they chose on those extra terrestrial sites.  You would still be proceeding at your own risk.

Link to comment
Share on other sites

You know that and I know that, but some people don't, and when I think they've made a bona fide mistake through ignorance or inexperience I'll certainly try to draw it to their attention in a way that I hope doesn't scare them off too badly.

For some reason we never seemed in the past to be able to persuade Lindens to stickify anything in this forum, but I'm wondering if we couldn't have another shot, if someone were to draft some guidelines for posters to follow when posting other people's scripts so that they know how to avoid inadvertantly transgressing on someone else's IP.   

  • Like 1
Link to comment
Share on other sites

Don't feel bad.  As Rolig said, we've all us done it, and many of us still do.    It's so easily done, especially when you're tired.

One trick is to try and get into the habit of writing it this way round:

if (0 == swings)

That's because 0 = swings shouldn't compile.   Instead it will complain because you're trying to change the value of 0.  

Link to comment
Share on other sites


Innula Zenovka wrote:

You know that and I know that, but some people don't, and when I think they've made a bona fide mistake through ignorance or inexperience I'll certainly try to draw it to their attention in a way that I hope doesn't scare them off too badly.

For some reason we never seemed in the past to be able to persuade Lindens to stickify anything in this forum, but I'm wondering if we couldn't have another shot, if someone were to draft some guidelines for posters to follow when posting other people's scripts so that they know how to avoid inadvertantly transgressing on someone else's IP.   

Hear hear! I second that...

Link to comment
Share on other sites


LepreKhaun wrote:


Innula Zenovka wrote:

You know that and I know that, but some people don't, and when I think they've made a bona fide mistake through ignorance or inexperience I'll certainly try to draw it to their attention in a way that I hope doesn't scare them off too badly.

For some reason we never seemed in the past to be able to persuade Lindens to stickify anything in this forum, but I'm wondering if we couldn't have another shot, if someone were to draft some guidelines for posters to follow when posting other people's scripts so that they know how to avoid inadvertantly transgressing on someone else's IP.   

Hear hear! I second that...

Unfortuneatly we haven't had a (visible) Community Manager in forever now.  Maybe with Ebbe's move toward transparency that will change.

While there are links to guidlines on the side of the Forum pageI doubt if many people read them.

Back when Lexie was covering the Forum I had suggested a Frequently Asked Questions section where questions that were getting asked over and over again could be covered.  Some questions seem to get asked over and over again. She was very receptive to this but we got a new Mgr who was anything but Resident friendly and now we have no idea what is going on.  It's like the Forums are on auto-pilot.

Innula is right....some people simply do not know.  Also, I doubt if many people actually ever read the TOS.  And on one hand I really don't blame them.  Deciphering all that legal jargon can give anyone a headache.  So I really think no one comes here with the intent of violating copy right.  It just never occurs to them that they may be violating it.

Yes a sticky is very much needed. 

And thank you for that link about John Linden.  It's almost like his name has been stricken from the records in some places. 

 

Link to comment
Share on other sites


Innula Zenovka wrote:

[ .... ]

For some reason we never seemed in the past to be able to persuade Lindens to stickify anything in this forum, but I'm wondering if we couldn't have another shot, if someone were to draft some guidelines for posters to follow when posting other people's scripts so that they know how to avoid inadvertantly transgressing on someone else's IP.   

We don't seem to have a Linden in charge of the forums these days. Notes that I have left on various pages or have sent directly to Lindens who I thought might be in charge have gone unanswered and apparently not even forwarded to whoever is running the show.  (Contrary to popular opinion, forum rank hath no privileges.) The bright side is that the inmates have free rein in this nuthouse, with the mild guiding hand of the moderators.  The downside, of course, is that we are left to talk among ourselves, unable to get a reality check from LL.  The situation invites rumors and demagoguery, or at least benign misinformation. 

The stickies in the ancient forum were my favorite resource as a new creator. I still refer back to them from time to time.  As you say, there are stacks of commonly asked questions in each of the creation forums, and in Answers. The search function here is woefully inadequate, however, so I hardly blame most people for ignoring the archives and simply asking the same questions over and over and over again. And it's no surprise that few people know the "rules".  A sticky revival would be a great idea ...  if only we could figure out who to pitch it to.

Link to comment
Share on other sites


Rolig Loon wrote:


Innula Zenovka wrote:

[ .... ]

For some reason we never seemed in the past to be able to persuade Lindens to stickify anything in this forum, but I'm wondering if we couldn't have another shot, if someone were to draft some guidelines for posters to follow when posting other people's scripts so that they know how to avoid inadvertantly transgressing on someone else's IP.   

We don't seem to have a Linden in charge of the forums these days. Notes that I have left on various pages or have sent directly to Lindens who I thought might be in charge have gone unanswered and apparently not even forwarded to whoever
is
running the show.  (Contrary to popular opinion, forum rank hath no privileges.) The bright side is that the inmates have free rein in this nuthouse, with the mild guiding hand of the moderators.  The downside, of course, is that we are left to talk among ourselves, unable to get a reality check from LL.  The situation invites rumors and demagoguery, or at least benign misinformation. 

The stickies in the ancient forum were my favorite resource as a new creator. I still refer back to them from time to time.  As you say, there are stacks of commonly asked questions in each of the creation forums, and in Answers. The search function here is woefully inadequate, however, so I hardly blame most people for ignoring the archives and simply asking the same questions over and over and over again. And it's no surprise that few people know the "rules".  A sticky revival would be a great idea ...  if only we could figure out who to pitch it to.

With all the different things, that is shortcomings, that Ebbe has found, I'm certain he has had to prioritize things.  He would be the one to make the decision to have an active and visible Community Manager.  I'm certain he had to have gotton a taste of the hooker spam when he was replying here in his welcome thread.  And I know that the shortcomings about the Answers section was brought up.

I wouldn't be surprised if he hasn't asked the question at the Lab, "If we have these Forums, why aren't we using them or how can we use them the best."

Personally speaking, if I were he, I'd be a lot more concerned right now about the Market Place and getting it fixed.  Once they start getting a handle on that then come back and see what can be done to fix things here.

Among other things, the Forum should be a showcase of a Company dealing in a positive manner with it's Customers.

 

 

Link to comment
Share on other sites

Yes, I understand about setting priorities for resource allocation.  I also see that the Lab benefits from having much of the support work handled by experienced volunteers.  We have more practical knowledge about how SL works than most contract employees might, and we are cheaper.  And we offer a layer of deniability, which is not to be sneezed at.  There are many sane reasons for doing as little as possible to rock the boat of the forums.  If I were in charge, I would be very cautious about making dramatic changes.  At the same time, adding stickies to this part of the forums and to Answers feels like a good way to build on what we already offer here ... just by making it more accessible.

Link to comment
Share on other sites


Rolig Loon wrote:

Yes, I understand about setting priorities for resource allocation.  I also see that the Lab benefits from having much of the support work handled by experienced volunteers.  We have more practical knowledge about how SL works than most contract employees might, and we are cheaper.  And we offer a layer of deniability, which is not to be sneezed at.  There are many sane reasons for doing as little as possible to rock the boat of the forums.  If I were in charge, I would be very cautious about making dramatic changes.  At the same time, adding stickies to this part of the forums and to Answers feels like a good way to build on what we already offer here ... just by making it more accessible.

Some of it could be silent support.  Like when someone starts a thread about a griefer object that has not been dealt with after four weeks.  A Linden should have the ability to respond and go take care of it even if they don't say anything.  You know, just get it fixed.

Technical issues are another matter.  This past week we've had an OP in the GD who posted an error message not referenced in the knowledge base.  I flat out asked in Server Updates (the one way I knew for certain it would be seen) what it meant.  With Maestro's permission I have now added his answer to the knowledge base.

Yes I know there is the possibilty that people might think then that Linden's should be answering everything.  But sometimes we really do need their help.

Link to comment
Share on other sites

What advice should we give people who've been handed a script in-world that doesn't contain any obvious indication of the author and they've got a question about it, so they'd like to post it here?   It might be something that started life as a perfectly good utility script that we all have in our inventories and has now been hacked about so much by so many different people who don't really understand what they're doing that it's pretty unrecognisable, or it might be something that the scripter sold full-perms on the understanding it won't be circulated, but has nevertheless got out into the wild, minus headers and licences.   The inexperienced scripter really has no way of knowing.  

I suppose "check the creator and ask him or her about it," but what if the creator doesn't reply or does and says, "Oh, that's a version of something some gave me.   I just copied it into a script of my own while I was trying to combine it with another script someone else gave me" ?  That's clearly what's happened to some scripts I've been asked to fix in the past.

 

 

Link to comment
Share on other sites

I don't know, these things can get kind of murky and muddled at times and a case by case consideration is needed. I just see a pattern of misuse of this forum that ranges from

A. Someone having a great idea, googling a script that does something and coming here with it asking how it might be modified. That case is obvious and definitely belongs in the Wanted forum.

To

C. The user whose first posting on an hour old account is a compilable intermediate level script with no headers that they claim to have been "working on for oh so long" and they're botching an if conditional that they'd be "so grateful for any help on this problem that has been slaved over for days now. kissee kissee". And that should obviously be someone that needs a bit of schooling in ethics because they're lying, pirating someone else's intellectual property and being manipulative to get some free work done on a scrpt that they'll end up selling no mod on the MP. Using us for their own personal scripting puppets.

Through

B. The user that sees A and C getting away with it and decides, well I'd be foolish to pass up that deal. And within that range it isn't so obvious what we're looking at.

 

And it can be difficult to distinguish whether an OP is A, B or C and the most appropriate way to respond to them. The solution I suggest is, make it a rule that if the code already exists on the web, it must be linked to. I fail to see one good reason for copy and pasting from (as irihapeti so eloquently says it) "SL freebie dumpsters" but know of at least a dozen reasons why trashing a forum this way is wrong. If nothing else, it has been the reason forums have been shut down.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3743 days.

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
 Share

×
×
  • Create New...