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.

DarkBASIC Professional Discussion / Command or method to disable keyboard input??

Author
Message
The Slayer
Forum Vice President
16
Years of Service
User Offline
Joined: 9th Nov 2009
Playing: (Hide and) Seek and Destroy on my guitar!
Posted: 18th Jul 2010 22:40
I've been searching for a command in DBPro to disable ALL keys (not just the systemkeys like Esc or Alt + F4, but ALL keys) and I didn't find it (yet).
I thought there was one, but I can't recall which one it was (if any)?
In my BRIXOID game I want to disable the user to press some keys (in this case they are SPACE, CONTOL (left and right) and SHIFT (also left and right) when the new level loads. How can I achieve that? All help is appreciated.

Thanks in advance!

Cheers

Slayer rules!!! Yeaaah, man!
Benjamin
23
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 18th Jul 2010 22:41
Well, why do you need to do that?
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 18th Jul 2010 22:50
If you have a key that normally starts an action and you want to prevent that action from occuring under some circumstances just add another variable to allow for that. IE. Say you use "space" to do "action":



...just add in your extra variable "NoSpace":



Then if you want to disable the "action" just set "NoSpace" to "1".

I hope I'm understanding your question here...

The Slayer
Forum Vice President
16
Years of Service
User Offline
Joined: 9th Nov 2009
Playing: (Hide and) Seek and Destroy on my guitar!
Posted: 18th Jul 2010 22:51 Edited at: 18th Jul 2010 22:52
Well, upon loading each level, a vault slides open (upwards) and reveals the newly created bricks to destroy. But since the game is programmed to launch the ball when those keys are pressed, the ball would already be launched BEFORE the vault is completely hidden. That's why I would need it. Hum, maybe I could add a variable that switches on/off when needed. But I thought that there was a command that disabled keyboard input?

Thanks!

Slayer rules!!! Yeaaah, man!
mo2970
20
Years of Service
User Offline
Joined: 10th Jun 2006
Location:
Posted: 18th Jul 2010 22:55
Maybe try a loop that doesnt take input while loading...
although, i dont think it does anyway... i think if its loading an object it stops everything anyways... ya why would u want to do that?? i guess if you need the player to stand still while something is moving or something..


Deep, into that darkness peering, long i stood there, wondering, fearing, doubting. -Edgar Allen Poe
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 18th Jul 2010 23:14
I think it would be bad practice to disable keyboard input entirely even if it is possible, what if your program crashed at that point and you couldn't get the keyboard working again? Maybe extreme but I'm just saying it's always better to use a 'soft' solution esspecially when there's no extra work involved.

Quote: "i think if its loading an object it stops everything anyways"

It does but I think he's refering to wanting the 'door' to be out of the way before the player can fire, in which case my solution is about the most sensible one you'll get (probably)...

Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 19th Jul 2010 02:01
You can check for no keys being pressed before the start of the level. Once they let go of the keys start the level.



Login to post a reply

Server time is: 2026-07-25 07:54:14
Your offset time is: 2026-07-25 07:54:14