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.

Newcomers DBPro Corner / ESC Key Help

Author
Message
OneTouch
21
Years of Service
User Offline
Joined: 23rd Jan 2003
Location:
Posted: 17th Feb 2003 20:48
I have this code:

print "Press the spacekey to quit"

SpacePress = spacekey()
if SpacePress = 1
end
endif

I Want it to use the ESC key.
How do I do it?

print "Press the ESC key to quit"

ESCPress = esckey()
if ESCPress = 1
end
endif
need more information on game development,
visit http://www.dtagames.com
OneTouch
21
Years of Service
User Offline
Joined: 23rd Jan 2003
Location:
Posted: 17th Feb 2003 20:53
I took out all the previous codes and used

ENABLE ESCAPEKEY

and it exited to desk top. Is this the correct way?

Will it still exit to desktop when it is compilied as a compleate game?

need more information on game development,
visit http://www.dtagames.com
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 17th Feb 2003 21:37
No. what happened is that you just killed your program.

To detect the escape key in your program you need to use DISABLE ESCAPEKEY.

Make sure that you have another way of stopping your program if you use it though.
Bluedeep
21
Years of Service
User Offline
Joined: 3rd Feb 2003
Location: Finland
Posted: 20th Feb 2003 14:20
And donĀ“t do:
SpacePress = spacekey()
if SpacePress = 1
end
endif

Just do:
if spacekey()=1 then end



Kanzure
21
Years of Service
User Offline
Joined: 19th Feb 2003
Location:
Posted: 20th Feb 2003 14:44
That is much shorter, and I believe (correct me if im wrong) there is an escapekey() functon.

~Morph
Owner of MultiCode.NET.
I know HTML, PHP, Perl, JavaScript, VBScript, Visual Basic, C/C++, QBasic, YaBasic, and now Dark Basic/Pro...
Kanzure
21
Years of Service
User Offline
Joined: 19th Feb 2003
Location:
Posted: 20th Feb 2003 14:45
Never mind..sorry, didn't read the first second half of the first post.. ;

~Morph
Owner of MultiCode.NET.
I know HTML, PHP, Perl, JavaScript, VBScript, Visual Basic, C/C++, QBasic, YaBasic, and now Dark Basic/Pro...

Login to post a reply

Server time is: 2024-09-19 17:18:30
Your offset time is: 2024-09-19 17:18:30