Results 1 to 1 of 1

Thread: Need a little help with my script

  1. #1
    Join Date
    Mar 2007
    Location
    Mars, I thought all men were from Mars.
    Posts
    513
    Mentioned
    7 Post(s)
    Quoted
    124 Post(s)

    Default Need a little help with my script

    I'm making a cannon ball maker for use at the edge anvil. Right now all it does it smith steel bars. I plan on adding lots more to it so it's at it's most basic right now. All it does is:

    1: Withdraws iron ore from the first bank slot and coal from the second.
    2: Then walks to the furnace and smelts
    3: Walks back to bank and deposits and withdraws
    4: Repeats.

    The problem I'm having is it seems to always want to go thro the withdraw procedure twice and I keep getting the debug message when my char walks to furnace.
    Any suggestions?

    Code:
    Warning! You passed a wrong ys to a finder function: -5. That is below 0, thus out of bounds. Setting the value to 0 for now.
    Warning! You passed a wrong xs to a finder function: -16. That is below 0, thus out of bounds. Setting the value to 0 for now.
    Warning! You passed a wrong ys to a finder function: -5. That is below 0, thus out of bounds. Setting the value to 0 for now.
    Warning! You passed a wrong xs to a finder function: -16. That is below 0, thus out of bounds. Setting the value to 0 for now.
    Warning! You passed a wrong ys to a finder function: -5. That is below 0, thus out of bounds. Setting the value to 0 for now.
    Warning! You passed a wrong xs to a finder function: -16. That is below 0, thus out of bounds. Setting the value to 0 for now.
    Warning! You passed a wrong ys to a finder function: -5. That is below 0, thus out of bounds. Setting the value to 0 for now.
    Warning! You passed a wrong xs to a finder function: -16. That is below 0, thus out of bounds. Setting the value to 0 for now.
    Warning! You passed a wrong xs to a finder function: -16. That is below 0, thus out of bounds. Setting the value to 0 for now.
    Warning! You passed a wrong xs to a finder function: -16. That is below 0, thus out of bounds. Setting the value to 0 for now.
    Warning! You passed a wrong xs to a finder function: -16. That is below 0, thus out of bounds. Setting the value to 0 for now.
    Simba Code:
    ////////////////////Ignore This Part////////////////////////
    program New;                                              //
    {$DEFINE SMART}                                         //
    {$i srl/srl.scar}                                         //
    var x, y, count, WithdrawSlot1X, WithdrawSlot1Y,
    WithdrawSlot2X, WithdrawSlot2Y, furnace :integer;
    First_time :Boolean;
                   //
    //
    const                                                   //
    ////////////////////////////////////////////////////////////

    What_to_Make = 0; // 0 = Bars; 1 = Cannonballs; 2 = Both

    ////////////////////////////////////////////////////////////
    ///////////////////Begining of Script///////////////////////
    ////////////////////////////////////////////////////////////

    procedure Set_Up;
    begin
    case What_to_Make of
      0: begin
         WithdrawSlot1X := 52;
         WithdrawSlot1Y := 107;
         WithdrawSlot2X := 97;
         WithdrawSlot2Y := 107;
         end;
      1: begin
         WithdrawSlot1X := 52;
         WithdrawSlot1Y := 150;
         end;
       2: begin
         WithdrawSlot1X := 52;
         WithdrawSlot1Y := 107;
         WithdrawSlot2X := 97;
         WithdrawSlot2Y := 107;
         end;
    end;
    end;

    function Inv_Full: Boolean;
    var Ore :integer;
    begin
    Ore := DTMFromString('78DA637464626078CC800274A584E1ECFF40C' +
           '0E80654739D010D30814946288FD118C87F41408D3390FF86801A' +
           '3F20FF3901359640FE5DFC6A006A5A0B4E');

    if(FindDTM(Ore,x,y,557,281,599,316))then
      begin
      result:=true;
      end else result:=false;
     FreeDTM(Ore);
    end;



    function At_Furnace: Boolean;
    begin
    if(FindObjCustom(X, Y, ['Smel','elt Fu','Furnac','Smelt'], [1581994,1647793,1384347,1318548 ], 3)) then
      begin
      result:=true;
      end else result:=false;
    end;

    procedure Smelt;
    var Bar, Bar2: integer;
    begin
    Bar := DTMFromString('78DA63546464605804C448A0A9A606CEFE0F0' +
           '48CC240F915A86A181898C0244C94510BC85A42408D2690359380' +
           '1A29206B3601354A40D61AFC6A002FB70A29');
    Bar2:= DTMFromString('78DA6374626260D0666440064971B170F67F2' +
           '0603401AA314455C3C0C0042661A28CCE40BE050135DE44986305' +
           'E46B1250E305E4ABE057030002CF07DB');
    x := 389;
    y := 27;
    if(FindObjEX(X, Y, ['Smel','elt Fu','Furnac','Smelt'], [1581994,1647793,1384347,1318548 ], 10,50,326,24,492,128)) then
      begin
      Mouse(x,y,0,0,true)
      sleep(500+random(500))
      count := 0;
      repeat
      sleep(500+random(100));
      count := count + 1;
      until(FindDTM(Bar,x,y,269,397,310,440))or(count > 20)
      if(FindDTM(Bar,x,y,269,397,310,440))then
        begin
        Mouse(x,y,0,0,true)
        sleep(500+random(500))
        count := 0;
        repeat
        sleep(500+random(100));
        count := count + 1;
        until(FindDTM(Bar2,x,y,558,285,599,316))or(count > 40)
        if(count > 40)then
          begin
          writeln('Something went wrong, could not find bar to know when finished smelting');
          playsound('C:\botclient\config\sounds\alarm.wav');
          TerminateScript;
          end;
        end else
        begin
        writeln('Did not find seletion option')
        playsound('C:\botclient\config\sounds\alarm.wav');
        TerminateScript;
        end;
      end;
     FreeDTM(Bar);
     FreeDTM(Bar2);
    end;

    procedure Walk_to_Furnace;
    var furnace: integer;
    begin
    x := 670;
    y := 94;
    if(FindColorSpiralTolerance(x,y,15923957,670,72,672,94,20))then
      begin
      mouse(x,y-10,4,2,true);
      sleep(500+random(500));
      Flag;
      sleep(500+random(500));
      end;

    //Smelt;
    end;

    procedure Walk_to_Bank;
    begin
    x := 594;
    y := 108;
    if(FindColorSpiralTolerance(x,y,15923957,576,106,594,108,20))then
      begin
      mouse(x-5,y-2,2,3,true);
      sleep(500+random(500));
      Flag;
      sleep(500+random(500));
      end;
    end;





    procedure Withdraw_Items;
    begin
    if(First_time = true)then
      begin
      Mouse(WithdrawSlot1X-5, WithdrawSlot1Y-5, 10, 10, false)
      ChooseOption('Withdraw-X')
      sleep(500 + random(100));
      TypeSend('9');
      sleep(500 + random(500));
      First_time := false;
      end else
      begin
      Mouse(WithdrawSlot1X-5, WithdrawSlot1Y-5, 10, 10, false)
      sleep(200 + random(100));
      ChooseOption('Withdraw-9')
      sleep(500 + random(500));
      end;

    if(What_to_Make = 0) or (What_to_Make = 2)then
      begin
      Mouse(WithdrawSlot2X-5, WithdrawSlot2Y-5, 10, 10, false);
      sleep(200 + random(100));
      if(ChooseOption('Withdraw-All'))then
      sleep(500 + random(500));
      end;

    end;

    procedure Do_Banking;
    var Zx, Zy, RanX, RanY :integer;
    begin
    Zx := 240;
    Zy := 187;
    RanX := 25;
    RanY := 30;

    if not(BankScreen)then
      begin
      count := 0;
      repeat
        MMouse(Zx, Zy, RanX, RanY);
        sleep(500 + random(100));
        count := count + 1;
      until(IsUpTextMultiCustom(['Use C', 'Coun', 'unter']))or
           (count > 20)or(BankScreen);
      if(count > 20)then
        begin
        writeln('Could not find bank 1');
        end else
        begin
        GetMousePos(x,y)
        Mouse(x,y,0,0,false);
        sleep(200+random(100))
        ChooseOption('Use-quickly Counter')
        count := 0;
        repeat
        sleep(100+random(10))
        count := count +1;
        until(BankScreen) or (count > 100)
        if (count > 100)then
          begin
          writeln('Could not find bank 2');
          end;
        end;
      end;

    if(BankScreen)then
      begin
      DepositAll;
      Sleep(200+random(100));
      Withdraw_Items;
      Sleep(200+random(100));
      //CloseBank;
      end;
    end;

    procedure Main_Loop;
    begin
    if(Inv_Full)then
      begin
      if not(At_Furnace)then
        begin
        Walk_to_Furnace;
        Main_Loop;
        end else
        begin
        Smelt;
        Walk_to_Bank;
        end;
      end;
    Do_Banking;
    sleep(500+random(500))
    end;

    begin
    ClearDebug();
    Smart_Server := 117;
    SetupSRL();

    First_time := true;
    Set_Up;

    repeat
    Main_Loop;
    until(false)
    end.
    Last edited by bud_wis_er_420; 12-20-2011 at 05:38 AM.

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
  •