Results 1 to 15 of 15

Thread: Check color at mouse co-ordinates

  1. #1
    Join Date
    Feb 2009
    Posts
    43
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Check color at mouse co-ordinates

    Aggghhhh this is doing my head in! I want to check weather my character is currently mining and I plan to do this by checking the colors at the co-ordinate I just clicked to see if they match the ore color (if they don't then there is no ore left in the rock).

    So far I have this:

    SCAR Code:
    program PhetersWestVarrockClayMiner;
    {.include SRL/SRL.scar}

    var
      ClayTPA : TPointArray;

    procedure MineClay;

    var
      i, x, y :integer;

    begin
      FindColorsSpiralTolerance(MSCx, MSCy, ClayTPA, 5873344, MSx1, MSy1, MSx2, MSy2, 10);

      //Click rock from ClayTPA
      for i := 0 to High(ClayTPA) do
      begin
        MMouse (ClayTPA[i].x, ClayTPA[i].y, 2, 2);
        if (IsUpTextMultiCustom(['ine', 'ocks'])) then
        begin
          GetMousePos(x, y);
          Mouse(x, y, 0, 0, False);
          ChooseOption('Mine');
          break;
        end;
      end;

      //Check if Ore is gone
      begin
        //code that will check if the color at x, y matches the color 5873344 (with tolerance of 10) which is the color that I built ClayTPA from
      end;

    end;

    begin
      SetupSRL;
      ClearDebug;
      MineClay;
    end.

    Thanks

  2. #2
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    it won't work like you want it to because when you click to mine the rock, your character will walk to the rock and the x, y coordinate of the rock changes

  3. #3
    Join Date
    Feb 2009
    Posts
    43
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I didn't think of that.. thanks.

    I guess I'm going to have to download a bunch of mining scripts and figure out how others check if the character is still mining (or if they just add a wait command).

  4. #4
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Quote Originally Posted by Pheter View Post
    I didn't think of that.. thanks.

    I guess I'm going to have to download a bunch of mining scripts and figure out how others check if the character is still mining (or if they just add a wait command).
    some use waits with a text check...the thing that says "you have mined blah".

  5. #5
    Join Date
    Feb 2009
    Posts
    43
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok thanks, I'll look into how to implement that

  6. #6
    Join Date
    Jul 2008
    Location
    England
    Posts
    763
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Couldn't you do:

    SCAR Code:
    var
      x, y: Integer;
     
    begin
      GetMousePos(x, y);
      if GetColor(x, y) = WhateverColour then
      begin
       //Code here
      end;
    end;
    I think that would work, but like mormonman said, when your character moves the x and y position of the colour will be different
    lol

  7. #7
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Use a pickaxe for example then get the co-ords of it, if its not in range of 5 pixels in the char's wielded position, then he's mining

  8. #8
    Join Date
    Mar 2008
    Location
    New Jersey
    Posts
    1,673
    Mentioned
    1 Post(s)
    Quoted
    9 Post(s)

    Default

    you can just call Flag; so you wait until your character get's there, then re-search for the box within certain coordinates, like say +10 pixels to MSCX and MSCY and -10. Then once if you find the ore color, store it and then check if the ore is still at x, y or not.

  9. #9
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    or, you can check the inventory to see if you got the ore or not(just incase some one else is mining the same rock, and he gets it) so your counting doesnt get messed up, and then use the text finding one for a double check, or vis versa or something
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  10. #10
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    Or you could use reflection and use GetAnimation or do what Baked said and use a FindColorInBox

    ~Camo
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  11. #11
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Or you could follow the rock. Repeatedly try and find the colour in a moving box while your char is moving. Thats what i did
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

  12. #12
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Quote Originally Posted by Camo¤Kyle View Post
    Or you could use reflection and use GetAnimation or do what Baked said and use a FindColorInBox

    ~Camo
    if you used relfection why not just check to see if the rock still has ore in it?... that is too easy though(lol)

  13. #13
    Join Date
    Feb 2009
    Posts
    43
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I'm not going to bother with reflection untill I can write scripts well 'the hard way' lol. One potential problem with searching for colors near me untill they disapear is what if I am standing with an ore infront of me and an ore next to me.. won't searching for the colors next to me show both ores? And say someone else was mining the ore next to me and I was mining the ore infront of myself and they got their ore before I got mine.. wouldn't the script think that I have mined my ore because the color has now dissapeared?

  14. #14
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    thats where the inventory checker/ textfinder comes in
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  15. #15
    Join Date
    Feb 2009
    Posts
    43
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ahh right, thanks!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. color coordinates and mouse clickS?
    By droppeD:) in forum OSR Help
    Replies: 5
    Last Post: 12-18-2008, 10:01 PM
  2. mouse clicking on 1 specific bitmap or color
    By mickeymouse in forum OSR Help
    Replies: 7
    Last Post: 12-13-2008, 02:16 AM
  3. Co-ordinates Help Please!
    By Ultra in forum OSR Help
    Replies: 9
    Last Post: 02-27-2008, 01:38 AM
  4. Useing grass color as road color??????
    By ronny.m.p in forum OSR Help
    Replies: 7
    Last Post: 04-28-2007, 09:42 PM

Posting Permissions

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