I do this all the time in my scripts... players never like to have a seperate key to DEactivate something when the key to activate it was something else, lol.
Take a look at this:
:state=0,keypressed=49:<do your stuff for activating>,state=1
:state=1,keypressed=0:state=2
:state=2,keypressed=49:<do stuff for deactivating>,state=3
:state=3,keypressed=0:state=0
This will keep the thing from activating/deactivating rapidly while the player holds down the key... it'll wait for them to release it before looking to deactivate.
The only drawback to this is... they can't activate it then deactivate it while holding down other keys. So, if the player was running and wanted to activate and deactive on the fly, it wouldn't go over so well.
But, this is the best I've been able to do since the scripting doesn't allow you to check specific key presses, but instead keypresses as a whole.
It'd be wonderful if they were to have scripting commands that accepted parameters so we could say something like:
:state=0,scancode(49)=1:<activate>,state=1
:state=1,scancode(49)=0:state=2
:state=2,scancode(49)=1:<deactivate>,state=3
:state=3,scancode(49)=0:state=0
.....but we can't.
Good luck with what you're doing!
The one and only,
~PlystirE~
Dammit, Jim! I'm a programmer not a graphic designer!!!