Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
3 registered members (TedMar, AndrewAMD, fairtrader), 578 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
key detection #137056
06/18/07 18:47
06/18/07 18:47
Joined: Apr 2002
Posts: 224
Twickenham,England
kiamonster Offline OP
Member
kiamonster  Offline OP
Member

Joined: Apr 2002
Posts: 224
Twickenham,England
while (key_any == 0)
{
wait(1);
}

I use the above to wait for a key press.
Is there a way to capture which key is pressed please?

Re: key detection [Re: kiamonster] #137057
06/18/07 18:50
06/18/07 18:50
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
read manual about:
key_for_str
key mapping
key_pressed
key_lastpressed
and key_set (number, function);

cheers

Last edited by tompo; 06/18/07 18:51.

Never say never.
Re: key detection [Re: tompo] #137058
06/18/07 18:59
06/18/07 18:59
Joined: Apr 2002
Posts: 224
Twickenham,England
kiamonster Offline OP
Member
kiamonster  Offline OP
Member

Joined: Apr 2002
Posts: 224
Twickenham,England
Thanks Tompo.
Sadly I still use v5,24,51 ) not ready to limit users to directx 9) so I don't have these nicities. Thanks again thugh.
Just trying scancode.

Last edited by kiamonster; 06/18/07 19:04.
Re: key detection [Re: kiamonster] #137059
06/18/07 21:16
06/18/07 21:16
Joined: Apr 2002
Posts: 224
Twickenham,England
kiamonster Offline OP
Member
kiamonster  Offline OP
Member

Joined: Apr 2002
Posts: 224
Twickenham,England
The solution is:
function ewg_keypress(scancode)
{
str_cpy(newname.string,get_key_string(scancode));
panwait = 2;
}

function ewg_keypress(scancode)
{
.
.

on_anykey=ewg_keypress;
while(key_any == 0)
{
wait(1);
}
on_anykey=null;
.
.
.
}

where get_key_string returns the key pressed

function get_key_string
{
.
.
if(key_var==48) { return("B"); }
.
.
etc
}

Hope this is useful to someone


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1