SRL Archive - OSR Help

Recognizing keypresses?


sleziak

2009-10-30 21:08:52

I want to make a script that when i press (F5) the script would click on the possition I chose like:

Procedure clickhere;
if pressedkey=f5 (Don't have a clue how =) )
then
mouse()
end;

Is that possible?

uncfan1119

2009-10-30 21:57:49


program New;

begin
if (IsFKeyDown(5)) then
begin
writeln('If you held down F5 while starting this');
writeln('Youll see this message');
clickmouse(1,1,true);
end;
end.

Sandstorm

2009-10-30 22:12:42

For a regular key:

IsKeyDown(GetKeyCode('a'));

~Sand

sleziak

2009-10-31 00:38:53

Thanks both of you!

sleziak

2009-10-31 01:39:38

sorry, double

rya

2009-11-02 16:06:08

where as if you do this

program New;

begin
Repeat
if (IsFKeyDown(5)) then
begin
writeln('If you held down F5 ');
writeln('Youll see this message');
clickmouse(1,1,true);
writeln('if you press F4 it ends');
writeln('But you could press f5 as many times as like');
until (IsFKeyDown(4));
end;

end.
Not sure but should work :)

Sandstorm

2009-11-03 08:52:08

Small correction to the above:

program New;

begin
if (IsFKeyDown(5)) then
begin
Repeat
writeln('If you held down F5 ');
writeln('Youll see this message');
clickmouse(1,1,true);
writeln('if you press F4 it ends');
writeln('But you could press f5 as many times as like');
until (IsFKeyDown(4));
end;

end.

You had the open repeat above the begin and the closing until before the end.

~Sand

Gu3st...

2009-11-03 10:02:01

Please avoid using clickmouse(), clickmouse() is afaik ban-able, use mouse() instead :)

Sex

2009-11-03 10:56:42

He never stated it was for RuneScape.

rya

2009-11-03 12:26:11

From: Zyt3x
Please avoid using clickmouse(), clickmouse() is afaik ban-able, use mouse() instead :)


Yea but i was only editting uncfan1119's post

Moloch

2010-04-06 05:21:35

until If IsKeyDown(GetKeyCode('q'))Then
TerminateScript;

Trying to make escape clause. For some reason not working and has been AGES since i've used scar. Not for RS dont worry its for conquer online xD

Sex

2010-04-06 05:29:05

until IsKeyDown(GetKeyCode('q'));

Gu3st...

2010-04-06 08:52:34

IsKeyDown('q'); works

g0tp0t

2010-04-06 09:52:50

yea, scar could use a makeover on this feature though because it is HORRIBLE. scar needs a key press event so that if you press a key at ANY time then scar can see it. right now its limited to the key has to be down when the code gets to a certain point.

i luffs yeww

2010-04-06 10:19:57

That's because there's no multithreading capability in SCAR. I don't think it's possible in Delphi, and it isn't possible in PascalScript, either, as far as I know (what Simba will be using).

Gu3st...

2010-04-06 16:20:24

From: i luffs yeww
That's because there's no multithreading capability in SCAR. I don't think it's possible in Delphi, and it isn't possible in PascalScript, either, as far as I know (what Simba will be using).
It actually is possible. SCAR recognizes if you press CTRL + ALT + S at any point while the script is running

Sex

2010-04-06 16:46:39

I am currently learning VBScript and they have events which fire whenever a key is pressed and things like that. It is very useful.

i luffs yeww

2010-04-06 18:51:02

Didn't even think about that, Zyt3x. But I meant you can't do it during runtime.

Daniel

2010-04-06 22:43:59

From: i luffs yeww
That's because there's no multithreading capability in SCAR. I don't think it's possible in Delphi, and it isn't possible in PascalScript, either, as far as I know (what Simba will be using).

It is possible in Delphi… Multi-threading and hooking is possible.

i luffs yeww

2010-04-07 23:29:19

[QUOTE=Dan's The Man;700221]It is possible in Delphi… Multi-threading and hooking is possible.[/QUOTE]

[QUOTE=i luffs yeww;700142]Didn't even think about that, Zyt3x. But I meant you can't do it during runtime.

wat