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.

Author
Message
Mickm
18
Years of Service
User Offline
Joined: 22nd Apr 2006
Location: Kingston, ON
Posted: 30th Aug 2006 23:25
How can you get the scan codes ahead of time for a lookup table?

Here is the code I currently have


Online Flash Games and Guides .::. http://www.gamestack.org
Online Notebook .::. http://onlinenotes.gamestack.org
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 31st Aug 2006 00:15
I'm not sure what you mean, but try using scancode().

Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 31st Aug 2006 00:18
Run this in DB

Sync On
repeat
print scancode()
sync
until spacekey()>0


Press any key you want and note down the scancodes.


Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 31st Aug 2006 00:21
Chart attached.

Attachments

Login to view attachments
Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 31st Aug 2006 00:37
I never understood how they came up with 200's


Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 31st Aug 2006 00:42
You mean like the Windows buttons and stuff?

Mickm
18
Years of Service
User Offline
Joined: 22nd Apr 2006
Location: Kingston, ON
Posted: 31st Aug 2006 03:44 Edited at: 31st Aug 2006 03:46
I already know how to get them via USER INPUT.
However i want to make them on the fly programmatically without the user.

And i dont want to have to do


or


What i am wonder is, can you get the scan codes programmically and on the fly.

If not i will make a loopup table with 25 lines

Online Flash Games and Guides .::. http://www.gamestack.org
Online Notebook .::. http://onlinenotes.gamestack.org
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 31st Aug 2006 04:30 Edited at: 31st Aug 2006 04:31
KEYSTATE. Use that. Example:

if Keystate(17) then health=health+1

That'll say that if the W key is pressed, then increase the variable HEALTH.

Mickm
18
Years of Service
User Offline
Joined: 22nd Apr 2006
Location: Kingston, ON
Posted: 31st Aug 2006 05:18 Edited at: 31st Aug 2006 05:25
I guess i am not explaining myself correctly, sorry.

Say I have a UDT array that contains
Character
ImageID
Scan

Now I have a for loop that does the following (not real code)
1. Assigns each Character a letter from A - z ( CHR$(65 - 90) )
2. Assigns each ImageID a number from 1 to 26
3. Assigns each Scan the Scan code of the number.



The reason why I want to do this is because it is easier to use a lookup table like this then having 3 for statments to find out which key was press.

Example
Letter 'Q'
keyboard(17).Character = "Q"
keyboard(17).Code = 16 <-- this i cannot get programmatically
keyboard(17).ImageID = 18


If you can't understand or it cannot be done programmatically i will use 26 statements to do it.

Online Flash Games and Guides .::. http://www.gamestack.org
Online Notebook .::. http://onlinenotes.gamestack.org
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 31st Aug 2006 11:59 Edited at: 31st Aug 2006 12:03
I understand what you are trying to do now, but no, you can't do it 'programmatically'. However, you don't need to write 26 statements either.
Use the pic below to get the scancodes and write them in a DATA statement then use a FOR ... NEXT loop to assign them.



For example:



Mickm
18
Years of Service
User Offline
Joined: 22nd Apr 2006
Location: Kingston, ON
Posted: 31st Aug 2006 16:25
Thanks scraggle for the answer, some times its hard to explain what you need to do in code.

I totally forgot about the DATA thing. Much better than using this function I wrote.



Online Flash Games and Guides .::. http://www.gamestack.org
Online Notebook .::. http://onlinenotes.gamestack.org

Login to post a reply

Server time is: 2024-11-26 11:46:58
Your offset time is: 2024-11-26 11:46:58