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.

Code Snippets / [DBP] - Key Switch

Years of Service
User Offline
Joined: 28th Jun 2007
Posted: 22nd Nov 2012 12:22
With this little function you can use keys as a switch.You can use it to open/close windows or activate and deactivate ability or whatever you need with just one key.Replace text lines with your own code.

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
AGK Backer
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 22nd Nov 2012 17:46
There is a much more simple method found inside DarkSource you know...

Does not require DLL calls either... can be achieved using Inkey$() or Keystate() with toggle strings...

DBPro Master
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 22nd Nov 2012 22:13
Two different variables to store the on and off state? No good mate.

Whenever you press a key, just do this:
on = 1 - on

"You're not going crazy. You're going sane in a crazy world!" ~Tick

Login to post a reply

Server time is: 2024-02-26 00:02:16
Your offset time is: 2024-02-26 00:02:16