SRL Archive - Help

PressKey is Inputting the Key into the Script Itself


dai3504

2012-12-17 20:16:48

Hello, I am brand new in this scripting scene and I was attempting to make a small script for this small game I play. I selected the game as the target window and have a line of code that clicks in the game window itself to make sure it's selected before it goes on with the rest of the script.

My script is intended to repeatedly press the 'A' key (The Attack Button), but it is flooding the actual script in Simba with a's instead of pressing the key to attack in-game.

I tried the ActivateClient; function but to no avail.

Does anyone know how I can get Simba to press the 'A' key In-Game and not have it type in it's own script?

Sorry if this is something very simple, If you need more information please let me know.

Slashed

2012-12-17 20:19:46

ActivateClient and you also need the SendKeys procedure.

Something like SendKeys('A', 10, 10);

Ian

2012-12-17 20:20:57

Maybe try using F9 to run the script. Other than that idk, Simba can be annoying about client sometimes. Also You could try adding a wait to the start that gives you time to manually click the window.

Google

2012-12-17 20:22:53

I just use this for action keys.
procedure actionkey(text: string);
var
i: integer;
begin
for i := 1 to length(text) do
begin
{$ifdef simbamajor980}
sendkeys(text[i], 40 + random(40));
{$else}
sendkeys(text[i], 30 + random(30), 30 + random(30));
{$endif}
wait(40 + random(40));
end;
end;

use.
actionkey('1'); // uses 1

dai3504

2012-12-18 17:17:00

Found out that I just had to run Simba in administrator mode, thanks guys!