Results 1 to 10 of 10

Thread: script stopping in middle + buying help

  1. #1
    Join Date
    Oct 2006
    Posts
    702
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default script stopping in middle + buying help

    this is my first script in a long time, so its going to seem really basic. its also going to be private unless anyone wants a bucket buyer . Yes my srl is the latest, yes im using srl 3.14, yes my script compiles. but, these 2 problems have been plaguing me for a week now so i'm asking you guys. If you suggest something that i already said im doing (using scar 3.14 etc. etc.) you will be reported for trying to get post count + being a idiot.

    Problem 1 - Every procedure works on its own. I already tested them. I also know my script compiles. The problem is after it finds the clerk and gets the trade screen up, the script just stops. It terminates.

    Problem 2 - When i test the bucket buyer but itself, it doesnt stop buying buckets. It will buy buckets even if my inventory is full. i do have this in my script. if invcount = 28 then exit;. it still wont stop. I know i should include it in the findclerk procedure, but i took it out so i could test it.

    The Script-
    SCAR Code:
    program BuyBuckets;
    {.include SRL/SRL.scar}
    {.include SRL\SRL\Skill\BuySell.SCAR}


    var i, x, y, YBankers, Buckets: Integer;



    const

      StartPlayer = 0;
      ClerkColor = 5992070;
      BucketsWanted = 27;
      BC = 1724005;



    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := StartPlayer;

      Players[0].Name := ''; //Character name
      Players[0].Pass := ''; //Character password
      Players[0].Nick := ''; //3-4 non-capital letters from character name
      Players[0].Active := True; //Use this character?
    end;

    function RadialToleranceWalk(TheColor: Integer; StartRadial, EndRadial: Integer;
      Radius: Integer; Xmod, Ymod, Tol: Integer): Boolean; // By Wizzup? and WT-Fakawi.
    var
      i, X1, Y1, x, y: Integer;
    begin
      if (RoadColorChecker) then
        if (DebugRadialRoad) then
          WriteLn(' THROUGH RADIALROADWALK=  ---> ' + IntToStr(RoadColor));
      if (StartRadial = EndRadial) then
      begin
        WriteLn('Using LinearRoadWalk, equal values.')
          if LinearRoadWalk(TheColor, StartRadial, Radius, Xmod, Ymod) then
          Result := True;
      end
      else if (StartRadial < EndRadial) then
      begin
        repeat
          for i := StartRadial to EndRadial do
          begin
            x1 := Round(Radius * Sine(i)) + 646;
            y1 := Round(-Radius * Cose(i)) + 84;
            if not LoggedIn then Exit;
            if (FindColorTolerance(x, y, TheColor, X1, Y1, X1 + 1, Y1 + 1, Tol)) then
            begin
              MFNF(X, Y, Xmod, Ymod);
              Result := True;
              CountFlag(10);
              Exit;
            end;
          end;
          Radius := Radius - 4;
        until (Radius <= 1);
      end else
        if (StartRadial > EndRadial) then
        begin
          repeat
            for i := StartRadial downto EndRadial do
            begin
              x1 := Round(Radius * Sine(i)) + 646;
              y1 := Round(-Radius * Cose(i)) + 84;
              if not LoggedIn then Exit;
              if (FindColorTolerance(x, y, TheColor, X1, Y1, X1 + 1, Y1 + 1, Tol)) then
              begin
                MFNF(X, Y, Xmod, Ymod);
                Result := True;
                CountFlag(10);
                Exit;
              end;
            end;
            Radius := Radius - 4;
          until (Radius <= 1);
        end
    end;


    procedure DeclareDTMs;
    begin
      YBankers := DTMFromString('78DA63B4656460686700036608C5B063FB240' +
        '611200D9461F80F048C2E40561F030AF8F387094C3342F98C7644' +
        'A83107B226A0AA39738601558D2F90D58DAAE6EB5754350049A41' +
        '19B');

      Buckets := DTMFromString('78DA635CC7C0C07094010C982114C3DC464F0' +
        '61120CD08C4FF8180710590B197010554245B806946289F712B90' +
        '3888AA666A951BAA9AF540621BAA9A347F2954356B80C4495435F' +
        '39BBD51D56C0112C750D580DC8CAC060015971434');
    end;



    procedure ScriptSetup;
    begin
      ClearDebug;
      SetupSRL;
      DeclareDTMs;
      DeclarePlayers;
      LoginPlayer;
      SetRun(True);
      SetAngle(True);
      MakeCompass('n');
      FindNormalRandoms;
    end;

    procedure GeneralStoreWalk;
    begin
      if (not (LoggedIn)) then Exit;
      RoadColor := FindFallyRoadColor;
      i := 0;
      SymbolAccuracy := 0.8;
      RadialToleranceWalk(RoadColor, 10, 70, 45, x, y, 10);
      Flag;
      wait(100);
      if FindSymbol(x, y, 'Store') then
      begin
        Mouse(x, y, 2, 2, true);
        i := i + 1;
        FindNormalRandoms;
      end;
    end;

    procedure FindClerk;
    begin
      i := 0;
      MouseSpeed := 10;
      if (not (LoggedIn)) then Exit;
      if (FindObj(x, y, 'hop', ClerkColor, 5)) then
      begin
        Mouse(x, y, 0, 0, false);
        ChooseOption('rade');
      end else
        if (FindObjCustom(x, y, ['eep', 'ssi'], [2046549, 2900290], 10)) then
        begin
          Mouse(x, y, 0, 0, false);
          ChooseOption('rade');
        end else
          LogOut;
      TerminateScript;
    end;




    procedure BankWalk;
    begin
      if (not (LoggedIn)) then Exit;
      RoadColor := FindFallyRoadColor;
      SymbolAccuracy := 0.8;
      RadialToleranceWalk(RoadColor, 220, 180, 65, x, y, 10);
      flag;
      if FindSymbol(x, y, 'bank') then
      begin
        Mouse(x, y, 2, 2, true);
        flag;
        FindNormalRandoms;
        begin
          if DTMRotated(YBankers, x, y, MMX1, MMY1, MMX2, MMY2) then
          begin
            Mouse(x, y, 1, 1, True);
          end;
        end;
      end;
    end;



    procedure Bankit;
    begin
      if (not (LoggedIn)) then Exit;
      repeat
        if (not (Loggedin)) then break;
        OpenBankQuiet('fwb');
      until (BankScreen);
      if Bankscreen then
      begin
        Writeln('in bank');
        Deposit(2, 28, 2);
        CloseBank;
      end;
    end;

    procedure BuyBuckets;
    begin
      BuyColor(BC, 27);
      wait(500);
      i := 0 + 27;
      if invcount = 28 then
        exit;
    end;



    procedure MainLoop;
    begin
      repeat
        if not LoggedIn then LoginPlayer;
        ScriptSetup;
        GeneralStoreWalk;
        FindClerk;
        BuyBuckets;
        BankWalk;
        Bankit;
      until (i = BucketsWanted);
    end;



    begin
      ScriptSetup;
      MainLoop;
    end.
    "For it is not what goes into your mouth that will defile you; rather, it is what comes out of your mouth that defiles you." - Jesus of Nazareth

  2. #2
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    you need to add a begin and end at the end of the FindClerk procedure. You just have an else logout terminate without a begin and end so it logs out if everything above fails then terminates regardlss
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

  3. #3
    Join Date
    Oct 2006
    Posts
    702
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ok let me test it ill get back to you in a second. any idea about the buying?
    "For it is not what goes into your mouth that will defile you; rather, it is what comes out of your mouth that defiles you." - Jesus of Nazareth

  4. #4
    Join Date
    Mar 2006
    Posts
    3,051
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Try putting your "if InvCount=28 then exit" line at the beginning of the BuyBuckets procedure, instead of at the end.

    Putting it at the end doesn't make any sense because that's the last line anyway. If it's true, you exit the procedure. If it's false, you still exit the procedure because the procedure ends. If you put it as the first line of that procedure, then the script will never try to buy any buckets if your inventory is already full.

    Also, I think you want to put i:= i+27 not 0+27. And you should make it so that the main loop repeats until i>=BucketsWanted;


  5. #5
    Join Date
    Jan 2008
    Location
    UK
    Posts
    500
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Use this:
    SCAR Code:
    procedure FindClerk;
    begin
      i := 0;
      MouseSpeed := 10;
      if (not (LoggedIn)) then Exit;
      if (FindObj(x, y, 'hop', ClerkColor, 5)) then
      begin
        Mouse(x, y, 0, 0, false);
        ChooseOption('rade');
      end else
        if (FindObjCustom(x, y, ['eep', 'ssi'], [2046549, 2900290], 10)) then
        begin
          Mouse(x, y, 0, 0, false);
          ChooseOption('rade');
        end else
        begin
         LogOut;
         TerminateScript;
        end;
    end;

    As you had it, the final else was just LogOut. therefore TerminateScript was not in the If Statements and would always execute.


    try this:
    SCAR Code:
    procedure BuyBuckets;
    begin
      BuyColor(BC, 27);
      wait(500);
      i := 27;
      if InvFull then exit;
    end;

    Also I Don't understand why you have i := 0 + 27; Why not just i := 27; ??

    Edit:

    ahh I see what you want to do with i....

    You should use i := i + 27;
    i := 0 + 27; will mean that i is always 27 and you want to add 27 to the current value of i..

    Edit Edit:
    Also if your testing the buy procedure by itself are you sure you have taken it out of the repeat loop? Try moving invfull statement to before the buy i.e:
    SCAR Code:
    procedure BuyBuckets;
    begin
      if InvFull then exit;
      BuyColor(BC, 27);
      wait(500);
      i := i + 27;
    end;

    Although with the correct use of i the Invfull statement is meaningless and could be removed altogether as each visit fills yoru inventory.

    Edit Edit Edit:
    Whoops tarajunky didn't see your post there.. you must have added it whilst I was drafing the first draft of this overly edited reply..
    For the Ultimate Monk Fisher: Ultra Monkfish n Bank Click Here


  6. #6
    Join Date
    Oct 2006
    Posts
    702
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    THANKS to everyone for your help. i will try these fixes now. thanks to everyone that posted.
    "For it is not what goes into your mouth that will defile you; rather, it is what comes out of your mouth that defiles you." - Jesus of Nazareth

  7. #7
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    I think the problem with the over buying is that it buys 27 (because of "BuyColor(bc,27)"), so you could try getting how many items there are and getting it to buy the difference between current items and buckets wanted.
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

  8. #8
    Join Date
    Oct 2006
    Posts
    702
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ok now it does everything perfect, but for some reason, it skips the buying procedure. my invo is empty except coins. It gets the shop screen up , goes to the bank and trys to bank. heres an updated script.

    SCAR Code:
    program BuyBuckets;
    {.include SRL/SRL.scar}
    {.include SRL\SRL\Skill\BuySell.SCAR}


    var i, x, y, YBankers, Buckets: Integer;



    const

      StartPlayer = 0;
      ClerkColor = 5992070;
      BucketsWanted = 27;
      BC = 1724005;



    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := StartPlayer;

      Players[0].Name := ''; //Character name
      Players[0].Pass := ''; //Character password
      Players[0].Nick := ''; //3-4 non-capital letters from character name
      Players[0].Active := True; //Use this character?
    end;

    function RadialToleranceWalk(TheColor: Integer; StartRadial, EndRadial: Integer;
      Radius: Integer; Xmod, Ymod, Tol: Integer): Boolean; // By Wizzup? and WT-Fakawi.
    var
      i, X1, Y1, x, y: Integer;
    begin
      if (RoadColorChecker) then
        if (DebugRadialRoad) then
          WriteLn(' THROUGH RADIALROADWALK=  ---> ' + IntToStr(RoadColor));
      if (StartRadial = EndRadial) then
      begin
        WriteLn('Using LinearRoadWalk, equal values.')
          if LinearRoadWalk(TheColor, StartRadial, Radius, Xmod, Ymod) then
          Result := True;
      end
      else if (StartRadial < EndRadial) then
      begin
        repeat
          for i := StartRadial to EndRadial do
          begin
            x1 := Round(Radius * Sine(i)) + 646;
            y1 := Round(-Radius * Cose(i)) + 84;
            if not LoggedIn then Exit;
            if (FindColorTolerance(x, y, TheColor, X1, Y1, X1 + 1, Y1 + 1, Tol)) then
            begin
              MFNF(X, Y, Xmod, Ymod);
              Result := True;
              CountFlag(10);
              Exit;
            end;
          end;
          Radius := Radius - 4;
        until (Radius <= 1);
      end else
        if (StartRadial > EndRadial) then
        begin
          repeat
            for i := StartRadial downto EndRadial do
            begin
              x1 := Round(Radius * Sine(i)) + 646;
              y1 := Round(-Radius * Cose(i)) + 84;
              if not LoggedIn then Exit;
              if (FindColorTolerance(x, y, TheColor, X1, Y1, X1 + 1, Y1 + 1, Tol)) then
              begin
                MFNF(X, Y, Xmod, Ymod);
                Result := True;
                CountFlag(10);
                Exit;
              end;
            end;
            Radius := Radius - 4;
          until (Radius <= 1);
        end
    end;


    procedure DeclareDTMs;
    begin
      YBankers := DTMFromString('78DA63B4656460686700036608C5B063FB240' +
        '611200D9461F80F048C2E40561F030AF8F387094C3342F98C7644' +
        'A83107B226A0AA39738601558D2F90D58DAAE6EB5754350049A41' +
        '19B');

      Buckets := DTMFromString('78DA635CC7C0C07094010C982114C3DC464F0' +
        '61120CD08C4FF8180710590B197010554245B806946289F712B90' +
        '3888AA666A951BAA9AF540621BAA9A347F2954356B80C4495435F' +
        '39BBD51D56C0112C750D580DC8CAC060015971434');
    end;



    procedure ScriptSetup;
    begin
      ClearDebug;
      SetupSRL;
      DeclareDTMs;
      DeclarePlayers;
      LoginPlayer;
      SetRun(True);
      SetAngle(True);
      MakeCompass('n');
      FindNormalRandoms;
    end;

    procedure GeneralStoreWalk;
    begin
      if (not (LoggedIn)) then Exit;
      RoadColor := FindFallyRoadColor;
      i := 0;
      SymbolAccuracy := 0.8;
      RadialToleranceWalk(RoadColor, 10, 70, 45, x, y, 10);
      Flag;
      wait(100);
      if FindSymbol(x, y, 'Store') then
      begin
        Mouse(x, y, 2, 2, true);
        i := i + 1;
        FindNormalRandoms;
      end;
    end;

    procedure FindClerk;
    begin
      i := 0;
      MouseSpeed := 10;
      if (not (LoggedIn)) then Exit;
      if (FindObj(x, y, 'hop', ClerkColor, 5)) then
      begin
        Mouse(x, y, 0, 0, false);
        ChooseOption('rade');
      end else
        if (FindObjCustom(x, y, ['eep', 'ssi'], [2046549, 2900290], 10)) then
        begin
          Mouse(x, y, 0, 0, false);
          ChooseOption('rade');
        end else
        begin
          LogOut;
          TerminateScript;
        end;
    end;






    procedure BankWalk;
    begin
      if (not (LoggedIn)) then Exit;
      RoadColor := FindFallyRoadColor;
      SymbolAccuracy := 0.8;
      RadialToleranceWalk(RoadColor, 220, 180, 65, x, y, 10);
      flag;
      if FindSymbol(x, y, 'bank') then
      begin
        Mouse(x, y, 2, 2, true);
        flag;
        FindNormalRandoms;
        begin
          if DTMRotated(YBankers, x, y, MMX1, MMY1, MMX2, MMY2) then
          begin
            Mouse(x, y, 1, 1, True);
          end;
        end;
      end;
    end;



    procedure Bankit;
    begin
      if (not (LoggedIn)) then Exit;
      repeat
        if (not (Loggedin)) then break;
        OpenBankQuiet('fwb');
      until (BankScreen);
      if Bankscreen then
      begin
        Writeln('in bank');
        Deposit(2, 28, 2);
        CloseBank;
      end;
    end;

    procedure BuyBuckets;
    begin
      if invcount = 28 then exit;
      BuyColor(BC, 27);
      wait(500);
      i := i + 27;
    end;



    procedure MainLoop;
    begin
      repeat
        if not LoggedIn then LoginPlayer;
        ScriptSetup;
        GeneralStoreWalk;
        wait(2000);
        FindClerk;
        BuyBuckets;
        BankWalk;
        Bankit;
      until (i = BucketsWanted);
    end;



    begin
      ScriptSetup;
      MainLoop;
    end.
    "For it is not what goes into your mouth that will defile you; rather, it is what comes out of your mouth that defiles you." - Jesus of Nazareth

  9. #9
    Join Date
    Mar 2006
    Posts
    3,051
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    I would guess it's a problem with BuyColor, since I've never used that.

    Or it might be because you aren't waiting long enough for the store screen to open, so it tries to buy before it can find the item.

    You should add failsafes to each procedure.

    Like for FindClerk, after you have done everything, you should check to see if the store screen is open. If not, then you can have it writeln some sort of error message and then re-run the procedure. For BuyBuckets, after the BuyColor procedure, you could make sure that you actually have a bucket in your inventory by using a simple FindDTM search. If not, then have it writeln an error message about the bucket being missing, then have it re-run the procedure.

    That will give you a lot of information that can help you troubleshoot it.


  10. #10
    Join Date
    Oct 2006
    Posts
    702
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ok to check the shopscreen, should i use
    SCAR Code:
    if not (shopscreen) then
    etc.

    also if you want to please add my msn, alexrex7@cox.net
    "For it is not what goes into your mouth that will defile you; rather, it is what comes out of your mouth that defiles you." - Jesus of Nazareth

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Buying A Script That Collects...
    By badaa in forum RS3 Outdated / Broken Scripts
    Replies: 8
    Last Post: 06-24-2007, 04:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •