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 / Quick question regarding entry via keys and delays and making it so it doesn't keep flicking options on/off when you just try to tap the button once!!!

Author
Message
Someone
20
Years of Service
User Offline
Joined: 22nd Feb 2004
Location: Australia
Posted: 7th Mar 2004 16:12
Uhh, help please?
It's really beginning to bother me...
Surely theres some quick function or somethign so I can have
IF KEYSTATE(59)=1
and it not flicking on/off all the time because I can't hold it for less than 1 60'th of a second each time...

I was going to set up a timer variable to count down a milisecond or something, over a couple syncs, but I figure theres a better way?

Call me Dean.
PC1: 2.0 Ghz AMD Athlon XP - 512 Meg DDR RAM - GeForce FX 5200, PC2: 0.5 Ghz P3 - 256 Meg SD RAM - GeForce2 MX 400, PC3: 2.5 Ghz P4 - 256 Meg DDR RAM - Integrated Video Card
Someone
20
Years of Service
User Offline
Joined: 22nd Feb 2004
Location: Australia
Posted: 7th Mar 2004 16:14
Oops, forgot to mention, I'm using DBC.

& heres the exact code by the way



Call me Dean.
PC1: 2.0 Ghz AMD Athlon XP - 512 Meg DDR RAM - GeForce FX 5200, PC2: 0.5 Ghz P3 - 256 Meg SD RAM - GeForce2 MX 400, PC3: 2.5 Ghz P4 - 256 Meg DDR RAM - Integrated Video Card
Emperor Baal
20
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 7th Mar 2004 16:46
rem At the top of your program
dim Button_Delays(200)


rem in the do loop
for a=1 to 200
if button_delays(a)>0 then button_delays(a)=button_delays(a)-1
next a

IF KEYSTATE(59)=1 and button_delays(59)=0
button_delays(59)=50
IF AltCam=1 THEN AltCam=0 ELSE AltCam=1
ENDIF

Quote: "
UPDATED

Amd 2800+ | 1024mb pc3200 | A7N8eluxe | Ati Radeon 9800PRO 256mb
"
hyrichter
20
Years of Service
User Offline
Joined: 15th Feb 2004
Location: Arizona
Posted: 7th Mar 2004 16:55
Use some code to check if the key is up. Here's an example to show you what I mean.



Hope I helped...
AciDucK
21
Years of Service
User Offline
Joined: 13th Aug 2003
Location:
Posted: 7th Mar 2004 17:14
You can place a loop and do nothing until the user stops pushing the button:

Someone
20
Years of Service
User Offline
Joined: 22nd Feb 2004
Location: Australia
Posted: 7th Mar 2004 17:26
Hyritcher, thats just what I was after, does the job perfectly, thanks.

Call me Dean.
PC1: 2.0 Ghz AMD Athlon XP - 512 Meg DDR RAM - GeForce FX 5200, PC2: 0.5 Ghz P3 - 256 Meg SD RAM - GeForce2 MX 400, PC3: 2.5 Ghz P4 - 256 Meg DDR RAM - Integrated Video Card
Someone
20
Years of Service
User Offline
Joined: 22nd Feb 2004
Location: Australia
Posted: 7th Mar 2004 17:28
err, aki duck's might work better tho.. but wouldn't that cause the entire game to freeze?

Call me Dean.
PC1: 2.0 Ghz AMD Athlon XP - 512 Meg DDR RAM - GeForce FX 5200, PC2: 0.5 Ghz P3 - 256 Meg SD RAM - GeForce2 MX 400, PC3: 2.5 Ghz P4 - 256 Meg DDR RAM - Integrated Video Card
hyrichter
20
Years of Service
User Offline
Joined: 15th Feb 2004
Location: Arizona
Posted: 7th Mar 2004 17:35
Glad I could help.

P.S. It's Hyrichter, not Hyritcher...lol
Saikoro
20
Years of Service
User Offline
Joined: 6th Oct 2003
Location: California
Posted: 7th Mar 2004 17:47 Edited at: 7th Mar 2004 17:47


This is what I use, it works with no problems like freezing.

-Vash the Stampede

Intel Pentium 4 3.0 Ghz 1024MB Ram NVIDIA GeForceFX 5200 128MB 19" LCD DVI Viewsonic

the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 7th Mar 2004 18:44
This is the code I use

DrakeX
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location:
Posted: 8th Mar 2004 05:05
"but wouldn't that cause the entire game to freeze"

yep, which is why it's better to use a method like hyrichter's

athlon xp 2000+ | radeon 9500 pro 128mb | 512MB DDR | winXP pro | DBP 5.1b | B3D 1.85 | VC++ 6
predicted DBP P6 release date: March 28, 2004
DBP has made me bitter.
Dabein
21
Years of Service
User Offline
Joined: 26th Jul 2003
Location:
Posted: 20th Mar 2004 18:21
Hey Hyrichter,

The code you posted works great with very little code needed to be added to my program.

Thanks

I modified it a little bit to be able to include any key press by replacing

if keystate(59) = 0 then keyup = 1


with

if scancode() = 0 then keyup = 1
PowerFang
20
Years of Service
User Offline
Joined: 6th Feb 2004
Location: Australia (But currently in the USA)
Posted: 21st Mar 2004 14:49 Edited at: 21st Mar 2004 14:52
This is a way to do it without hardcoding the number.......

Genesis Rage
20
Years of Service
User Offline
Joined: 5th Oct 2003
Location:
Posted: 22nd Mar 2004 11:12
@PowerFang
wont that only work with the last key pressed?

-many FPS games you are hitting many keys at the same time... so it might not work 100% of the time... you could prolly make it a function, to check a variable (if you have multiple toggles)

-what i use is similar to hyrichter's... but mine was about 12 lines of code... so this is a little better


P4 3.5 GHz HT, 1 GHz FSB, 1 GB PC4000, ATI Radeon 9800XT

Login to post a reply

Server time is: 2024-09-22 03:04:21
Your offset time is: 2024-09-22 03:04:21