SRL Archive - Non-RuneScape Scripts

Keydown/Presskey not working as expected.


anoobis

2015-04-04 19:35:34

Hey guys I'm making my first attempt to use simba outside of RS and am having a little trouble with input.

The idea is that when the script no longer finds a color it presses 'f' (an in game action).
To my confusion, when the virtual f key is pressed the action is NOT performed. It DOES, however, type an 'f' into the game's chatbox if I open it while the program is running.

If anyone has ideas I'd love to hear them thanks, and here's the code:

procedure fish;
begin
repeat
wait(4000);
keydown(70);
wait(30 + random(50));
keyup(70);
wait(2000);
if FindColorSpiralTolerance(center.X,center.Y,color,boxStart.x,boxStart.y,boxEnd.x,boxEnd.y,tolerance) then
begin
writeln('Found the color');
while FindColorSpiralTolerance(center.X,center.Y,color,boxStart.x,boxStart.y,boxEnd.x,boxEnd.y,tolerance) do
wait(50);
wait(500);
keydown(70);
wait(30 + random(50));;
keyup(70);
end;
until(false);
end;

yourule97

2015-04-05 11:27:12

Try typesend maybe? I'm not entirely sure of the differences, but its worth a shot.

Renzanity

2015-04-05 12:12:56

Maybe…just maybe…
[SPOILER= ]

procedure fish;
begin
repeat
wait(4000);
typeByte(VK_F); //This function types in a character once
wait(2000);
if FindColorSpiralTolerance(center.X,center.Y,color,boxStart.x,boxStart.y,boxEnd.x,boxEnd.y,tolerance) then
begin
writeln('Found the color');
while FindColorSpiralTolerance(center.X,center.Y,color,boxStart.x,boxStart.y,boxEnd.x,boxEnd.y,tolerance) do
wait(50);
wait(500);
typeByteWait(VK_F, 30 + random(50)); //This is the same function but with a waitTime
end;
until(false);
end;
[/SPOILER]

anoobis

2015-04-05 12:54:24

From: renzanity
Maybe…just maybe…
[SPOILER= ]

procedure fish;
begin
repeat
wait(4000);
typeByte(VK_F); //This function types in a character once
wait(2000);
if FindColorSpiralTolerance(center.X,center.Y,color,boxStart.x,boxStart.y,boxEnd.x,boxEnd.y,tolerance) then
begin
writeln('Found the color');
while FindColorSpiralTolerance(center.X,center.Y,color,boxStart.x,boxStart.y,boxEnd.x,boxEnd.y,tolerance) do
wait(50);
wait(500);
typeByteWait(VK_F, 30 + random(50)); //This is the same function but with a waitTime
end;
until(false);
end;
[/SPOILER]


Yeah I checked out typebyte since I know FTab produces non typed actions in RS; unfortunately it just uses keydown/up. I was able to make the program run by rebinding the action to left mouse to use with simbas click functions which work, but I'm still looking for what would cause this issue for future reference.