Results 1 to 4 of 4

Thread: Keydown/Presskey not working as expected.

  1. #1
    Join Date
    Jun 2007
    Posts
    106
    Mentioned
    1 Post(s)
    Quoted
    33 Post(s)

    Default Keydown/Presskey not working as expected.

    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:

    Simba 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;

  2. #2
    Join Date
    Sep 2014
    Posts
    447
    Mentioned
    10 Post(s)
    Quoted
    203 Post(s)

    Default

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

  3. #3
    Join Date
    Feb 2015
    Location
    Taguig, Philippines
    Posts
    342
    Mentioned
    15 Post(s)
    Quoted
    137 Post(s)

    Default

    Maybe...just maybe...

    Simba Code:
    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;

  4. #4
    Join Date
    Jun 2007
    Posts
    106
    Mentioned
    1 Post(s)
    Quoted
    33 Post(s)

    Default

    Quote Originally Posted by renzanity View Post
    Maybe...just maybe...

    Simba Code:
    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;
    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.

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
  •