Results 1 to 13 of 13

Thread: make it search for 2 colors near another

  1. #1
    Join Date
    Jul 2007
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default make it search for 2 colors near another

    doing my first useful script. I decided to make it to do the Distilling puzzle on Puzzle pirates, i am trying to figure out how to make it look for one color first, and if it doesn't find it, look for the second one. after it finds the color it has to click though. I'm completely new to this but heres the script so far.

    SCAR Code:
    program Distillery;//By RaptorBlaze(my first script w00t)
    var
    a,b,x,y,c,d: Integer;//a,b=left piece coords, x,y=higher right piece coords c,d=lower right piece coords
    procedure moveright
    begin
    activateclient;
    findcolor(a,b;12645373,0,0,899,1439)
    findcolor(x,y;8829120,a,b,a+40,b<y)
    findcolor(c,d;4245488,a,b,a-40,b>d)


    end.
    I'm thinking i need to use only x,y for the right piece's coords but I'm a bit confused what to do. it will eventually click on the first color (a,b) then on the second color. the goal is simply to move as many pieces the color 12645373 as far right as possible

  2. #2
    Join Date
    Apr 2007
    Location
    Michigan -.-
    Posts
    1,357
    Mentioned
    2 Post(s)
    Quoted
    4 Post(s)

    Default

    you could try something like this:

    SCAR Code:
    begin
      repeat
        if (FindColor(a,b,YOURCOLOR,YOURCOORDS)) then
          Mouse(x,y,2,2,True);
          if(FindColor(a,b,YOURCOLOR,YOURCOORDS))then
            Mouse(x,y,2,2,True);
             if(FindColor(c,d,YOURCOLOR,YOURCOORDS))then
               Mouse(c,d,2,2,True);
      until(whatever is finished)
    end;
    METAL HEAD FOR LIFE!!!

  3. #3
    Join Date
    Jul 2007
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    if (FindColor(a,b,YOURCOLOR,YOURCOORDS)) then
          Mouse(x,y,2,2,True);
          if(FindColor(a,b,YOURCOLOR,YOURCOORDS))then
            Mouse(x,y,2,2,True);
             if(FindColor(c,d,YOURCOLOR,YOURCOORDS))then
               Mouse(c,d,2,2,True);
      until(x)
    mmm maybe, but i want the third findcolor function to run if the second one fails...so maybe
    SCAR Code:
    if (FindColor(a,b,YOURCOLOR,YOURCOORDS)) then
          Mouse(x,y,2,2,True);
          if(FindColor(a,b,YOURCOLOR,YOURCOORDS))then
            Mouse(x,y,2,2,True);
          end else
             if(FindColor(c,d,YOURCOLOR,YOURCOORDS))then
               Mouse(c,d,2,2,True);
            end
      until(x)
    hmmm...i hope formulas work lol

  4. #4
    Join Date
    Jun 2007
    Posts
    30
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    /me cheers ^_^

    I maby can't help you with the script

    but I can tell you I can't wait for it to be finished =D

    I get this error: Line 5: [Error] (5:1): Semicolon (';') expected in script

    when I putted the ';' there I get this error: Line 7: [Error] (7:14): comma (',') expected in script

    then I put the comma's at the places it says a error (also at line 8 and 9) then I get: Line 9: [Error] (9:1): Type mismatch in script

  5. #5
    Join Date
    Sep 2007
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    are you still working on this script?

  6. #6
    Join Date
    Aug 2007
    Location
    England
    Posts
    734
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    you might be better offf putting it in elses
    SCAR Code:
    begin
      repeat
          if (FindColor(a,b,YOURCOLOR,YOURCOORDS)) then
          begin
            Mouse(x,y,2,2,True);
          end else
          begin
              if(FindColor(a,b,YOURCOLOR,YOURCOORDS))then
              begin
                Mouse(x,y,2,2,True);
              end else
              begin
                  if(FindColor(c,d,YOURCOLOR,YOURCOORDS))then
                    Mouse(c,d,2,2,True);
              end;
          end;
      until(whatever is finished)
    end;
    The truth finally came out...


  7. #7
    Join Date
    Sep 2007
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ty

  8. #8
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    You could make a dtm:
    http://www.villavu.com/forum/showthread.php?t=564
    It would be a lot easier.
    Ask me for more help w/ DTMS on that thread if you need.
    Mind telling us what your you trying to find?

  9. #9
    Join Date
    Aug 2008
    Posts
    9
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Does this script need to be updated? I get some errors at line 14 of mismatch
    SCAR Code:
    program Distillery;//By RaptorBlaze(my first script w00t)
    {.include SRL/SRL.scar}

    var
    a,b,x,y,c,d: Integer;//a,b=left piece coords, x,y=higher right piece coords c,d=lower right piece coords
    procedure moveright;
    begin
      repeat
          if (FindColor(a,b,12645373,0,0,899,1439)) then
          begin
            Mouse(a,b,2,2,True);
          end else
          begin
              if(FindColor(x,y,8829120,a,b,a+40,b<y))then
              begin
                Mouse(x,y,2,2,True);
              end else
              begin
                  if(FindColor(c,d,4245488,a,b,a-40,b>d))then
                    Mouse(c,d,2,2,True);
              end;
          end;
      until(s)
    end;

    Sorry for bump =x Thought that these scripts should be finished haha

  10. #10
    Join Date
    Feb 2007
    Location
    Estonia.
    Posts
    1,938
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by swiftplayer View Post
    Does this script need to be updated? I get some errors at line 14 of mismatch
    SCAR Code:
    program Distillery;//By RaptorBlaze(my first script w00t)
    {.include SRL/SRL.scar}

    var
    a,b,x,y,c,d: Integer;//a,b=left piece coords, x,y=higher right piece coords c,d=lower right piece coords
    procedure moveright;
    begin
      repeat
          if (FindColor(a,b,12645373,0,0,899,1439)) then
          begin
            Mouse(a,b,2,2,True);
          end else
          begin
              if(FindColor(x,y,8829120,a,b,a+40,b<y))then
              begin
                Mouse(x,y,2,2,True);
              end else
              begin
                  if(FindColor(c,d,4245488,a,b,a-40,b>d))then
                    Mouse(c,d,2,2,True);
              end;
          end;
      until(s)
    end;

    Sorry for bump =x Thought that these scripts should be finished haha
    You have included SRL, but don't forget to call SetupSRL in the main loop ,
    Well i fixed some things up , Well , you can't use coord like y<x
    SCAR Code:
    program Distillery; //By RaptorBlaze(my first script w00t)
    {.include SRL/SRL.scar}

    var
      a, b, x, y, c, d: Integer; //a,b=left piece coords, x,y=higher right piece coords c,d=lower right piece coords

    procedure moveright;
    begin
      repeat
        if (FindColor(a, b, 12645373, 0, 0, 899, 1439)) then
        begin
          Mouse(a, b, 2, 2, True);
        end
        else
        begin
          if (FindColor(x, y, 8829120, a, b, a + 40, y)) then
          begin
            Mouse(x, y, 2, 2, True);
          end
          else
          begin
            if (FindColor(c, d, 4245488, a, b, a - 40, d)) then
              Mouse(c, d, 2, 2, True);
          end;
        end;
      until (s)
    end;
    ~Eerik~

  11. #11
    Join Date
    Aug 2008
    Posts
    9
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ty, but getting Unknown identifier 's' online 26

    I tried changing it to until until(iskeydown('s'))

    then get Unexpected end of file in script

  12. #12
    Join Date
    Feb 2007
    Location
    Estonia.
    Posts
    1,938
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Try this:
    SCAR Code:
    program Distillery; //By RaptorBlaze(my first script w00t)
    {.include SRL/SRL.scar}

    var
      a, b, x, y, c, d: Integer; //a,b=left piece coords, x,y=higher right piece coords c,d=lower right piece coords

    procedure moveright;

    begin
      repeat
        if (FindColor(a, b, 12645373, 0, 0, 899, 1439)) then
        begin
          Mouse(a, b, 2, 2, True);
        end
        else
        begin
          if (FindColor(x, y, 8829120, a, b, a + 40, y)) then
          begin
            Mouse(x, y, 2, 2, True);
          end
          else
          begin
            if (FindColor(c, d, 4245488, a, b, a - 40, d)) then
              Mouse(c, d, 2, 2, True);
          end;
        end;
      until (IsKeyDown('s'));
    end;

    begin
      SetupSRL;
      MoveRight;
    end.
    You forgot mainloop .

    ~Eerik~

  13. #13
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    And, you grave dug!
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. making it search for colors
    By lemonfuzz in forum OSR Help
    Replies: 10
    Last Post: 05-24-2008, 09:52 AM
  2. Procedure Almost Search;
    By Naum in forum Research & Development Lounge
    Replies: 4
    Last Post: 12-07-2007, 05:44 PM
  3. Replies: 2
    Last Post: 10-07-2007, 04:20 PM
  4. Replies: 11
    Last Post: 08-07-2007, 06:39 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
  •