Results 1 to 13 of 13

Thread: Color Picker working but Script won't find the color

  1. #1
    Join Date
    May 2016
    Posts
    18
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Question Color Picker working but Script won't find the color

    Hi guys,

    I was searching around the web for some info but I couldn't find any so I thought making a post about it would be easier, maybe more people searching for this solution.

    I'm scripting (not RS) since a year and now got myself a new computer to do that more reliable.

    I'm using an android emulator to work with simba. Now with the color picker I have some problems.

    I can pick the color I want but when I start the script, it won't find any colors. I've tried with the ACA Tool to check if the color picker even finds the "true" color but eventually, it does. The same coords in ACA gives out the same color as in Simba.

    I have a GTX 1050 TI with newest drivers (20.03.2017).

    On my Laptop GTX 850 (or something like that) it's working perfectly. On my PC I've got the same programs, same setting, etc. but it won't find any color. I'm running Windows 7 Ultimate 64 bit with all recent updates on the PC and on Laptop I've only installed SP1 I believe.

    (I also turned off UAC if that helps)


    Simba Code:
    repeat
    wait(100);

    If FindColorSpiralTolerance(x, y, 13026752, 277, 450, 277, 450, 0) then
    begin
    break;
    end

    until(FindColorSpiralTolerance(x, y, 1946367, 285, 60, 342, 99, 0));

    This is just a simple example. It goes into the wait loop but won't come out because it can't find the color.
    Last edited by Shibby; 03-23-2017 at 03:12 PM.

  2. #2
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    6,136
    Mentioned
    28 Post(s)
    Quoted
    17 Post(s)

    Default

    You have set your tolerance (the last argument in the FindColorSpiralTolerance function) to zero (0*). You should experiment with increasing the tolerance to say 10 to start with. If it still doesnt find the color, further increase the tolerance to 20 (never go beyond 150). Try using SRL's FindObject instead. It solves a lot of the spiraltolerance roughness.

    * Colors aren't static in RS. They shift. With Tolerance 0 you only search for this particular color. If you log in and out, this color has changed and is unfindable.
    SRL is a Library of routines made by the SRL community written for the Program Simba.
    We produce Scripts for the game Runescape.

  3. #3
    Join Date
    May 2016
    Posts
    18
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    I will try this, although I'm using Simba for Android games and on my Laptop 0 tolerance is working fine

  4. #4
    Join Date
    Dec 2011
    Posts
    193
    Mentioned
    5 Post(s)
    Quoted
    51 Post(s)

    Default

    First, make sure the script can pull colors correctly, run the following on both machines with the emulator window targeted, the same color should be debugged on both.
    Simba Code:
    Writeln(GetColor(1,1)); //or any coordinate that is in range

    You're using fixed coords for the search area, have you made sure your emulator window is the same dimensions across both machines? If not those coords may not be where you think.

    Edit:
    Also I'd personally write your code like such, looks neater and easier to see the conditional dependencies if they're all in one place. It's still a potetntial infinite loop though, which is generally bad practice. A timer is a good idea.
    Simba Code:
    while (not FindColorSpiralTolerance(x, y, 13026752, 277, 450, 277, 450, 0)) and
          (not FindColorSpiralTolerance(x, y, 1946367, 285, 60, 342, 99, 0)) do
      Wait(100);

    OSRS Color Scripts: Borland_Salamanders | Borland_Iron_Ores
    Utilities & Snippets: [Color] OSBuddy Item Looting

  5. #5
    Join Date
    May 2016
    Posts
    18
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Im using exact coordinates because it's like:

    Repeat refreshing the page until something specific pops up, while other pop ups will get ignored. Exact coords for FindColor were always working fine for me.

    I've tried printing the coords and checked with the color picker.


    Simba Code:
    procedure Test;
    begin
    Writeln(GetColor(290, 377));
    end


     
    Compiled successfully in 405 ms.
    -1
    Successfully executed.

    While Color Picker found Color: Picked colour: 3417617 at (290, 377)

    Looks like when running the script it really doesn't find any color.


    Thanks for the loop, looks way better

  6. #6
    Join Date
    Sep 2014
    Location
    C:\Simba\
    Posts
    565
    Mentioned
    9 Post(s)
    Quoted
    71 Post(s)

    Default

    Does the Android Emulator buffer the colors somehow
    Feel free to ask me any questions, I will do my best to answer them!

    Previously known as YouPee.

  7. #7
    Join Date
    May 2016
    Posts
    18
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by Joopi View Post
    Does the Android Emulator buffer the colors somehow
    I don't think so as it has always worked.

    I'm trying to uninstall SP3 and maybe SP2, hope that helps as said on my laptop it works fine (SP1).

    Must be something with the graphics driver or some net framework or I don't know >_<

  8. #8
    Join Date
    Dec 2011
    Posts
    193
    Mentioned
    5 Post(s)
    Quoted
    51 Post(s)

    Default

    Does the correct color get found when anything other than the emulator window is targeted?

    Try running this, should work with both SRL6 and AL include.

    Simba Code:
    procedure debugClient;
    var
      clientW, clientH: Integer;
    begin
      GetClientDimensions(clientW, clientH);
      debugBitmap(BitmapFromClient(1,1,clientW-1,clientH-1));
    end;

    Try it both with emulator and any other window. If it doesn't display, then Simba is unable to capture your screen. There was a user with this same problem within the last couple weeks. Try and find that thread and see the solution, I can't recall the issue but I think an nVidia driver update was the cause? Don't take my word on it though as I have terrible memory lol, that might have been a different thread on a different site. Try and find the thread if the above doesn't work.

    OSRS Color Scripts: Borland_Salamanders | Borland_Iron_Ores
    Utilities & Snippets: [Color] OSBuddy Item Looting

  9. #9
    Join Date
    May 2016
    Posts
    18
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    This gave it out when trying your code.

    Simba Code:
    Error: Unknown declaration "debugBitmap" at line 12
    Compiling failed
      debugBitmap(BitmapFromClient(0, 0,clientW-407,clientH-677));

    But I really don't know what to do with

    Simba Code:
    (1,1,clientW-1,clientH-1));

  10. #10
    Join Date
    Dec 2011
    Posts
    193
    Mentioned
    5 Post(s)
    Quoted
    51 Post(s)

    Default

    I figured you was using an include, I changed the code to be include independant. Don't change anything, just paste it into an empty Simba tab, target the emulator window (you know what I mean by this?) and then press run.

    If nothing is displayed, target another window (for example this browser window) than press run again.

    Write results here.

    Simba Code:
    procedure debugClient;
    var
      clientW, clientH, bmp: Integer;
    begin
      GetClientDimensions(clientW, clientH);

      clearDebugImg;
      displayDebugImgWindow(clientW, clientH);
      bmp := BitmapFromClient(1,1,clientW-1,clientH-1);
      drawBitmapDebugImg(bmp);
      FreeBitmap(bmp);
    end;

    begin
      debugClient;
    end.

    OSRS Color Scripts: Borland_Salamanders | Borland_Iron_Ores
    Utilities & Snippets: [Color] OSBuddy Item Looting

  11. #11
    Join Date
    May 2016
    Posts
    18
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    IT generates a Bitmap of the target program.


    Capture.jpg
    When I target "all" Windows
    Capture2.jpg
    When I target the Emulator only
    Capture_.jpg
    Original Desktop



    Weird thing is, that I can move the small one without a problem but as soon as I try to drag the big image (see how it's not completely on the screen?) it turns completely black.


    Edit* Uninstalling Windows Service Package didn't help btw








    Edit** When Targetting the windows, it put's out the correct colour. Only not when desktop is target..



    Edit** There must be something with my graphic card or at least it's drivers
    Last edited by Shibby; 03-24-2017 at 09:02 PM.

  12. #12
    Join Date
    May 2016
    Posts
    18
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    For anyone who wants to know:

    Ive updated to Win10 and it worked.

    I somehow blame Win7 for not having DirectX12.

  13. #13
    Join Date
    Apr 2017
    Posts
    31
    Mentioned
    0 Post(s)
    Quoted
    18 Post(s)

    Default

    I'm glad it's not just my bad coding! I'very been having trouble with the find colors too! Always returns 0,0.

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
  •