Results 1 to 15 of 15

Thread: Error...

  1. #1
    Join Date
    Sep 2007
    Location
    Pennsylvania
    Posts
    3,396
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Error...

    Finally working on a script I'll release to the public (hopefully I'll finish it ) -- an FMer. Getting this error:

    [Runtime Error] : Out of Global Vars range in line 295 in script
    SCAR Code:
    Function MakeFires: boolean;
    var i,clicking,burning,strikes: integer;
    firstdone: boolean;
    begin
      strikes := 0;
      firstdone := false;
      if not(LoggedIn) then
      begin
        SwitchPlayer(true);
        Exit;
      end;
      Status('Burning logs...');
      i := 2;
      MarkTime(burning);
      repeat
        MouseItem(1,true);
        wait(randomrange(100,200));
        MMouseItem(i);
        MarkTime(clicking);
        repeat
          if not (CharacterAnimating) then break;
          if not(Firstdone) then break;
        until (TimeFromMark(clicking) > 5500);
        MarkTime(clicking);
        repeat
          if (CharacterMoving) then break;
          if not(Firstdone) then break;
        until (TimeFromMark(clicking) > 3500);
        wait(randomrange(750,1250));
        MouseItem(i,true);
        Firstdone := true;
        status('Burning log #'+inttostr(i-1));
        wait(500+random(250));
        if (LastChatMessage('black') = 'You can''t light a fire here.') then
        begin
          Inc(strikes);
          if (strikes > 4) then
          begin
            writeln('Failing to burn logs too often, next player.');
            SwitchPlayer(False);
            result := false;
            exit;
          end;
          WalkToTileMS(Point(GetMyPos.x,GetMyPos.y+1),0,0);
          MouseItem(1,true);
          wait(200+Random(150));
          MouseItem(i,true);
        end;
        MarkTime(clicking);   //line 295
        repeat
          wait(randomrange(25,75));
        until not(ExistsItem(i)) or (TimeFromMark(clicking) > 4500);
        Inc(i);
      until(InvCount = 1) or (TimeFromMark(burning) > 60000);
      result := true;
    end;

    Any help?

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

    Default

    Change all the variables that you use for timing things to LongInt ... not integer.

  3. #3
    Join Date
    Sep 2007
    Location
    Pennsylvania
    Posts
    3,396
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Didn't fix it :\

  4. #4
    Join Date
    Mar 2007
    Posts
    1,700
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Not sure if this is your problem but SCAR is moody about directly accessing properties of records.
    Try changing
    SCAR Code:
    WalkToTileMS(Point(GetMyPos.x,GetMyPos.y+1),0,0);
    to
    SCAR Code:
    Pt := GetMyPos;
    Inc(Pt.y);
    WalkToTileMS(Pt,0,0);
    Last edited by lordsaturn; 04-25-2009 at 06:44 AM.

  5. #5
    Join Date
    Sep 2007
    Location
    Pennsylvania
    Posts
    3,396
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It compiles fine, but when it gets that far, the error pops up.

    The part that you're suggesting to change doesn't get run unless the fire doesn't light, which I haven't even tried testing yet, so I don't think that's the problem :\

  6. #6
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    After you do TimeFromMark(Clicking); do Clicking := 0; before marking the time again
    Last edited by ian.; 04-25-2009 at 07:26 AM.

  7. #7
    Join Date
    Sep 2007
    Location
    Pennsylvania
    Posts
    3,396
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Still get it

    [Runtime Error] : Out of Global Vars range in line 300 in script

    SCAR Code:
    Function MakeFires: boolean;
    var i,clicking,burning,strikes: longint;
    firstdone: boolean;
    begin
      strikes := 0;
      clicking := 0;
      burning := 0;
      firstdone := false;
      if not(LoggedIn) then
      begin
        SwitchPlayer(true);
        Exit;
      end;
      Status('Burning logs...');
      i := 2;
      MarkTime(burning);
      repeat
        MouseItem(1,true);
        wait(randomrange(100,200));
        MMouseItem(i);
        clicking := 0;
        MarkTime(clicking);
        repeat
          if not (CharacterAnimating) then break;
          if not(Firstdone) then break;
        until (TimeFromMark(clicking) > 5500);
        clicking := 0;
        MarkTime(clicking);
        repeat
          if (CharacterMoving) then break;
          if not(Firstdone) then break;
        until (TimeFromMark(clicking) > 3500);
        wait(randomrange(750,1250));
        MouseItem(i,true);
        Firstdone := true;
        status('Burning log #'+inttostr(i-1));
        wait(500+random(250));
        if (LastChatMessage('black') = 'You can''t light a fire here.') then
        begin
          Inc(strikes);
          if (strikes > 4) then
          begin
            writeln('Failing to burn logs too often, next player.');
            SwitchPlayer(False);
            result := false;
            exit;
          end;
          WalkToTileMS(Point(GetMyPos.x,GetMyPos.y+1),0,0);
          MouseItem(1,true);
          wait(200+Random(150));
          MouseItem(i,true);
        end;
        clicking := 0;
        MarkTime(clicking);   //line 300
        repeat
          wait(randomrange(25,75));
        until not(ExistsItem(i)) or (TimeFromMark(clicking) > 4500);
        Inc(i);
      until(InvCount = 1) or (TimeFromMark(burning) > 60000);
      result := true;
    end;

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

    Default

    Quote Originally Posted by 99_ View Post
    After you do TimeFromMark(Clicking); do Clicking := 0; before marking the time again
    That shouldn't be necessary as far as I know.

    I can't find the problem either. Weird...
    Last edited by JAD; 04-25-2009 at 08:12 AM.

  9. #9
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Whole script?

  10. #10
    Join Date
    Sep 2007
    Location
    Pennsylvania
    Posts
    3,396
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok. Not putting in the first post so only those who really want to help see it

    SCAR Code:
    program AIOFmer;
    {.include srl/srl/misc/smart.scar}
    {.include srl/srl.scar}
    {.include srl\srl/reflection/reflection.scar}

    {
    This script FMs at the following locations:
    'ge' = Grand Exchange
    'vwbn' = Varrock West Bank (North)
    'vwbs' = Varrock West Bank (South)
    'veb' = Varrock East Bank
    'feb' = Fally East Bank

    To Be Added

    'fog' = Fist Of Guthix

    Post suggestions!
    }


    var
    SpotTileX, SpotTileY, BankTileX, BankTileY, holder: longint;
    loads: LongInt;

    const
      DebugIt = True; //True/False - Have the script update you on where its at in the debug box constantly?
      SmartWorld = 111;

    Procedure DeclarePlayers;
    begin

      HowManyPlayers:= 1;              // How many players are there arrays for?
      CurrentPlayer:= 0;               // Which player should we start with?
      NumberOfPlayers(HowManyPlayers); // Do Not Change.

      Players[0].Name := ''; // Username.
      Players[0].Pass := ''; // Password.
      Players[0].Nick := '';    // 2-4 letters of your Username (that are not capital letters or spaces).
      Players[0].Active := True;
      Players[0].Loc := 'start'; // Do not change.
      Players[0].Strings[0] := ''; // Bank Pin. If none, leave as '' (blank).
      Players[0].Strings[1] := 'vwbs'; // Read top of script to find out the arguments for this.
      Players[0].Integers[0] := 312; //Loads to do
     
    end;

    Procedure SwitchPlayer(active: boolean);
    begin
      if (active = false) then
      begin
        holder := 0;
        wait(9999999999999999999999999999999);
        Players[CurrentPlayer].Active := false;
        Logout;
        wait(3000+random(500));
        if (AllPlayersInactive) then
        begin
          writeln('All Players are inactive, terminating script.');
          TerminateScript;
        end;
      end else
      begin
        holder := 0;
        writeln('Switching Players (Current Player:'+Players[CurrentPlayer].Name+' is still active.');
        NextPlayer(true);
      end;
    end;

    Procedure Debug(text: string);
    begin
      if (DebugIt) then
        writeln('DEBUG: '+text);
    end;

    Function GetTBox: boolean;
    begin
      if not(loggedin) then
        loginplayer;
      GameTab(4);
      MMouseItem(1);
      wait(250+random(200));
      if (IsUpText('erbox')) then
      begin
        result := true;
        exit;
      end else
      begin
        writeln('You do not have a tinderbox. Next Player.');
        SwitchPlayer(false);
        exit;
      end;
    end;

    Function SetUpPlayer: boolean;
    begin
      if not(LoggedIn) then
        LoginPlayer;
      GameTab(4);
      if not(GetTBox) then
      begin
        Writeln('You do not have a Tinderbox in your inventory. Next Player.');
        SwitchPlayer(false);
        exit;
      end;
      debug('You have a Tinderbox.');
      MakeCompass('n');
      SetAngle(true);
      FindNormalRandoms;
      SetRun(true);
      result := true;
    end;

    Function ChooseBank: string;
    begin
      case (Players[CurrentPlayer].Strings[1]) of
      'vwbn': begin result := 'vwb'; exit; end;
      'vwbs': begin result := 'vwb'; exit; end;
      'veb':  begin result := 'veb'; exit; end;
      'feb':  begin result := 'feb'; exit; end;
      //'fog': result := '';
      end;
      writeln('Please fix the Player''s bank argument.');
    end;

    {Function OpenGEBank:Boolean; //Made by: The Cnr Sport
    Var
    TPA : Tpointarray;
    P2D : T2DPointarray;
    TP : Tpoint;
    I,L,U:integer;
    begin
      if not loggedin then exit;
      FindColorsSpiralTolerance(Mscx,mscy,TPA,6712942,190,117,225,177,7);
      L := GetArrayLength(TPA);
      P2D := TPAToATPAEx(Tpa, 5, 5);
      for I := 0 to Length(P2D)-1 do
      begin
        tp := MiddleTPA(P2D[I]);
        MMouse(tp.x,tp.y,2,2);
        wait(randomrange(50,90));
        If Isuptext('anke') then
        begin
          Mouse(tp.x,tp.y,0,0,false);
          wait(randomrange(50,90));
          If Chooseoption('ank Bank') then
          begin
            result:=true;
            writeln('Banked at GE');
            If bankscreen or pinscreen then exit;
          end;
        end;
      end;
    end;       }


    Procedure SetTiles;
    begin
      case (Players[CurrentPlayer].Strings[1]) of

      {'ge': begin
              SpotTileX := ;
              SpotTileY := ;
              BankTileX := ;
              BankTileY := ;
              exit;
            end;  }

      'vwbn': begin
                SpotTileX := 0;
                SpotTileY := 0;
                BankTileX := 0;
                BankTileY := 0;
                exit;
              end;
      'vwbs': begin
                SpotTileX := 3198;
                SpotTileY := 3428;
                BankTileX := 3188;
                BankTileY := 3435;
                exit;
              end;
      'veb':begin
              SpotTileX := 0;
              SpotTileY := 0;
              BankTileX := 0;
              BankTileY := 0;
              exit;
            end;
      'feb':begin
              SpotTileX := 0;
              SpotTileY := 0;
              BankTileX := 0;
              BankTileY := 0;
              exit;
            end;
      end;
      writeln('Please fix the current Player''s FMing location argument');
      SwitchPlayer(false);
    end;


    Function BankIt: boolean;
    begin
      if not(LoggedIn) then
      begin
        SwitchPlayer(true);
        Exit;
      end;
      if not(InvFull) then
      begin
        Status('Opening Bank...');
        {if (Players[CurrentPlayer].Strings[1] = 'ge') then
        begin
          OpenGEBank;
        end else
        begin  }

          OpenBankQuiet(ChooseBank);
       // end;
        wait(1000+random(200));
        Deposit(2,28,true);
        wait(250+random(200));
        Withdraw(1,1,27);
        CloseBank;
      end;
      result := true;
    end;

    Function WalkToSpot: boolean;
    begin
      if not(LoggedIn) then
      begin
        SwitchPlayer(true);
        Exit;
      end;
      SetTiles;
      if (holder/3 = 1) then
        holder := 0;
      if not(WalkToTile(Point(SpotTilex, SpotTileY+holder),0,1)) then
      begin
        writeln('Failed while walking to the FMing spot. Next Player.');
        SwitchPlayer(false);
        result := false;
        exit;
      end;
      Inc(holder);
      result := true;
    end;

    Function MakeFires: boolean;
    var i,clicking,burning,strikes: longint;
    firstdone: boolean;
    begin
      strikes := 0;
      firstdone := false;
      if not(LoggedIn) then
      begin
        SwitchPlayer(true);
        Exit;
      end;
      Status('Burning logs...');
      i := 2;
      MarkTime(burning);
      repeat
        MouseItem(1,true);
        wait(randomrange(100,200));
        MMouseItem(i);
        MarkTime(clicking);
        repeat
          if not (CharacterAnimating) then break;
          if not(Firstdone) then break;
        until (TimeFromMark(clicking) > 5500);
        MarkTime(clicking);
        repeat
          if (CharacterMoving) then break;
          if not(Firstdone) then break;
        until (TimeFromMark(clicking) > 3500);
        wait(randomrange(750,1250));
        MouseItem(i,true);
        Firstdone := true;
        status('Burning log #'+inttostr(i-1));
        wait(500+random(250));
        if (LastChatMessage('black') = 'You can''t light a fire here.') then
        begin
          Inc(strikes);
          if (strikes > 4) then
          begin
            writeln('Failing to burn logs too often, next player.');
            SwitchPlayer(False);
            result := false;
            exit;
          end;
          WalkToTileMS(Point(GetMyPos.x,GetMyPos.y+1),0,0);
          MouseItem(1,true);
          wait(200+Random(150));
          MouseItem(i,true);
        end;
        MarkTime(clicking);   //line 300
        repeat
          wait(randomrange(25,75));
        until not(ExistsItem(i)) or (TimeFromMark(clicking) > 4500);
        Inc(i);
      until(InvCount = 1) or (TimeFromMark(burning) > 60000);
      result := true;
    end;

    Function GoToBank: boolean;
    begin
      if not(LoggedIn) then
      begin
        SwitchPlayer(true);
        Exit;
      end;
      SetTiles;
      writeln('Distance from: '+inttostr(DistanceFrom(point(3188, 3435))));
      writeln('X: '+IntToStr(GetMyPos.x)+'  Y: '+IntToStr(GetMyPos.y));
      if not (WalkToTile(Point(BankTileX, BankTileY),0,1)) then
      begin
        writeln('Failed while walking to the Bank. Next Player.');
        SwitchPlayer(false);
        result := false;
        exit;
      end;
      result := true;
    end;
       
     
    begin
      SmartSetupEx(111,false,true,false);
      SetTargetDC(smartgetdc);
      SetupSRL;
      //SetupReflection;
      DeclarePlayers;
      holder := 0;
        repeat
          case (Players[CurrentPlayer].Loc) of
         
          'start': begin
                     if not(LoggedIn) then
                       LoginPlayer;
                     if (SetUpPlayer) then
                     begin
                       Players[CurrentPlayer].Loc := 'banky';
                     end else
                     begin
                       writeln('Something went wrong during SetUpPlayer. Next Player.');
                       SwitchPlayer(false);
                     end;
                   end;
          'banky': begin
                     if not(LoggedIn) then
                       LoginPlayer;
                     if (GoToBank) then
                     begin
                       Players[CurrentPlayer].Loc := 'bankit';
                     end else
                     begin
                       writeln('Something went wrong during GoToBank. Next Player.');
                       SwitchPlayer(false);
                     end;
                   end;
          'bankit': begin
                     if not(loggedin) then
                       loginplayer;
                     if (BankIt) then
                     begin
                       Players[CurrentPlayer].Loc := 'firespot';
                     end else
                     begin
                       writeln('Something went wrong during BankIt. Next Player.');
                       SwitchPlayer(False);
                     end;
                   end;
          'firespot': begin
                        if not(loggedin) then
                          loginplayer;
                        if (WalkToSpot) then
                        begin
                          Players[CurrentPlayer].Loc := 'firetime';
                        end else
                        begin
                          writeln('Something went wrong during WalkToSpot. Next Player.');
                          SwitchPlayer(false);
                        end;
                      end;
          'firetime': begin
                        if not(loggedin) then
                          loginplayer;
                        if (MakeFires) then
                        begin
                          Players[CurrentPlayer].Loc := 'banky';
                        end else
                        begin
                          writeln('Something went wrong during MakeFires. Next Player.');
                          SwitchPlayer(false);
                        end;
                      end;
          end;
        until(false);
    end.

    Might see some weird stuff in there Keep in mind this is pretty much the first time I'm testing it, with all kinds of checks to see where is goes wrong, etc.

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

    Default

    Hmm... give each of the timing variables different names. Change them to one letter. Clicking = C, Burning = B, etc... Maybe "Clicking" is a global var? I am digging for answers... trial and error. I doubt this will fix it

  12. #12
    Join Date
    Sep 2007
    Location
    Pennsylvania
    Posts
    3,396
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Nope

  13. #13
    Join Date
    May 2007
    Location
    Some where fun.
    Posts
    2,891
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    leave it up to you to find an impossible to fix error

  14. #14
    Join Date
    Sep 2007
    Location
    Pennsylvania
    Posts
    3,396
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Grr. I tried commenting out the whole repeat/until loop, now I'm getting a completely absurd error:

    [Runtime Error] : Type Mismatch in line 262 in script C:\Program Files\SCAR 3.15\Scripts\ScapianFMer.scar


    For 2nd line of this:

    Code:
    repeat
        MouseItem(1,true);
        wait(randomrange(100,200));
        MMouseItem(i);
    I definitely have the right types on MouseItem.....

  15. #15
    Join Date
    Sep 2007
    Location
    Pennsylvania
    Posts
    3,396
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by lordsaturn View Post
    Not sure if this is your problem but SCAR is moody about directly accessing properties of records.
    Try changing
    SCAR Code:
    WalkToTileMS(Point(GetMyPos.x,GetMyPos.y+1),0,0);
    to
    SCAR Code:
    Pt := GetMyPos;
    Inc(Pt.y);
    WalkToTileMS(Pt,0,0);
    Wow, I never tried that, but then Method told me to try it. 'Lo and Behold, it worked O_O

    Thanks.

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
  •