How can i have scar check if a certain arrow key is pressed, then start a procedure?
How can i have scar check if a certain arrow key is pressed, then start a procedure?
I'm not entirely sure, but I think you can just use:
SCAR Code:begin
if (IsKeyDown(key)) then
blah blah blah.
end;
If not, then I know that you can use:
SCAR Code:begin
if (IsFKeyDown(integer for Fkey)) then
blah blah blah.
end;

IsKeyDown(VK_RIGHT); RIGHT can be RIGHT, LEFT, UP, or DOWN.![]()
yay I was right![]()

I made a case for it, for all the keys, but I accidentally deleted itSowwy </3
By the by, open SCAR, F1. It has taught me a lotFor example,
function IsArrowDown(Num: Byte): Boolean;
Checks if arrow key is down. Num corresponds to 0 = up, 1 = right, 2 = down, 3 = left.
I feel special.
SCAR Code:var
i: Integer;
begin
repeat
for i := 0 to 3 do
if(IsArrowDown(i))then
case i of
0: begin
ClearDebug;
Writeln('Up key is down');
end;
1: begin
ClearDebug;
Writeln('Right key is down');
end;
2: begin
ClearDebug;
Writeln('Down key is down (ha ha ;))');
end;
3: begin
ClearDebug;
Writeln('Left key is down');
end;
end;
until(IsFKeyDown(12));
end.
I'm not liking it because it deletes it and redoes it really fast so it's hard to read, I have an idea though
Oh well, I messed it up too muchYou get the idea though
![]()
Last edited by ian.; 05-02-2009 at 02:09 PM.
99_: Not sure, but I tried one as well...
SCAR Code:{.include srl/srl.scar}
var
i: Integer;
procedure InBetween; //What to do in between keys
begin
while not IsArrowDown(0) or IsArrowDown(1) or IsArrowDown(2) or IsArrowDown(3) do
Wait(10);
end;
procedure WhichArrow;
begin
for i := 0 to 3 do
if(IsArrowDown(i))then
case i of
0: begin
ClearDebug;
WriteLn('Up key is down.');
end;
1: begin
ClearDebug;
WriteLn('Right key is down.');
end;
2: begin
ClearDebug;
WriteLn('Down key is down.');
end;
3: begin
ClearDebug;
WriteLn('Left key is down.');
end;
end;
end;
procedure Looping(TimesToLoop: Integer);
var
Times: Integer;
begin
Times := 0;
repeat
WhichArrow;
InBetween;
Inc(Times);
until((Times = TimesToLoop) or (IsFKeyDown(12)))
end;
procedure MainLoop;
begin
SetupSRL;
Looping(5);
end;
begin
MainLoop;
end.
~Zeek
Last major script: November 2009
Attempted to rejoin: January 2011
Rejoining: [][][][][]
Current task: writing basic alching script

zeeky111, yours doesn't work, sorry.I love that you're learning more though <3
Ha. Crap.
Thanks, though. Any suggestions on why?
~Zeek
Last major script: November 2009
Attempted to rejoin: January 2011
Rejoining: [][][][][]
Current task: writing basic alching script

The InBetween procedure I think?Making other random things like I always do right now, so I'm kinda busy
SCAR Code:var
i, x, T, F: Integer;
begin
repeat
repeat
for i := 0 to 1000000 do
begin
if(RBool)then
begin
Inc(T);
end else
begin
Inc(F);
end;
end;
until(T + F >= 1000000);
Inc(x);
until(x >= 1000000);
Writeln('True: '+IntToStr(T));
Writeln('False: '+IntToStr(F));
end.
Gonna see how random a 50/50 chance is. 1,000,000,000,000,000,000 times. Ha ha ha ha ha
![]()
Last edited by ian.; 05-02-2009 at 03:02 PM.
Kk, no problem.
~Zeek
Last major script: November 2009
Attempted to rejoin: January 2011
Rejoining: [][][][][]
Current task: writing basic alching script

No problemDid you see my edit?
![]()
Ha ha ha.You're right...
Omg, I HAVE to run that.
~Zeek
Last major script: November 2009
Attempted to rejoin: January 2011
Rejoining: [][][][][]
Current task: writing basic alching script

=X This goes extremely slow.. SURPRISINGLY!I am gonna lower it to a trillion instead of a quintillion ha ha
Actually, screw it. I'll trust it being 50/50. Ha ha
True: 47363720
False: 52646280
Last edited by ian.; 05-02-2009 at 03:28 PM.
I ran it for 15 minutes and it still didn't finish so I moved on...
[see attached files]
EDIT: Use at own risk. Can cause SCAR to fully freeze. Filename is a misnomer.
Last edited by zeeky111; 05-02-2009 at 04:26 PM.
~Zeek
Last major script: November 2009
Attempted to rejoin: January 2011
Rejoining: [][][][][]
Current task: writing basic alching script

I feel special now. Ha ha but I guess that's why I got my bear <3 desnob, need anymore help? Add me on MSN
panic._@live.com

Mmkay.![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)