Results 1 to 2 of 2

Thread: Trying to create my first script, compiling results in: Error: Block expected

  1. #1
    Join Date
    Mar 2013
    Posts
    42
    Mentioned
    0 Post(s)
    Quoted
    18 Post(s)

    Default Trying to create my first script, compiling results in: Error: Block expected

    Hello SRL, I'm trying to create a b2b script, I've ripped some code from Coh3n's superheater and Brose's AIO crafter.(I hope that's okay!)

    EDITED! #1
    Here it is so far:

    Code:
    
    program Gbones;
    
    begin
    
    {$DEFINE SMART}              // Always have this to load smart
    {$I SRL-6/SRL.simba}         // To load the SRL include files
    {$I SPS/lib/SPS-RS3.Simba}   // To load the SPS include files
    
    procedure declarePlayers();
    begin
      setLength(players, 1);
      with players[0] do
      begin
        loginName := 'u!';
        password := 'password';
        isActive := true;
        isMember := true;
      end
      currentPlayer := 0;
    end;
    const
    { Change these constants if you want }
    ANTIBAN_FREQ = 5;             //% chance to perform antiban every cycle.
    AFK_FREQ = 1;                 //% chance to act AFK every  cycle.
    WHICH_BANK = BANK_TABLE_BURTHORPE ;
                                  //The failsafe only works at Burthorpe Bank.
    
    { Misc constants }
    var
      x, y, i: integer;
      TPA: TPointArray;
      ATPA: T2DPointArray;
               //Self explanatory
    USE_PRESETS = TRUE;           //If TRUE it will use preset 1, if FALSE it wont use presets..and break the script.
    
    ////////////////////////////////////////////////////////////////////////////////
    
    (*
    BANK_NPC_BLUE
    BANK_NPC_GREY
    BANK_NPC_GREEN
    BANK_NPC_DRAYNOR
    BANK_BOOTH
    BANK_CHEST_SW
    BANK_CHEST_SHANTAY
    BANK_CHEST_DUEL
    BANK_CHEST_CW
    BANK_CHEST_GROTTO
    BANK_TABLE_BURTHORPE
    BANK_CHEST_LUMBRIDGE
    *)
    
    SCRIPT_VERSION = '1.0';
    
    { Bank color constants }
    bank_col = 6839387;
    bank_tol = 13;
    bank_hue = 0.55;
    bank_sat = 0.33;
    
    var
      loadsDone, XP, startingXP, loadsPH, XPH, antibanCount, actAfkCount: integer;
    
    procedure progressReport;
    begin
    
      XP := (chatBox.getXPBar - startingXP);
      XPH := round(XP * (3600.0 / (getTimeRunning / 1000.0)));
      loadsPH := round((loadsDone * (3600.0 / (getTimeRunning / 1000.0))));
    
      writeln('|===========================================================|');
      writeln('|                  Gbones v' + padR(toStr(SCRIPT_VERSION), 21), '|');
      writeln('|===========================================================|');
      writeln(padR('| Running For: ' + timeRunning, 60) + '|');
      writeln(padR('| Loads done: ' + groupDigits(loadsDone, ','), 40) + padR('Loads/H: ' + groupDigits(loadsPH, ','), 20) + '|');
      writeln(padR('| Exp Earned: ' + groupDigits(XP, ','), 40) + padR('Exp/Hour: ' + groupDigits(XPH, ','), 20) + '|');
      writeln(padR('| Antibans performed: ' + groupDigits(antibanCount, ','), 40) + padR('AFK Count: ' + groupDigits(actafkcount, ','), 20) + '|');
      writeln('|___________________________________________________________|');
      writeln('|___________________________________________________________|');
    
    end;
    
    procedure paintStatus(status: string);
    begin
      {$IFDEF SMART}
        try
          smartImage.clear();
          smartImage.drawText('Status: ' + status, point(chatbox.x2 - 320, chatbox.y2 - 19), smallChars, false, 255);
        except
        end;
      {$ENDIF}
    end;
    
    procedure antiBan();
    begin
      if Random(100) < AntiBan_Freq then
      begin
        paintStatus('Activating Antiban');
        writeLn('Activating Antiban');
        case Random(8) of
          0: RandomRClickItem();
          1: begin
              MouseOffClient(Random(5));
              wait(randomRange(3000,7000));
             end;
          2: PickUpMouse;
          3: MouseMovingObject();
          4: SleepAndMoveMouse(200 + Random(50));
          5: PickUpMouse();
          6: begin
              hoverRandomSkill();
              wait(gaussRangeInt(1500,5000));
             end;
          7: randomCameraAngle(MS_ANGLE_HIGH);
          8: smallRandomMouse();
        end;
        inc(antiBanCount);
      end;
    end;
    
    procedure actAFK();
    var
      i,k : integer;
    begin
      if RandomRange(0,101) < AFK_FREQ then
        begin
          i:= gaussRangeInt(60000,360000);
          k:= round (i/1000);
          MouseOffClient(Random(5));
          writeln(padR('[     Acting AFK For: ' + inttostr(k), 1) + 'secs     ]');
          paintStatus(padR('Going AFK for: ' + inttostr(k), 1) + 'secs...');
          wait (i);
          inc (actafkCount);
        end;
    end;
    
    procedure getStuff();
    begin
        case (USE_PRESETS) of
        TRUE: begin
                bankScreen.clickButton(BANK_BUTTON_PRESET_1);
                wait(randomRange(1000, 2000));
                writeln('Getting stuff');
                bankScreen.close()
               end;
    end;
    end;
    procedure clickBank();
    begin
      bankScreen.open(BANK_TABLE_BURTHORPE);  //Look at the beginning for options, Burthope is the failsafe bank
      if bankScreen.isOpen() then
      begin
        wait(randomRange(2000, 3000));
        getStuff();
      end else
        begin     //this is supposed to be the failsafe for bank finding
        writeln('Cant find bank, failsafe kicking in...');
        findColorsSpiralTolerance(x, y, TPA, bank_col, mainScreen.getbounds(), bank_tol, colorSetting(2, bank_hue, bank_sat));
        if length(TPA) < 1 then
          begin
            writeLn('Even the failsafe failed... Couldn''t find the bank for some reason!');
            exit;
          end else;
    
        smartImage.clearArea(mainScreen.getBounds());
        mouseSpeed := randomRange(10, 30);
        ATPA := TPA.toATPA(30, 30);
        ATPA.sortFromMidPoint(mainscreen.playerPoint);
        smartImage.debugATPA(ATPA);
    
        for i := 0 to high(ATPA) do
          begin
            mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
            writeln('Locating bank...');
            if isMouseOverText(['ank', 'booth'], 1000) then
            begin
              fastclick(mouse_left);
              getStuff();
              break();
            end else writeLn('Couldn''t find the bank for some reason!');
    
      end;
    end;
    
    procedure castSkill;
      begin
        typeSend(0);
    end;
    
    procedure mainLoop();
    begin
      clickBank();
      getStuff();
      castSkill();
      antiBan();
      actAFK();
    
      smartImage.clearArea(mainScreen.getBounds());
      mainLoop();
      inc(loadsDone);
      progressReport();
    end;
    
    begin // This is your script's "Main Loop" (the last begin..end.)
      repeat
        mainLoop(); // repeating the procedure named "mainLoop"
      until false
    end.
    Edit1: Now it gives me "Error: Invalid evaluation at line 36" of "Wrappers" in another tab. is the "getcolor" func screwed?
    Last edited by giavanni6; 01-26-2015 at 01:28 AM.

  2. #2
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Quote Originally Posted by giavanni6 View Post
    Hello SRL, I'm trying to create a b2b script, I've ripped some code from Coh3n's superheater and Brose's AIO crafter.(I hope that's okay!)

    Here it is so far:
    Code:
    program Gbones;
    
    {$DEFINE SMART}              // Always have this to load smart
    {$I SRL-6/SRL.simba}         // To load the SRL include files
    {$I SPS/lib/SPS-RS3.Simba}   // To load the SPS include files
    
    procedure declarePlayers();
    begin
      setLength(players, 1);
      with players[0] do
      begin
        loginName := 'u!';
        password := 'password';
        isActive := true;
        isMember := true;
      end
      currentPlayer := 0;
    end;
    const
    { Change these constants if you want }
    ANTIBAN_FREQ = 5;             //% chance to perform antiban every cycle.
    AFK_FREQ = 1;                 //% chance to act AFK every  cycle.
    WHICH_BANK = BANK_TABLE_BURTHORPE ;
                                  //The failsafe only works at Burthorpe Bank.
    
    { Misc constants }
    var
      x, y, i: integer;
      TPA: TPointArray;
      ATPA: T2DPointArray;
               //Self explanatory
    USE_PRESETS = TRUE;           //If TRUE it will use preset 1, if FALSE it wont use presets..and break the script.
    
    ////////////////////////////////////////////////////////////////////////////////
    
    (*
    BANK_NPC_BLUE
    BANK_NPC_GREY
    BANK_NPC_GREEN
    BANK_NPC_DRAYNOR
    BANK_BOOTH
    BANK_CHEST_SW
    BANK_CHEST_SHANTAY
    BANK_CHEST_DUEL
    BANK_CHEST_CW
    BANK_CHEST_GROTTO
    BANK_TABLE_BURTHORPE
    BANK_CHEST_LUMBRIDGE
    *)
    
    SCRIPT_VERSION = '1.0';
    
    { Bank color constants }
    bank_col = 6839387;
    bank_tol = 13;
    bank_hue = 0.55;
    bank_sat = 0.33;
    
    var
      loadsDone, XP, startingXP, loadsPH, XPH, antibanCount, actAfkCount: integer;
    
    procedure progressReport;
    begin
    
      XP := (chatBox.getXPBar - startingXP);
      XPH := round(XP * (3600.0 / (getTimeRunning / 1000.0)));
      loadsPH := round((loadsDone * (3600.0 / (getTimeRunning / 1000.0))));
    
      writeln('|===========================================================|');
      writeln('|                  Gbones v' + padR(toStr(SCRIPT_VERSION), 21), '|');
      writeln('|===========================================================|');
      writeln(padR('| Running For: ' + timeRunning, 60) + '|');
      writeln(padR('| Loads done: ' + groupDigits(loadsDone, ','), 40) + padR('Loads/H: ' + groupDigits(loadsPH, ','), 20) + '|');
      writeln(padR('| Exp Earned: ' + groupDigits(XP, ','), 40) + padR('Exp/Hour: ' + groupDigits(XPH, ','), 20) + '|');
      writeln(padR('| Antibans performed: ' + groupDigits(antibanCount, ','), 40) + padR('AFK Count: ' + groupDigits(actafkcount, ','), 20) + '|');
      writeln('|___________________________________________________________|');
      writeln('|___________________________________________________________|');
    
    end;
    
    procedure paintStatus(status: string);
    begin
      {$IFDEF SMART}
        try
          smartImage.clear();
          smartImage.drawText('Status: ' + status, point(chatbox.x2 - 320, chatbox.y2 - 19), smallChars, false, 255);
        except
        end;
      {$ENDIF}
    end;
    
    procedure antiBan();
    begin
      if Random(100) < AntiBan_Freq then
      begin
        paintStatus('Activating Antiban');
        writeLn('Activating Antiban');
        case Random(8) of
          0: RandomRClickItem();
          1: begin
              MouseOffClient(Random(5));
              wait(randomRange(3000,7000));
             end;
          2: PickUpMouse;
          3: MouseMovingObject();
          4: SleepAndMoveMouse(200 + Random(50));
          5: PickUpMouse();
          6: begin
              hoverRandomSkill();
              wait(gaussRangeInt(1500,5000));
             end;
          7: randomCameraAngle(MS_ANGLE_HIGH);
          8: smallRandomMouse();
        end;
        inc(antiBanCount);
      end;
    end;
    
    procedure actAFK();
    var
      i,k : integer;
    begin
      if RandomRange(0,101) < AFK_FREQ then
        begin
          i:= gaussRangeInt(60000,360000);
          k:= round (i/1000);
          MouseOffClient(Random(5));
          writeln(padR('[     Acting AFK For: ' + inttostr(k), 1) + 'secs     ]');
          paintStatus(padR('Going AFK for: ' + inttostr(k), 1) + 'secs...');
          wait (i);
          inc (actafkCount);
        end;
    end;
    
    procedure getStuff();
    begin
        case (USE_PRESETS) of
        TRUE: begin
                bankScreen.clickButton(BANK_BUTTON_PRESET_1);
                wait(randomRange(1000, 2000));
                writeln('Getting stuff');
                bankScreen.close()
               end;
    end;
    end;
    procedure clickBank();
    begin
      bankScreen.open(BANK_TABLE_BURTHORPE);  //Look at the beginning for options, Burthope is the failsafe bank
      if bankScreen.isOpen() then
      begin
        wait(randomRange(2000, 3000));
        getStuff();
      end else
        begin     //this is supposed to be the failsafe for bank finding
        writeln('Cant find bank, failsafe kicking in...');
        findColorsSpiralTolerance(x, y, TPA, bank_col, mainScreen.getbounds(), bank_tol, colorSetting(2, bank_hue, bank_sat));
        if length(TPA) < 1 then
          begin
            writeLn('Even the failsafe failed... Couldn''t find the bank for some reason!');
            exit;
          end else;
    
        smartImage.clearArea(mainScreen.getBounds());
        mouseSpeed := randomRange(10, 30);
        ATPA := TPA.toATPA(30, 30);
        ATPA.sortFromMidPoint(mainscreen.playerPoint);
        smartImage.debugATPA(ATPA);
    
        for i := 0 to high(ATPA) do
          begin
            mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
            writeln('Locating bank...');
            if isMouseOverText(['ank', 'booth'], 1000) then
            begin
              fastclick(mouse_left);
              getStuff();
            end else writeLn('Couldn''t find the bank for some reason!');
          break;
          end
      end;
    end;
    
    procedure castSkill
      begin
        typeSend(0);
    end;
    
    
    procedure mainLoop();
    begin
      clickBank();
      getStuff();
      castSkill();
      antiBan();
      actAFK();
    end;
    repeat
        begin
        smartImage.clearArea(mainScreen.getBounds());
        mainLoop();
        inc(loadsDone);
        progressReport();
        actAFK();
        end;
    end.
    It gives me: Compiling failed.
    Error: Block expected at line 197

    Now, what is a "Block"? I tried looking through the documentation and googling, but nothing relevant came to light.
    A 'block' refers to a Begin...End block of code.

    If you look right at the end of your script, you have:

    Simba Code:
    repeat
        begin
        smartImage.clearArea(mainScreen.getBounds());
        mainLoop();
        inc(loadsDone);
        progressReport();
        actAFK();
        end;
    end.

    A repeat without an until
    An end. without a begin.

    Chance it to something like:

    Simba Code:
    procedure mainLoop();
    begin
      clickBank();
      getStuff();
      castSkill();
      antiBan();
      actAFK();

      smartImage.clearArea(mainScreen.getBounds());
      mainLoop();
      inc(loadsDone);
      progressReport();
      actAFK();
    end;

    begin // This is your script's "Main Loop" (the last begin..end.)
      repeat
        mainLoop(); // repeating the procedure named "mainLoop"
      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
  •