The wording of your first question is odd, but the answer to both of them could be the use of states. This involves having a generic local or global variable called "state" which keeps track of whether you are "normal" (walking around or stopped), "sword" (slashing/walking/or spinning with sword), "holding" (holding something above yourself), etc.
Assuming that in the first problem you had was that when you walked around you had Link's walking sprite animation with his holding sprite animation, the use of states would make it so the correct animation would work. For the second problem, having it set up so you could only slash when you are in the "normal" state would solve your issue.
And really though, if there is an issue with doing something in any programming language, just think about it logically - the program only does exactly what you made it to do.