I was just thinking one day and though, it would be fun to make some more commands for DB. So I sat down and though about commands that
I could make that would be simple to use, and would help us all. I instantly knew of something. MORE **key() commands. YOu know such as, returnkey() and what not. So I wanted to know if ANYONE would wnat to use it. It would be easier to use than a scancode command because, you don't have to remember any numbers on the keyboard. And the inkey command, you don't have to type as much to find out what letter it is using. You don't have to make it lower or Higher. Here is a sample code using my function so far. It only has the a key and b key (upper lower and both) and the both of the return keys. Have a look:
` use the dim arrays to call the commands you will use to see if the keys are being presses.
dim akey(2)
dim bkey(2)
dim ckey(2)
dim returnkeys(0)
do
cls
lettercomm()
print "Both ";akey(0); " Lower ";akey(1); " Upper ";akey(2)
print "Both ";bkey(0); " Lower ";bkey(1); " Upper ";bkey(2)
if returnkeys(0)=1 then print "Hello World, One Of The Enter Keys Have Been Pressed"
sync
loop
Here is the actual code that does the real work:
function lettercomm()
dim akey(2)
dim bkey(2)
dim ckey(2)
dim returnkeys(0)
if inkey$()="a"
akey(0)=1
akey(1)=1
endif
if inkey$()="A"
akey(0)=1
akey(2)=1
endif
if inkey$()="b"
bkey(0)=1
bkey(1)=1
endif
if inkey$()="B"
bkey(0)=1
bkey(2)=1
endif
if returnkey()=1 or scancode()=156
returnkeys(0)=1
endif
endfunction
If you want more detail, let me know. I think this code explains quite a bit though.
------------------------
Visit my website of Games!
http://dabip.stonerocket.net