SRL Archive - General

Command Question - No Flame


Phaded

2009-08-15 02:48:30

Don't you flame me.

I google'd
I looked through two tutorials
and two SCAR manuals.

But..
Wtf is the command to get scar to press the arrow keys?!

Shuttleu

2009-08-15 02:50:25

VK_LEFT
VK_RIGHT
VK_UP
VK_DOWN

i think

~shut

Phaded

2009-08-15 03:01:17

Okay, I used the commands. It says it compiles, it says it runs. But the commands aren't being put into action?

Shuttleu

2009-08-15 03:02:14

how are you using them?

~shut

Janilabo

2009-08-15 03:23:22

Left Arrow - 37
Up Arrow - 38
Right Arrow - 39
Down Arrow - 40

eg.

KeyDown(40); // down arrow - down!
KeyUp(40); // down arrow - up!

Shuttleu

2009-08-15 03:25:43

From: Janilabo
Left Arrow - 37
Up Arrow - 38
Right Arrow - 39
Down Arrow - 40

eg.

KeyDown(40); // down arrow - down!
KeyUp(40); // down arrow - up!


dont use numbers
it will get confuzzleing
if you do
KeyDown(VK_DOWN);
KeyUp(VK_DOWN);
then it will do the same and be easier to read

~shut

Janilabo

2009-08-15 03:32:24

Well, I agree with you Shut, but not totally, as there aint constants set for every single key.
That's the reason I am used to the numbers instead. But yeah, it's matter of taste, really.. :p

Anyways, HERE is useful listing of KeyCodes (by KyleGut3 from the "good ol' times" ;))

bullzeye95

2009-08-15 05:55:35

From: Janilabo
Well, I agree with you Shut, but not totally, as there aint constants set for every single key.


No, but there are for pretty much every key you'd ever need, other than numbers and letters, in which case you could do something like: KeyDown(GetKeyCode('a'));

cycrosism

2009-08-16 04:27:08

No, this wont work

KeyDown(40); // down arrow - down!
KeyUp(40); // down arrow - up!

It will click it too fast you need to do something like

KeyDown(40); // down arrow - down!
Wait(100+random(100));
KeyUp(40); // down arrow - up!

Janilabo

2009-08-16 04:47:15

From: cycrosism
No, this wont work

KeyDown(40); // down arrow - down!
KeyUp(40); // down arrow - up!

It will click it too fast you need to do something like

KeyDown(40); // down arrow - down!
Wait(100+random(100));
KeyUp(40); // down arrow - up!
Hmmm.. Works fine for me? (with Notepad/Word/SCAR's editor part…)
Sure, it doesn't work for RuneScape or other games (& it SHOULD NOT be used for RuneScape/other games!), but it was only a small example. :)
That's why I didn't include mainloop for it, either..

But, you are right, it's good to add the [random] wait between the commands!

Laur€ns

2009-08-16 14:49:53

SendArrow(0); : Up
SendArrow(1); : Right
.. (2); : Down
.. (3); : Left

:)