SRL Archive - OSR Help

IsFKeyDown wont work


3Garrett3

2010-06-15 13:56:37


program New;
{.include SRL/SRL.scar}

begin
repeat
wait(25)
until isFKeyDown(10)
Writeln(':)')
end.

This script will never write :) even though I have the f10 key held down.

Does anyone know why it wont work? Is it a simba bug, or some kind of mess up that I don't know about?

Dervish

2010-06-15 14:02:42

I never got it to work on SCAR either, not problem with simba I guess.

Edit : wait, I got it to work using while statement instead of repeat…

Cazax

2010-06-15 14:14:47

IsFKeyDown is true when you press the key, not when it's already pressed(the event of KeyDown and KeyUp, not only KeyDown) so 25 milliseconds is too fast to press a key. Try wait(500) and press F10 many times.

EDIT: Hmm it's not working either…

3Garrett3

2010-06-15 14:16:56

From: Dr D. Dervish
I never got it to work on SCAR either, not problem with simba I guess.

Edit : wait, I got it to work using while statement instead of repeat…


It wont work for me either way.. :\

nielsie95

2010-06-15 14:18:08

Ah, that's a bug in Simba.simba, it should be:


function IsFKeyDown(FKey : integer) : boolean;
begin
if not InRange(FKey,1,12) then
raiseexception(erCustomError,'FKey not in range 1..12');
result := IsKeyDown(VK_F1 + FKey - 1);
end;

For now, you can use IsKeyDown(VK_F10).


From: Cazax
IsFKeyDown is true when you press the key, not when it's already pressed(the event of KeyDown and KeyUp, not only KeyDown) so 25 milliseconds is too fast to press a key. Try wait(500) and press F10 many times.

EDIT: Hmm it's not working either…


No, it's true when the key is down ;)

3Garrett3

2010-06-15 14:22:02

From: nielsie95
Ah, that's a bug in Simba.simba, it should be:


function IsFKeyDown(FKey : integer) : boolean;
begin
if not InRange(FKey,1,12) then
raiseexception(erCustomError,'FKey not in range 1..12');
result := IsKeyDown(VK_F1 + FKey - 1);
end;

For now, you can use IsKeyDown(VK_F10).


I can live without it for a while. It was for debugging purposes, but I can't figure out what I'm debugging anyway yet, so it will have to wait a while.

i luffs yeww

2010-06-15 17:27:51

Also, {$i SRL/SRL.scar}.

(Pointing out the correct way to include SRL/SRL.scar in Pascal. ^^)

3Garrett3

2010-06-15 17:28:49

From: i luffs yeww
Also, {$i SRL/SRL.scar}.

(Pointing out the correct way to include SRL/SRL.scar in Pascal. ^^)


I've known about it, silly. I just don't think it matters, does it?

i luffs yeww

2010-06-15 22:01:35

It's better practice. I'd always suggest doing it.

Also, your signature says "Rediculously." :p

Wanted

2010-06-15 22:03:18

From: i luffs yeww
Also, {$i SRL/SRL.scar}.

(Pointing out the correct way to include SRL/SRL.scar in simba. ^^)


Fixed your post…

nielsie95

2010-06-17 09:35:01

From: IceFire908
Fixed your post…


How would you include it in Pascal then?

But $i isn't better than .include. In fact, if you want SCAR compatibility, you'll have to use .include.

edit: committed.

Wizzup?

2010-06-17 11:48:05

From: IceFire908
Fixed your post…


Try using {.include <FILE>} in Delphi Object Pascal of Free Pascal. He said it correctly.

Still missing the point of your post.

E: Plus, AFAIK, Freddy is moving away from .include as well.