Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / Toggle Keyboard keys?

Author
Message
DarkFact
18
Years of Service
User Offline
Joined: 18th Feb 2006
Location:
Posted: 16th Oct 2007 04:42 Edited at: 16th Oct 2007 04:58
Hi guys, I need to know how to toggle a keyboard key in a script. I got my NVG script to work okay, but I have to hit a different key to activate or de-activate it. Any help would be apprciated.

In-Game Video (Link)

~Dave

Phoenix Sentry Programmer
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 16th Oct 2007 08:05 Edited at: 16th Oct 2007 08:06
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:



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:



.....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!!!
DarkFact
18
Years of Service
User Offline
Joined: 18th Feb 2006
Location:
Posted: 16th Oct 2007 22:21 Edited at: 16th Oct 2007 23:27
@PlystirE: Thanks for the help. I'm going to give it a go now.

EDIT: Worked like a charm! Cheers. ~DF

~Dave

Phoenix Sentry Programmer
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 18th Oct 2007 08:30
Glad I could be of some help, DF


The one and only,
~PlystirE~

Dammit, Jim! I'm a programmer not a graphic designer!!!

Login to post a reply

Server time is: 2024-11-23 23:42:09
Your offset time is: 2024-11-23 23:42:09