SRL Archive - OSR Help

Help "if Keydown"


linusgr

2010-01-26 13:46:18

Need just a simpel script to se how it work's –> "if keydown" PLZ help

[PHP]program New;
begin
if keydown(1); then
WriteLn('HELP');
end.[/PHP]

Mr. Doctor

2010-01-26 13:49:06

A list of key codes is in my signature.

Edit:


1 - 49

linusgr

2010-01-26 13:59:16

From: Junkj
A list of key codes is in my signature.

Edit:


1 - 49



[PHP]program New;
begin
if keydown(1); THEN
WriteLn('HELP');
end.[/PHP]


this dont work just get error Failed when compiling
Line 3: [Error] (3:14): 'THEN' expected in script

HELP!!

0wn 4 skill

2010-01-26 13:59:47

From: linusgr

program New;
begin
if keydown(1); then
WriteLn('HELP');
end.


You can't use an If/then there because it doesn't return a boolean.

What are you trying to achieve here?

Floor66

2010-01-26 14:00:17

you have to remove the semicolon…

if KeyDown(1) then
begin
//whatever
end;

0wn 4 skill

2010-01-26 14:03:43

From: Floor66
you have to remove the semicolon…

if KeyDown(1) then
begin
//whatever
end;


Floor, the KeyDown procedure doesn't return a boolean so he can't use the If/Then statement there.

Linusgr, are you trying to make it so that the script recognises that you have depressed a button?

linusgr

2010-01-26 14:04:17

[PHP]program New;
begin
if KeyDown(1) then
begin
WriteLn('HELP');
end.
[/PHP]

Get error –> Failed when compiling
Line 2: [Error] (2:15): Type mismatch in script

I am trying to get so wenn i prees 1 then it write help as u see

0wn 4 skill

2010-01-26 14:09:11

program New;

begin
Repeat
If IsFKeyDown(1) then
Begin
Writeln('Help');
TerminateScript;
end;
until(false);
end.

Press play and then F1 on your keyboard :)

Thanks!

Mr. Doctor

2010-01-26 14:21:14

All numbers/letters have different codes.

Look at the list of KeyCodes in my signature to find out the right number.

Edit: woops, silly me. But all characters do have a certain code.

Gu3st...

2010-01-26 14:24:30

The function you are looking for is "IsKeyDown()" :)