Results 1 to 5 of 5

Thread: PressKey is Inputting the Key into the Script Itself

  1. #1
    Join Date
    Aug 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default PressKey is Inputting the Key into the Script Itself

    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.

  2. #2
    Join Date
    Dec 2012
    Posts
    191
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ActivateClient and you also need the SendKeys procedure.

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

  3. #3
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    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.

  4. #4
    Join Date
    Jan 2012
    Posts
    713
    Mentioned
    3 Post(s)
    Quoted
    9 Post(s)

    Default

    I just use this for action keys.
    Simba Code:
    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.
    Simba Code:
    actionkey('1'); // uses 1

  5. #5
    Join Date
    Aug 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •