Results 1 to 10 of 10

Thread: My first script (miner)

  1. #1
    Join Date
    Feb 2007
    Posts
    849
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    My first script (miner)

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

    var
    x,y: Integer;

    const
    RockColour= 2569300; //iron



    procedure FindRock;
    begin
    if(FindColor(x,y,RockColour,0,0,600,600)) then
     begin
      Writeln('Found Rock');
     end else
      Writeln('Didnt find rock');
    end;

    procedure MoveMouseToRock;
    begin
      MMouse(x,y,2,2);
      Wait(50)+random(100));
      Mouse(x,y,2,2,true);
    end;

    procedure Drop;
    begin
    DropTo(2,28);
    end;

    begin
    SetupSRL;
    FindRock;
    MoveMouseToRock;
    Drop;
    until(false)
    end.

    [H]Line 5: [Error] (17666:1): Duplicate identifier 'x' in script D:\Documents and Settings\Harry.049652820287\Desktop\ma miner.scar[/H]


    This is my first script that isnt completely made by a TUT, please show me what is wrong
    ________________________________________
    14:19 < cycrosism> I wonder what she would have done without it
    14:19 < cycrosism> without me*
    Cycrosism is now an it.
    Quote Originally Posted by Dervish View Post
    /Facedesk.

  2. #2
    Join Date
    Sep 2006
    Posts
    916
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You included SRL, which already has x and y variables declared, just take out the variables .

  3. #3
    Join Date
    Feb 2007
    Posts
    849
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    oh ok, then should it mine and drop infinatly?
    i new to srl

    well, it drops

    it just cant find he rock and the mouse goes to the corner of the client
    ________________________________________
    14:19 < cycrosism> I wonder what she would have done without it
    14:19 < cycrosism> without me*
    Cycrosism is now an it.
    Quote Originally Posted by Dervish View Post
    /Facedesk.

  4. #4
    Join Date
    Sep 2006
    Posts
    916
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    That's because it can't find the color on the screen.

  5. #5
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    your missing a repeat in the main loop aren't you?

  6. #6
    Join Date
    Jan 2007
    Posts
    248
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Change the global variables to a uniquie X. I'll edit this post in a minute with more suggestions.
    Here are my editations/suggestions
    Code:
    Function FindRock: Boolean; 
    //made this a boolean + also added tolerance to the color your looking for
     begin
      if(FindColorTolerance(x, y, RockColour, 0, 0, 600, 600, 2))then
     begin
         Result := True;
      Writeln('Found Rock');
         end else
      Writeln('Didnt find rock');
    end;
    
    procedure MoveMouseToRock;
     begin repeat
        if FindRock = True then
       Mouse(x, y, 2, 2, true);
       Wait(4000)+random(100)); // change the wait to w/e suits u
        until(InvFull);
     end;
    
    procedure Drop;
     begin 
      if(InvFull)then begin
      DropTo(2,28);
     end;
    end;
    You'd also need loops within the procs....

    In your main loop, you should add a repeat...
    begin
    repeat
    bla bla
    bla bla
    Until(False);
    end;

    Good luck with your scripting.

  7. #7
    Join Date
    Feb 2007
    Posts
    849
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    erm... ok so i missed out a procedure and is that the full code edited

    oh ya and thanx for the luck

    should the main lopp or whatever it is go like this

    begin
    SetupSRL;
    repeat
    FindRock;
    MoveMouseToRock;
    Drop;
    until(false)


    or like this

    begin
    repeat
    SetupSRL;
    FindRock;
    MoveMouseToRock;
    Drop;
    until(false)
    ________________________________________
    14:19 < cycrosism> I wonder what she would have done without it
    14:19 < cycrosism> without me*
    Cycrosism is now an it.
    Quote Originally Posted by Dervish View Post
    /Facedesk.

  8. #8
    Join Date
    Feb 2007
    Posts
    849
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)
    SCAR Code:
    program Mine;
    {.include SRL/SRL.scar}

    const
    RockColour= 2569300; //iron

    Function FindRock: Boolean;
    begin
      if(FindColorTolerance(x, y, RockColour, 0, 0, 600, 600, 2))then
     begin
         Result := True;
      Writeln('Found Rock');
         end else
      Writeln('Didnt find rock');
    end;

    procedure MoveMouseToRock;
     begin repeat
        if FindRock = True then
       Mouse(x, y, 2, 2, true);
       Wait(2000)+random(100));
        until(InvFull);
        LoadsNum := LoadsNum + 1;

     begin
      if(InvFull)then begin
      DropTo(2,28);
     end;
    end;

    begin
    SetupSRL;
    repeat
    FindRock;
    MoveMouseToRock;
    Drop;
    until(false)
    end.

    That is the script bt then i get this error

    [H]Line 21: [Error] (17682:11): Identifier expected in script D:\Documents and Settings\Harry.049652820287\Desktop\ma mine2.scar[/H]
    ________________________________________
    14:19 < cycrosism> I wonder what she would have done without it
    14:19 < cycrosism> without me*
    Cycrosism is now an it.
    Quote Originally Posted by Dervish View Post
    /Facedesk.

  9. #9
    Join Date
    Jan 2007
    Posts
    248
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    here i fixed it...
    Quote Originally Posted by 05hartor View Post
    SCAR Code:
    program Mine;
    {.include SRL/SRL.scar}

    var LoadsNum: integer;

    const
    RockColour= 2569300; //iron

    Function FindRock: Boolean;
    begin Wait(2000);
      if(FindColorTolerance(x, y, RockColour, 0, 0, 600, 600, 2))then
     begin
         Result := True;
      Writeln('Found Rock');
     end else
         Result := False;
      Writeln('Didnt find rock');
    end;
     
    procedure MoveMouseToRock;
     begin repeat
        if FindRock = True then
       Mouse(x, y, 2, 2, true);
       Wait(2000 + random(100));
        until(InvFull);
        LoadsNum := LoadsNum + 1;
      end;
    Procedure Drop;
     begin
      if(InvFull)then begin
      DropTo(2,28);
     end;
    end;

    begin
    SetupSRL;
    repeat
    FindRock;
    MoveMouseToRock;
    Drop;
    until(false)
    end.
    post if you get some other error.

  10. #10
    Join Date
    Mar 2007
    Posts
    82
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    looks good lol. i can tell its ur fist one.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. My First Script - Power Miner
    By shadowrec0n in forum First Scripts
    Replies: 21
    Last Post: 07-05-2008, 11:49 AM
  2. Ess Miner Script?
    By tbonemaster in forum News and General
    Replies: 3
    Last Post: 05-10-2008, 04:58 AM
  3. Power Miner first script
    By dallas574 in forum First Scripts
    Replies: 4
    Last Post: 05-04-2008, 07:53 PM
  4. The Lords Power Miner (h) First Script (h)
    By The Lord Ahmed in forum RS3 Outdated / Broken Scripts
    Replies: 5
    Last Post: 07-15-2007, 10:40 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
  •