ID:272418
 
How would I make a type of shield that only works when you hold on to the key, and when you let go it stops? This is my code so far.

    Shield()
if(!(usr.shield))
if(usr.canshield)
usr.shield = 1
usr.frozen = 1
usr.can_attack = 1
usr.clash = 1
usr.overlays += 'Shield.dmi'
sleep(75)
if(usr.shield)
usr << "Battle Information: Your shield has broken!"
usr.overlays -= 'Shield.dmi'
usr.frozen = 0
usr.can_attack = 0
usr.clash = 0
usr.shield = 0
usr.canshield = 0
sleep(30)
usr.canshield = 1
return

else
usr.overlays -= 'Shield.dmi'
usr.frozen = 0
usr.can_attack = 0
usr.clash = 0
usr.shield = 0
return
Here's an idea to help you along the way:

Define a macro, one calling a verb when the key is pressed down (not held) and another, same macro key, calling another verb (or the same verb with a different argument) when the key is released.
In response to GhostAnime
Thanks, now I got the shielding system perfected :D.
In response to Element Hero creator
Only problem with this is quickly pressing the shield button twice. Then it stays shielded without holding down the button.