Results 1 to 6 of 6

Thread: Technically Done... Still need help

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

    Default Technically Done... Still need help

    SCAR Code:
    // New redo of Godfather Inc. PowerMiner*** VERS. Alpha~
    // Next Vers 'beta' will have anti randoms atleast... And Some SRL includes
    //Has an auto color function NOTE: defualt color = iron
    program PowerMiner;
    {.include SRL/srl.scar}
    const
    rockcolor= 2305614; //color of rock (will use this to auto color)
    nextrock= 3000; // time to wait b4 next click. (1000 = 1 second)
    var
     i,xD,yD,full,drop,Iro: integer;

    Function GetRockColor(MineCol: array [0..3] of integer): integer;


    begin
      if (FindColorTolerance(xD, yD, rockcolor, 20, 25, 490, 315, 2)) then
      begin
        MineCol[0] := GetColor(x+3,y+3);
        MineCol[1] := GetColor(x-3,y-3);
        MineCol[2] := GetColor(x-3,y+3);
        MineCol[3] := GetColor(x+3,y-3);
        i := Random(3) + 1;
        result := MineCol[i];
      end;
    end;

    Procedure MineRock;
    var x1,y1,xR,yR: integer;
    MineCol: array of integer;
     begin
     repeat
      If FindColorTolerance(xR,yR,MineCol[i],20,25,490,315,2) then
       Mouse(xR,yR,4,4,true);
      wait(nextrock)
      until(findbitmap(full,x1,y1));
      end;
    Procedure LoadBitDTM;
    begin
    full := BitmapFromString(16, 12, 'z78DA73B27434B5' +
           '307442220D908013862C0AE9E8E864E14880C43019934D0209361' +
           '3C5854822C8F692693EA66BF19B86D7BF44998F2B344834CD096F' +
           '3C620262621C7F4A202A7C70F89754712A9B8FE1E6C1EF7E5CB14' +
           '36A6EC29F129C8C2C2DCD4D212401F391546211C7EF1224350043' +
           '29FB94');

    drop := BitmapFromString(14, 8, 'z78DA33753135313177C3014CC' +
           '1B298247EF5C82206480097C9C4A8C754834B2FF1E243C54C626C' +
           '21C63D98B64048031C809838C2A59E1812BFAB20240010BE9F4F');
           
    Iro := DTMFromString('78DA6314656060106040018E1AF2609A11CA6' +
           '7940012AC0C688011558D349060435561A62889AA0664AC04AA9A' +
           '20233554359C40820F554D989B01AA1A909B4550D5F819A8A0AA1' +
           '10712A268E69869A0A8010017C304DA');

           end;
    Procedure DropOre;
    var x1,y1,x2,y2,x3,y3: integer;
     Begin
      repeat
      If FindBitmap(full,x1,y1) then
       begin
       repeat
      FindDTM(Iro,x2,y2,555,200,740,465)
      Mouse(x2,y2,4,4,false)
      wait(600+random(125))
      FindBitmap(drop,x3,y3)
      Mouse(x3+6,y3+3,4,4,true)
       until not(FindDTM(Iro,x2,y2,555,200,740,465))
     
    begin
    SetupSRL;
    ActivateClient;
    MouseSpeed:= 8+(random(2)
    GetRockColor(MineCol: array [0..3] of integer): integer;
    LoadBitDTM;
     repeat
     MineRock;
     DropOre;
     until(false)
    end.

    Need someone to help me correct my problems...
    error:
    Failed when compiling
    Line 74: [Error] (17735:1): Close round expected in script

    NOTE: I kno there no anti randoms.... YET, (I have already coded the code for most of the mining randoms)

  2. #2
    Join Date
    Nov 2006
    Posts
    120
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    MouseSpeed:= 8+(random(2)

    Always count your opens and closes. I actually count them on my fingers through the line. after the plus sign there is an open. one finger up. after random, one finger up. after two. one finger down. still one finger left. the reason it showed up on the next line is because you had no line terminator (thats the semicolon ; )

    so it went right down the the next line looking for a close parenthesis.

    Also on the next line

    SCAR Code:
    GetRockColor(MineCol: array [0..3] of integer): integer;

    Since you already defined GetRockColor earlier in the script as a function, all you need to write on the line is

    SCAR Code:
    GetRockColor(MineCol);

    [EDIT]and actually that doesn't compile either...gimme a sec

    EDIT2: Ok so i finally dove into the script and found LOTS of MAJOR problems. First the array in the function GetRockColor needs to be defined in you global variable spot. just write

    MineCol: array [0..3] of integer;

    under your other vars. Secondly you have MANY MANY lines without a semicolon after them. That's gonna cause you grief in the long run. Make it a habit; it's really easy; once you get used to it;

    Also using the same finger method, count out your begins and you ends to make sure you have the same number in any given procedure or function.

    Lastly that I will go into right now is make sure that for every repeat you have an until, or some way of terminating it.

    You should read up on some tutorials and these to help you make good habits in all of your scripts...no matter what the size of the script. It will get you well liked and respected if your code is clean.


    Code:
    Scar Scripting Standards Published by ejjman1
    http://www.srl-forums.com/forum/scar...42.html?t=6042
    
    SCAR Script Official Standards Published by Bam Bam
    http://www.srl-forums.com/forum/scar...97.html?t=3997
    
    Scripting Standards Published by WhiteShadow
    http://www.srl-forums.com/forum/scri...96.html?t=5496



    Ransom

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

    Default

    Thanks for trying to help, hopefully u figure out whats up
    and yet with those lovely detailed explanations of my problem, the same problem IS CLEAR :P
    ++ rep

  4. #4
    Join Date
    Nov 2006
    Posts
    120
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    check my edits ^^

    good luck!

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

    Default

    New Edit to script, get same problem as before....

    SCAR Code:
    // New redo of Godfather Inc. PowerMiner*** VERS. Alpha~
    // Next Vers 'beta' will have anti randoms atleast... And Some SRL includes
    //Has an auto color function NOTE: defualt color = iron
    program PowerMiner;
    {.include SRL/srl.scar}
    const
    rockcolor= 2305614; //color of rock (will use this to auto color)
    nextrock= 3000; // time to wait b4 next click. (1000 = 1 second)
    var
     i,xD,yD,full,drop,Iro: integer;
     MineCol: array [0..3] of integer;
    Function GetRockColor(MineCol: array [0..3] of integer): integer;


    begin
      if (FindColorTolerance(xD, yD, rockcolor, 20, 25, 490, 315, 2)) then
      begin
        MineCol[0] := GetColor(x+3,y+3);
        MineCol[1] := GetColor(x-3,y-3);
        MineCol[2] := GetColor(x-3,y+3);
        MineCol[3] := GetColor(x+3,y-3);
        i := Random(3) + 1;
        result := MineCol[i];
      end;
    end;

    Procedure MineRock;
    var x1,y1,xR,yR: integer;
     begin
     repeat
      If FindColorTolerance(xR,yR,MineCol[i],20,25,490,315,2) then
       Mouse(xR,yR,4,4,true);
      wait(nextrock);
      until(findbitmap(full,x1,y1));
      end;
    Procedure LoadBitDTM;
    begin
    full := BitmapFromString(16, 12, 'z78DA73B27434B5' +
           '307442220D908013862C0AE9E8E864E14880C43019934D0209361' +
           '3C5854822C8F692693EA66BF19B86D7BF44998F2B344834CD096F' +
           '3C620262621C7F4A202A7C70F89754712A9B8FE1E6C1EF7E5CB14' +
           '36A6EC29F129C8C2C2DCD4D212401F391546211C7EF1224350043' +
           '29FB94');

    drop := BitmapFromString(14, 8, 'z78DA33753135313177C3014CC' +
           '1B298247EF5C82206480097C9C4A8C754834B2FF1E243C54C626C' +
           '21C63D98B64048031C809838C2A59E1812BFAB20240010BE9F4F');
           
    Iro := DTMFromString('78DA6314656060106040018E1AF2609A11CA6' +
           '7940012AC0C688011558D349060435561A62889AA0664AC04AA9A' +
           '20233554359C40820F554D989B01AA1A909B4550D5F819A8A0AA1' +
           '10712A268E69869A0A8010017C304DA');

           end;
    Procedure DropOre;
    var x1,y1,x2,y2,x3,y3: integer;
     Begin
      repeat
      If FindBitmap(full,x1,y1) then
       begin
       repeat
      FindDTM(Iro,x2,y2,555,200,740,465);
      Mouse(x2,y2,4,4,false);
      wait(600+random(125));
      FindBitmap(drop,x3,y3);
      Mouse(x3+6,y3+3,4,4,true);
       until not(FindDTM(Iro,x2,y2,555,200,740,465))
       end;
       
    begin
    SetupSRL;
    ActivateClient;
    MouseSpeed:= 8+(random(2);
    GetRockColor(MineCol);
    LoadBitDTM;
     repeat
     MineRock;
     DropOre;
     until(false)
    end.

    I also took into consideration for every repeat you have an until, every begin an end... BUT alot of the time the way i edit it it screws itself over.

  6. #6
    Join Date
    Jul 2006
    Location
    NY
    Posts
    371
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    // New redo of Godfather Inc. PowerMiner*** VERS. Alpha~
    // Next Vers 'beta' will have anti randoms atleast... And Some SRL includes
    //Has an auto color function NOTE: defualt color = iron
    program PowerMiner;
    {.include SRL/srl.scar}
    const
    rockcolor= 2305614; //color of rock (will use this to auto color)
    nextrock= 3000; // time to wait b4 next click. (1000 = 1 second)
    var
     i,xD,yD,full,drop,Iro: integer;
     MineCol: array [0..3] of integer;
    Function GetRockColor(MineCol: array [0..3] of integer): integer;


    begin
      if (FindColorTolerance(xD, yD, rockcolor, 20, 25, 490, 315, 2)) then
      begin
        MineCol[0] := GetColor(x+3,y+3);
        MineCol[1] := GetColor(x-3,y-3);
        MineCol[2] := GetColor(x-3,y+3);
        MineCol[3] := GetColor(x+3,y-3);
        i := Random(3) + 1;
        result := MineCol[i];
      end;
    end;

    Procedure MineRock;
    var x1,y1,xR,yR: integer;
     begin
     repeat
      If FindColorTolerance(xR,yR,MineCol[i],20,25,490,315,2) then
       Mouse(xR,yR,4,4,true);
      wait(nextrock);
      until(findbitmap(full,x1,y1));
      end;
    Procedure LoadBitDTM;
    begin
    full := BitmapFromString(16, 12, 'z78DA73B27434B5' +
           '307442220D908013862C0AE9E8E864E14880C43019934D0209361' +
           '3C5854822C8F692693EA66BF19B86D7BF44998F2B344834CD096F' +
           '3C620262621C7F4A202A7C70F89754712A9B8FE1E6C1EF7E5CB14' +
           '36A6EC29F129C8C2C2DCD4D212401F391546211C7EF1224350043' +
           '29FB94');

    drop := BitmapFromString(14, 8, 'z78DA33753135313177C3014CC' +
           '1B298247EF5C82206480097C9C4A8C754834B2FF1E243C54C626C' +
           '21C63D98B64048031C809838C2A59E1812BFAB20240010BE9F4F');

    Iro := DTMFromString('78DA6314656060106040018E1AF2609A11CA6' +
           '7940012AC0C688011558D349060435561A62889AA0664AC04AA9A' +
           '20233554359C40820F554D989B01AA1A909B4550D5F819A8A0AA1' +
           '10712A268E69869A0A8010017C304DA');

           end;
           
    {****************************************************************}
    {*************** PROBLEMS STARTED HERE **************************}
    {****************************************************************}
    Procedure DropOre;
    var
     x1, y1, x2, y2, x3, y3: integer;
    begin
    //repeat
      If (FindBitmap(full, x1, y1)) then
      begin
        repeat
          FindDTM(Iro, x2, y2, 555, 200, 740, 465);
          Mouse(x2, y2, 4, 4, false);
          wait(600 + random(125));
          FindBitmap(drop, x3, y3);
          Mouse(x3 + 6, y3 + 3, 4, 4, true);
        until not(FindDTM(Iro, x2, y2, 555, 200, 740, 465))
      end;
    //until (false) DONT NEED, ALREADY REPEATING IN MAIN LOOP
    end;


    begin
    SetupSRL;
    ActivateClient;
    MouseSpeed:= 8+(random(2)); //needed another ')'. for every '(' you need a
    // ')' .. you need to close them.
    GetRockColor(MineCol);
    LoadBitDTM;
     repeat
       MineRock;
       DropOre;
     until(false)
    end.

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
  •