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 / A little help please..

Author
Message
Maverick
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 19th Oct 2002 01:47
Ok I figured out my little notepad problem using the SCANCODE() command I was able to Get The keys to write on the screen The problem I am running into now is that the program runs way to fast. If you press the key once it records it 10 or 12 times instead of once. I tried the sleep,wait,suspend for key and wait commands to slow it down or wait for a key then record it but when i use the suspend/wait for key it wont register the key that was pushed. Anyways here is the code any ideas would be appreciated!

Zed
21
Years of Service
User Offline
Joined: 20th Sep 2002
Location:
Posted: 19th Oct 2002 02:02
Just do something like this

T=timer()+100
do
if timer()>=T
T=timer()+100
.
.
rest of code
.
.
endif
loop

Milamber
21
Years of Service
User Offline
Joined: 27th Sep 2002
Location: Australia
Posted: 19th Oct 2002 11:00
Or:
do
IF scancode()<>scode OR count>100
count=0
.
.
rest of code
.
.
endif
scode=scancode()
count=count+1
loop

This has the advantage of only stopping the one key from being registered for a while, not all the keys.

System Specs: AMD Athlon 1700+ XP, GA-7VRX motherboard, 128MB DDR RAM, GeForce2 MX400 64MB VRAM
indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 19th Oct 2002 12:44
Marc F. who manages

www.dbheaven.com

has a good article on the subject.

http://www.dbheaven.com/thebook/chapter05.php

he also dropped a groovy timed input snippet on the RGT boards ages ago. You might like to ask him for a copy.


Im using it in DT for my RPG game and I can also access secret commands in my game with its method.


basically

in the main loop detect its usage



then in this example i used a gosub to do the actual work




and the secret word gosub ill leave hidden as its not a requirement here so remove that gosub call.

I will show u one secret command so u know how it would be setup

its not in a gosub so replace the call with this component

` wolf easter egg
if finaltext$ = "wolf"
finaltext$ = "looks like a fullmoon tonight"
play sound 4
endif

naturally u can play sounds or report back text or do anything really.

and thats it in a nutshell.

clear as mud? good

http://www.lunarpixel.com/ is my new site
indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 19th Oct 2002 12:44
the scancodes are f4 and f5 in that example also

http://www.lunarpixel.com/ is my new site

Login to post a reply

Server time is: 2024-04-26 10:37:34
Your offset time is: 2024-04-26 10:37:34