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 / question about input

Author
Message
ZioNz
21
Years of Service
User Offline
Joined: 4th Sep 2003
Location:
Posted: 18th Nov 2003 05:13
Its possible to detect when a key is pressed and do something only 1 time for each keypress i mean for ex: when you press enter shot, but only once , not continous. I'm using timers right now but i think there should be another way.

-
Xander
21
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 18th Nov 2003 05:33
for example (this is not really code, just an example routine)

**************************
buttondown=0

do

if returnkey()=1 and buttondown=0
buttondown=1
(action stuff)
else
buttondown=0
endif

loop
***********************
this should work, good luck

Xander - Bolt Software

Why do the antagonists always have to look so cool?
ZioNz
21
Years of Service
User Offline
Joined: 4th Sep 2003
Location:
Posted: 18th Nov 2003 05:48
Hi, i tryed your code Bolt , but i can hold returnkey pressed and the code runs continously...

this is the code:

pressed=0
do

if scancode()=78 and pressed=0
pressed=1
SET MATRIX HEIGHT 1, posx, posz, get matrix height(1,posx,posz)+10
update matrix 1
else
pressed=0
endif

sync
loop

-
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 18th Nov 2003 13:59
waitup=20

do
dec waitup

if waitup<0
If returnkey()=1 : waitup=20
shoot code here
endif
endif

loop


Dont forget to Join the Forums!
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 18th Nov 2003 17:28 Edited at: 18th Nov 2003 17:34
I use this.



dbpro : p166mmx @ 233 : 256mb : sb 128pci : sis onboard

Login to post a reply

Server time is: 2024-09-21 09:46:36
Your offset time is: 2024-09-21 09:46:36