Results 1 to 13 of 13

Thread: Type mismatch in script.

  1. #1
    Join Date
    Nov 2007
    Location
    UK
    Posts
    242
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Type mismatch in script.

    Okay, i made this script
    SCAR Code:
    program Willow_Chopper;

      var
      x,y,cx,cy,i,TreesChopped,loadzdone,loadz:Integer;
    {.include SRL/SRL/Misc/Smart.scar}
    {.include srl/srl.scar}
    {.include srl/srl/skill/woodcutting.scar}

    const
    ///Set up your colors below///
    WillowColor1 = 4487022;

    CurrentVersion  =  '2.0';// no need to change this

    yourSRLID='';

    yourSRLPW='';

    WillowColor2 = 4480100;

    loads = 10;//How many loads to do?

    TreeBaseColor = 472887;//See the topic for instructions!

    BoothColor1 = 739167;//You have to set these colors

    BoothColor2 = 671057;

    SmartWorld = 142;//smart world :)

    Procedure DeclarePlayers;
    begin
      HowManyPlayers := 3;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name := '';
      Players[0].Pass := '';
      Players[0].Nick := ''; //3 - 4 letters of YOUR username, example: "sern"
      Players[0].Active :=True; //Do not use capital letters or numbers.

      Players[1].Name := '';
      Players[1].Pass := '';
      Players[1].Nick := ''; //3 - 4 letters of YOUR username, example: "sern"
      Players[1].Active :=True; //Do not use capital letters or numbers.

      Players[2].Name := '';
      Players[2].Pass := '';
      Players[2].Nick := ''; //3 - 4 letters of YOUR username, example: "sern"
      Players[2].Active :=True; //Do not use capital letters or numbers.
    end;

    {****************************************************************************}
    {Procedure BankWalk                                                          }
    {By: Wade007                                                                 }
    {Description: This will walk to to the bank                                  }
    {****************************************************************************}


    Procedure BankWalk;
     begin
      RadialWalk(FindRoadColor,0,90,50,5,5)
      Flag;
      if(FindSymbol(x,y,'bank'))then
       begin
       writeln('Walking To bank!')
       Mouse(x,y,2,2,true)
       flag;
       FindNormalRandoms;
      end;
    end;
    {****************************************************************************
    Procedure WillowWalk
    By: Wade007
    Description: This will walk you to willows.
    {****************************************************************************}


    Procedure WillowWalk;
     begin
      If(Not(LoggedIn)) then LoginPlayer;
      setangle(true)
      RadialWalk(TreeBaseColor,170,240,50,4,4)
      Status('Walking to willows!')
      writeln('Walking to willows!')

     end;

    {*****************************************************************************
    function InFight: Boolean;
    By: WT-Fakawi
    Description: Returns as True if in fight.
    *****************************************************************************}


    function InFight: Boolean;
    var
      x, y : Integer;
    begin
      Result := (FindColor(x, y, 65280, 230, 130, 280, 180) or FindColor(x, y, 255,
        230, 130, 280, 180))
    end;
    {****************************************************************************
    Procedure Depositing
    By: the find and open bank part is by Wade007 and the deposit part is by frozen_soul
    Description: This will deposit your logs.
    *****************************************************************************}



    procedure Depositing;
      begin
        if FindObjCustom(cx, cy, ['booth', 'ooth'], [BoothColor1, BoothColor2], 3) then
          begin
          repeat
          Status('Banking');
          Mouse(cx,cy,2,2,false)
          chooseoption('Use-quickly')
          wait(1000)
           until(bankscreen)
             Begin
              for i := 2 to 28 do
              Begin
              if ExistsItem(i) then
              Begin
              MouseItem(i, false);
              ChooseOption('ll');
              Wait(1000 + random(500));
             end;
            end;
        Mouse(485, 41, 4, 4, True);
        Wait(500 + random(250));
      end;
           {case random(2) of
              1: Deposit(2, 28, 2)
              2: Deposit(2, 28, 2)
              end;}

          closebank;
          FindNormalRandoms;
          loadzdone := loadzdone+1
          WillowWalk;
      end;
    end;

    {****************************************************************************
    Procedure: ChopDemWillows
    By: Wade007
    Description: This Chops trees (DUH!)
    *****************************************************************************}



    Procedure ChopDemWillows;
     var tries:Integer;
     Begin
       if FindObjCustom(cx, cy, ['illow', 'llow'], [WillowColor1, WillowColor2], 3) then
         begin
         Status('Chopping Willows');
         if(FindEnt(cx, cy, True))then exit;
         Mouse(cx,cy,2,2,False)
         ChooseOption('hop')
         flag;
         Wait(4000+random(800))
         TreesChopped := TreesChopped+1
         FindNormalRandoms;
     end else
      begin
        tries := tries+1;
        if (tries = 10)then
         begin
          Writeln('Could not find any trees :(')
          Writeln('Try changing the colors.')
         NextPlayer(false);
       end;
      end;
    end;

    {****************************************************************************
    Procedure FFindEnt
    By: Osmm
    Description: This will find an ent, and run away from it.
    *****************************************************************************}



    function FFindEnt(fx, fy: Integer; AvoidWhenFound: Boolean): Boolean;
    var
      arUpTextEntColorPoints: TPointArray;
      x, y, EntTime, tcts: Integer;
    begin
      if not(LoggedIn)then exit;
      GetMousePos(x, y);
      if(x <> fx)or(y <> fy)then
      mmouse(fx, fy, 0, 0);
      if(IsUpText('Chop'))then
      begin
        tcts := GetColorToleranceSpeed;
        ColorToleranceSpeed(2);
        SetColorspeed2Modifiers(0.4, 0.4);
        FindColorsTolerance(arUpTextEntColorPoints, 51657, 80, 6, 127, 20, 5);
        Result := Length(arUpTextEntColorPoints) > 10;
        ColorToleranceSpeed(tcts);
      end;
      if(result)then
        begin
          MarkTime(EntTime);
          WriteLn('Ent Found!!');
          Writeln('Waiting for it to go away.');
          begin
            case random(10) of
              1: mouse(628, 85, 5, 5, true);
              2: DoEmote(4);
              3: BoredHuman;
            end;
          end;
          Inc(EntsAvoided);
        end;
    end;

    {****************************************************************************
    Procedure Proggy
    By: Wade007
    Description: This will print a proggy to the debug box.
    *****************************************************************************}


    Procedure Proggy;
    begin
      Writeln('Willow Chopper by wade007 has run for ' +TimeRunning)
      Writeln('Willow Chopper has Chopped ' +intToStr(TreesChopped)+ ' Trees')
      if (loadzdone = loadz) then
        begin
        Writeln('We have done all the loads you said to!')
        end else
          begin
          Writeln('We have not done all the loads specified')
          end;
    end;


    {****************************************************************************
    Procedure: Running
    By: Wade007
    Description: This TINY procedure will run away if it is in a fight.
    *****************************************************************************}


    Procedure Running;
    begin
      If (InFight) then
        begin
        Writeln('We have found a fight! Running away!')
        Status('Running');
        BankWalk;
        wait(2000)
        WillowWalk;
        end else
         begin
         Exit;
         end;
    end;


    {****************************************************************************
    Procedure: SetUp
    By: Wade007
    Description: this will run when it is start up....
    *****************************************************************************}



    procedure SetUp;
    begin
      SetUpSRL;
      ScriptID := '651';
      if not(yourSRLID = '') then SRLID := yourSRLID;
      if not(yourSRLPW = '') then SRLPassword := yourSRLPW;
      If (GetPage('http://wade007.freehostia.com/version.txt')) > '2.0' then
      begin
      Writeln('Hmm... Your version is not up to date. please get the new update from the topic.')
      Writeln('I hope to have a direct download link for this in the near future.')
      TerminateScript;
      end else
       begin
       writeln('You have the latest version, Continueing.')
       end;
    end;


    {****************************************************************************
    MAIN LOOP
    Description: This is where it all begins...
    *****************************************************************************}



    begin
        SmartSetupEx((SmartWorld),false,false);
        SetTargetDC(SmartGetDC);
     SetupSRL;
     ClearDebug;
     DeclarePlayers;
     ActivateClient;
     SetUp;
      repeat
      If (not (loggedIn)) then loginplayer;
      WillowWalk;
      FindNormalRandoms;
       repeat
       ChopDemWillows;
       solvesandwich;
       Running;
       FindNormalRandoms;
       Until(InvFull)
      Running;
      bankWalk;
      wait(100)
      depositing;
      SetUp;
      ClearDebug;
      Proggy;
      i := +1
     until(loadzdone = loadz)
      ClearDebug;
      Proggy;
     end.
    And i get a type mismatch, any help?

  2. #2
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Edit: Works fine for me...

    What SRL and SCAR version do you have?

  3. #3
    Join Date
    Nov 2007
    Location
    UK
    Posts
    242
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    OOPZ! wrong version
    SCAR Code:
    program Willow_Chopper;
    {.include SRL/SRL/Misc/Smart.scar}
    {.include srl/srl.scar}
    {.include srl/srl/skill/woodcutting.scar}
      var
      frmDesign : TForm;
      Username : TEdit;
      Password : TEdit;
      SmartWorld : TEdit;
      TreeBaseColor : TEdit;
      Start : TButton;
      Loads : TEdit;
      x , y , cx , cy , i , TreesChopped , loadsdone : Integer;
      loadz : string;
      TreeBaseColor1 : String;

    {.include SRL/SRL/Misc/Smart.scar}
    {.include srl/srl.scar}
    {.include srl/srl/skill/woodcutting.scar}

    const
    ///Set up your colors below///
    WillowColor1 = 4487022;

    CurrentVersion  =  '2.0';// no need to change this

    yourSRLID='';

    yourSRLPW='';

    WillowColor2 = 4480100;

    BoothColor1 = 739167;//You have to set these colors If it cannot find the bank booth

    BoothColor2 = 671057;




    Procedure InitForm;
    begin
    frmDesign := CreateForm;
    frmDesign.Left := 656;
    frmDesign.Top := 223;
    frmDesign.Width := 220;
    frmDesign.Height := 248;
    frmDesign.Caption := 'Willow Chopper';
    frmDesign.Color := clBtnFace;
    frmDesign.Font.Color := clWindowText;
    frmDesign.Font.Height := -14;
    frmDesign.Font.Name := 'MS Sans Serif';
    frmDesign.Font.Style := [];
    frmDesign.Visible := False;
    frmDesign.PixelsPerInch := 120;
    Username := TEdit.Create(frmDesign);
    Username.Parent := frmDesign;
    Username.Left := 8;
    Username.Top := 8;
    Username.Width := 113;
    Username.Height := 24;
    Username.TabOrder := 8;
    Username.Text := 'Username';
    Password := TEdit.Create(frmDesign);
    Password.Parent := frmDesign;
    Password.Left := 8;
    Password.Top := 48;
    Password.Width := 113;
    Password.Height := 24;
    Password.TabOrder := 9;
    Password.Text := 'Password';
    SmartWorld := TEdit.Create(frmDesign);
    SmartWorld.Parent := frmDesign;
    SmartWorld.Left := 8;
    SmartWorld.Top := 88;
    SmartWorld.Width := 113;
    SmartWorld.Height := 24;
    SmartWorld.TabOrder := 10;
    SmartWorld.Text := 'SmartWorld';
    TreeBaseColor := TEdit.Create(frmDesign);
    TreeBaseColor.Parent := frmDesign;
    TreeBaseColor.Left := 8;
    TreeBaseColor.Top := 128;
    TreeBaseColor.Width := 113;
    TreeBaseColor.Height := 24;
    TreeBaseColor.TabOrder := 11;
    TreeBaseColor.Text := 'TreeBaseColor';
    Start := TButton.Create(frmDesign);
    Start.Parent := frmDesign;
    Start.Left := 8;
    Start.Top := 168;
    Start.Width := 97;
    Start.Height := 25;
    Start.Caption := 'Start';
    Start.TabOrder := 12;
    Loads := TEdit.Create(frmDesign);
    Loads.Parent := frmDesign;
    Loads.Left := 120;
    Loads.Top := 48;
    Loads.Width := 89;
    Loads.Height := 24;
    Loads.TabOrder := 13;
    Loads.Text := 'Loads';
    end;

    Procedure SafeInitForm;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('InitForm', v);
    end;

    Procedure ShowFormModal;
    begin
      frmDesign.ShowModal;
    end;

    Procedure SafeShowFormModal;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('ShowFormModal', v);
    end;

    Procedure SetupFormz;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name := Username.text;
      Players[0].Pass := Password.text;
      Loads.text := loadz;
      TreeBaseColor.Text := TreeBaseColor1;
    end;



    {****************************************************************************}
    {Procedure BankWalk                                                          }
    {By: Wade007                                                                 }
    {Description: This will walk to to the bank                                  }
    {****************************************************************************}


    Procedure BankWalk;
     begin
      RadialWalk(FindRoadColor,0,90,50,5,5)
      Flag;
      if(FindSymbol(x,y,'bank'))then
       begin
       writeln('Walking To bank!')
       Mouse(x,y,2,2,true)
       flag;
       FindNormalRandoms;
      end;
    end;
    {****************************************************************************
    Procedure WillowWalk
    By: Wade007
    Description: This will walk you to willows.
    {****************************************************************************}


    Procedure WillowWalk;
     begin
      If(Not(LoggedIn)) then LoginPlayer;
      setangle(true)
      Status('Walking to willows')
      writeln('Walking to willows')

     end;
    {*****************************************************************************
    function InFight: Boolean;
    By: WT-Fakawi
    Description: Returns as True if in fight.
    *****************************************************************************}


    function InFight: Boolean;
    var
      x, y : Integer;
    begin
      Result := (FindColor(x, y, 65280, 230, 130, 280, 180) or FindColor(x, y, 255,
        230, 130, 280, 180))
    end;
    {****************************************************************************
    Procedure Depositing
    By: the find and open bank part is by Wade007 and the deposit part is by frozen_soul
    Description: This will deposit your logs.
    *****************************************************************************}



    procedure Depositing;
      begin
        if FindObjCustom(cx, cy, ['booth', 'ooth'], [BoothColor1, BoothColor2], 3) then
          begin
          repeat
          Status('Banking');
          Mouse(cx,cy,2,2,false)
          chooseoption('Use-quickly')
          wait(1000)
           until(bankscreen)
             Begin
              for i := 2 to 28 do
              Begin
              if ExistsItem(i) then
              Begin
              MouseItem(i, false);
              ChooseOption('ll');
              Wait(1000 + random(500));
             end;
            end;
        Mouse(485, 41, 4, 4, True);
        Wait(500 + random(250));
      end;
           {case random(2) of       //Use this if the banking doesn't work.
              1: Deposit(2, 28, 2)
              2: Deposit(2, 28, 2)
              end;}

          closebank;
          FindNormalRandoms;
          loadsdone := loadsdone+1
          WillowWalk;
      end;
    end;

    {****************************************************************************
    Procedure: ChopDemWillows
    By: Wade007
    Description: This Chops trees (DUH!)
    *****************************************************************************}



    Procedure ChopDemWillows;
     var tries:Integer;
     Begin
       if FindObjCustom(cx, cy, ['illow', 'llow'], [WillowColor1, WillowColor2], 3) then
         begin
         Status('Chopping Willows');
         if(FindEnt(cx, cy, True))then exit;
         Mouse(cx,cy,2,2,False)
         ChooseOption('hop')
         flag;
         Wait(4000+random(800))
         TreesChopped := TreesChopped+1
         FindNormalRandoms;
     end else
      begin
        tries := tries+1;
        if (tries = 10)then
         begin
          Writeln('Could not find any trees :(')
          Writeln('Try changing the colors.')
         NextPlayer(false);
       end;
      end;
    end;

    {****************************************************************************
    Procedure FFindEnt
    By: Osmm
    Description: This will find an ent, and run away from it.
    *****************************************************************************}



    function FFindEnt(fx, fy: Integer; AvoidWhenFound: Boolean): Boolean;
    var
      arUpTextEntColorPoints: TPointArray;
      x, y, EntTime, tcts: Integer;
    begin
      if not(LoggedIn)then exit;
      GetMousePos(x, y);
      if(x <> fx)or(y <> fy)then
      mmouse(fx, fy, 0, 0);
      if(IsUpText('Chop'))then
      begin
        tcts := GetColorToleranceSpeed;
        ColorToleranceSpeed(2);
        SetColorspeed2Modifiers(0.4, 0.4);
        FindColorsTolerance(arUpTextEntColorPoints, 51657, 80, 6, 127, 20, 5);
        Result := Length(arUpTextEntColorPoints) > 10;
        ColorToleranceSpeed(tcts);
      end;
      if(result)then
        begin
          MarkTime(EntTime);
          WriteLn('Ent Found!!');
          Writeln('Waiting for it to go away.');
          begin
            case random(10) of
              1: mouse(628, 85, 5, 5, true);
              2: DoEmote(4);
              3: BoredHuman;
            end;
          end;
          Inc(EntsAvoided);
        end;
    end;

    {****************************************************************************
    Procedure Proggy
    By: Wade007
    Description: This will print a proggy to the debug box.
    *****************************************************************************}


    Procedure Proggy;
    begin
      Writeln('Willow Chopper by wade007 has run for ' +TimeRunning)
      Writeln('Willow Chopper has Chopped ' +intToStr(TreesChopped)+ ' Trees')
    end;


    {****************************************************************************
    Procedure: Running
    By: Wade007
    Description: This TINY procedure will run away if it is in a fight.
    *****************************************************************************}


    Procedure Running;
    begin
      If (InFight) then
        begin
        Writeln('We have found a fight! Running away!')
        Status('Running');
        BankWalk;
        wait(2000)
        WillowWalk;
        end else
         begin
         Exit;
         end;
    end;


    {****************************************************************************
    Procedure: SetUp
    By: Wade007
    Description: this will run when it is start up....
    *****************************************************************************}



    procedure SetUp;
    begin
      SetUpSRL;
      ScriptID := '651';
      if not(yourSRLID = '') then SRLID := yourSRLID;
      if not(yourSRLPW = '') then SRLPassword := yourSRLPW;
      If (GetPage('http://wade007.freehostia.com/version.txt')) > '2.0' then
      begin
      Writeln('Hmm... Your version is not up to date. please get the new update from the topic.')
      Writeln('I hope to have a direct download link for this in the near future.')
      logout;
      end else
       begin
       writeln('You have the latest version, Continueing.')
       end;
    end;


    {****************************************************************************
    MAIN LOOP
    Description: This is where it all begins...
    *****************************************************************************}



    begin
        SmartSetupEx((124),false,false);
        SetTargetDC(SmartGetDC);
      SetupSRL;
      SafeInitForm;
      SafeShowFormModal;
      SetupFormz;
     ActivateClient;
     SetUp;
      repeat
      If (not (loggedIn)) then loginplayer;
      WillowWalk;
      FindNormalRandoms;
       repeat
       ChopDemWillows;
       solvesandwich;
       Running;
       FindNormalRandoms;
       Until(InvFull)
      Running;
      bankWalk;
      wait(100)
      depositing;
      SetUp;
      ClearDebug;
      Proggy;
      i := +1
     until(loadsdone = loadz)
      ClearDebug;
      Proggy;
     end.
    Try to compile it next time.
    Now i get a Line 6: [Error] (12608:11): Duplicate identifier 'MOVEMOUSE' in script C:\SCAR 3.12c\includes\SRL/SRL/Misc/Smart.scar error

  4. #4
    Join Date
    Jun 2007
    Location
    Ohio
    Posts
    341
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Take out the :

    {.include Srl yada yada}

    the second time. you only need it once. that should fix it

  5. #5
    Join Date
    Nov 2007
    Location
    UK
    Posts
    242
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I still get a mismatch error

  6. #6
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You have Scar 3.12 -.- Get 3.14.

    Edit: You also have included the things two times. Just put it below Program.

    You get Duplicate Identifier because you included the SRL stuff two times. If you delete that it dosen't work because you have 1 repeat and 2 untils. Put a new repeat for the 2nd until. And on last until use StrToInt.

  7. #7
    Join Date
    Nov 2007
    Location
    UK
    Posts
    242
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Dude, i did all that,
    "Line 389: [Error] (12974:24): Type mismatch in script "

  8. #8
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Are you sure? You have Repeat, Until(loadsdone = loadz); anyways

    SCAR Code:
    program Willow_Chopper;
    {.include SRL/SRL/Misc/Smart.scar}
    {.include srl/srl.scar}
    {.include srl/srl/skill/woodcutting.scar}
      var
      frmDesign : TForm;
      Username : TEdit;
      Password : TEdit;
      SmartWorld : TEdit;
      TreeBaseColor : TEdit;
      Start : TButton;
      Loads : TEdit;
      x , y , cx , cy , i , TreesChopped , loadsdone : Integer;
      loadz : string;
      TreeBaseColor1 : String;

    const
    ///Set up your colors below///
    WillowColor1 = 4487022;

    CurrentVersion  =  '2.0';// no need to change this

    yourSRLID='';

    yourSRLPW='';

    WillowColor2 = 4480100;

    BoothColor1 = 739167;//You have to set these colors If it cannot find the bank booth

    BoothColor2 = 671057;




    Procedure InitForm;
    begin
    frmDesign := CreateForm;
    frmDesign.Left := 656;
    frmDesign.Top := 223;
    frmDesign.Width := 220;
    frmDesign.Height := 248;
    frmDesign.Caption := 'Willow Chopper';
    frmDesign.Color := clBtnFace;
    frmDesign.Font.Color := clWindowText;
    frmDesign.Font.Height := -14;
    frmDesign.Font.Name := 'MS Sans Serif';
    frmDesign.Font.Style := [];
    frmDesign.Visible := False;
    frmDesign.PixelsPerInch := 120;
    Username := TEdit.Create(frmDesign);
    Username.Parent := frmDesign;
    Username.Left := 8;
    Username.Top := 8;
    Username.Width := 113;
    Username.Height := 24;
    Username.TabOrder := 8;
    Username.Text := 'Username';
    Password := TEdit.Create(frmDesign);
    Password.Parent := frmDesign;
    Password.Left := 8;
    Password.Top := 48;
    Password.Width := 113;
    Password.Height := 24;
    Password.TabOrder := 9;
    Password.Text := 'Password';
    SmartWorld := TEdit.Create(frmDesign);
    SmartWorld.Parent := frmDesign;
    SmartWorld.Left := 8;
    SmartWorld.Top := 88;
    SmartWorld.Width := 113;
    SmartWorld.Height := 24;
    SmartWorld.TabOrder := 10;
    SmartWorld.Text := 'SmartWorld';
    TreeBaseColor := TEdit.Create(frmDesign);
    TreeBaseColor.Parent := frmDesign;
    TreeBaseColor.Left := 8;
    TreeBaseColor.Top := 128;
    TreeBaseColor.Width := 113;
    TreeBaseColor.Height := 24;
    TreeBaseColor.TabOrder := 11;
    TreeBaseColor.Text := 'TreeBaseColor';
    Start := TButton.Create(frmDesign);
    Start.Parent := frmDesign;
    Start.Left := 8;
    Start.Top := 168;
    Start.Width := 97;
    Start.Height := 25;
    Start.Caption := 'Start';
    Start.TabOrder := 12;
    Loads := TEdit.Create(frmDesign);
    Loads.Parent := frmDesign;
    Loads.Left := 120;
    Loads.Top := 48;
    Loads.Width := 89;
    Loads.Height := 24;
    Loads.TabOrder := 13;
    Loads.Text := 'Loads';
    end;

    Procedure SafeInitForm;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('InitForm', v);
    end;

    Procedure ShowFormModal;
    begin
      frmDesign.ShowModal;
    end;

    Procedure SafeShowFormModal;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('ShowFormModal', v);
    end;

    Procedure SetupFormz;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name := Username.text;
      Players[0].Pass := Password.text;
      Loads.text := loadz;
      TreeBaseColor.Text := TreeBaseColor1;
    end;



    {****************************************************************************}
    {Procedure BankWalk                                                          }
    {By: Wade007                                                                 }
    {Description: This will walk to to the bank                                  }
    {****************************************************************************}


    Procedure BankWalk;
     begin
      RadialWalk(FindRoadColor,0,90,50,5,5)
      Flag;
      if(FindSymbol(x,y,'bank'))then
       begin
       writeln('Walking To bank!')
       Mouse(x,y,2,2,true)
       flag;
       FindNormalRandoms;
      end;
    end;
    {****************************************************************************
    Procedure WillowWalk
    By: Wade007
    Description: This will walk you to willows.
    {****************************************************************************}


    Procedure WillowWalk;
     begin
      If(Not(LoggedIn)) then LoginPlayer;
      setangle(true)
      Status('Walking to willows')
      writeln('Walking to willows')

     end;
    {*****************************************************************************
    function InFight: Boolean;
    By: WT-Fakawi
    Description: Returns as True if in fight.
    *****************************************************************************}


    function InFight: Boolean;
    var
      x, y : Integer;
    begin
      Result := (FindColor(x, y, 65280, 230, 130, 280, 180) or FindColor(x, y, 255,
        230, 130, 280, 180))
    end;
    {****************************************************************************
    Procedure Depositing
    By: the find and open bank part is by Wade007 and the deposit part is by frozen_soul
    Description: This will deposit your logs.
    *****************************************************************************}



    procedure Depositing;
      begin
        if FindObjCustom(cx, cy, ['booth', 'ooth'], [BoothColor1, BoothColor2], 3) then
          begin
          repeat
          Status('Banking');
          Mouse(cx,cy,2,2,false)
          chooseoption('Use-quickly')
          wait(1000)
           until(bankscreen)
             Begin
              for i := 2 to 28 do
              Begin
              if ExistsItem(i) then
              Begin
              MouseItem(i, false);
              ChooseOption('ll');
              Wait(1000 + random(500));
             end;
            end;
        Mouse(485, 41, 4, 4, True);
        Wait(500 + random(250));
      end;
           {case random(2) of       //Use this if the banking doesn't work.
              1: Deposit(2, 28, 2)
              2: Deposit(2, 28, 2)
              end;}

          closebank;
          FindNormalRandoms;
          loadsdone := loadsdone+1
          WillowWalk;
      end;
    end;

    {****************************************************************************
    Procedure: ChopDemWillows
    By: Wade007
    Description: This Chops trees (DUH!)
    *****************************************************************************}



    Procedure ChopDemWillows;
     var tries:Integer;
     Begin
       if FindObjCustom(cx, cy, ['illow', 'llow'], [WillowColor1, WillowColor2], 3) then
         begin
         Status('Chopping Willows');
         if(FindEnt(cx, cy, True))then exit;
         Mouse(cx,cy,2,2,False)
         ChooseOption('hop')
         flag;
         Wait(4000+random(800))
         TreesChopped := TreesChopped+1
         FindNormalRandoms;
     end else
      begin
        tries := tries+1;
        if (tries = 10)then
         begin
          Writeln('Could not find any trees :(')
          Writeln('Try changing the colors.')
         NextPlayer(false);
       end;
      end;
    end;

    {****************************************************************************
    Procedure FFindEnt
    By: Osmm
    Description: This will find an ent, and run away from it.
    *****************************************************************************}



    function FFindEnt(fx, fy: Integer; AvoidWhenFound: Boolean): Boolean;
    var
      arUpTextEntColorPoints: TPointArray;
      x, y, EntTime, tcts: Integer;
    begin
      if not(LoggedIn)then exit;
      GetMousePos(x, y);
      if(x <> fx)or(y <> fy)then
      mmouse(fx, fy, 0, 0);
      if(IsUpText('Chop'))then
      begin
        tcts := GetColorToleranceSpeed;
        ColorToleranceSpeed(2);
        SetColorspeed2Modifiers(0.4, 0.4);
        FindColorsTolerance(arUpTextEntColorPoints, 51657, 80, 6, 127, 20, 5);
        Result := Length(arUpTextEntColorPoints) > 10;
        ColorToleranceSpeed(tcts);
      end;
      if(result)then
        begin
          MarkTime(EntTime);
          WriteLn('Ent Found!!');
          Writeln('Waiting for it to go away.');
          begin
            case random(10) of
              1: mouse(628, 85, 5, 5, true);
              2: DoEmote(4);
              3: BoredHuman;
            end;
          end;
          Inc(EntsAvoided);
        end;
    end;

    {****************************************************************************
    Procedure Proggy
    By: Wade007
    Description: This will print a proggy to the debug box.
    *****************************************************************************}


    Procedure Proggy;
    begin
      Writeln('Willow Chopper by wade007 has run for ' +TimeRunning)
      Writeln('Willow Chopper has Chopped ' +intToStr(TreesChopped)+ ' Trees')
    end;


    {****************************************************************************
    Procedure: Running
    By: Wade007
    Description: This TINY procedure will run away if it is in a fight.
    *****************************************************************************}


    Procedure Running;
    begin
      If (InFight) then
        begin
        Writeln('We have found a fight! Running away!')
        Status('Running');
        BankWalk;
        wait(2000)
        WillowWalk;
        end else
         begin
         Exit;
         end;
    end;


    {****************************************************************************
    Procedure: SetUp
    By: Wade007
    Description: this will run when it is start up....
    *****************************************************************************}



    procedure SetUp;
    begin
      SetUpSRL;
      ScriptID := '651';
      if not(yourSRLID = '') then SRLID := yourSRLID;
      if not(yourSRLPW = '') then SRLPassword := yourSRLPW;
      If (GetPage('http://wade007.freehostia.com/version.txt')) > '2.0' then
      begin
      Writeln('Hmm... Your version is not up to date. please get the new update from the topic.')
      Writeln('I hope to have a direct download link for this in the near future.')
      logout;
      end else
       begin
       writeln('You have the latest version, Continueing.')
       end;
    end;


    {****************************************************************************
    MAIN LOOP
    Description: This is where it all begins...
    *****************************************************************************}



    begin
        SmartSetupEx((124),false,false);
        SetTargetDC(SmartGetDC);
      SetupSRL;
      SafeInitForm;
      SafeShowFormModal;
      SetupFormz;
     ActivateClient;
     SetUp;
      repeat
      If (not (loggedIn)) then loginplayer;
      WillowWalk;
      FindNormalRandoms;
       repeat
       ChopDemWillows;
       solvesandwich;
       Running;
       FindNormalRandoms;
       Until(InvFull)
      Running;
      bankWalk;
      wait(100)
      depositing;
      SetUp;
      ClearDebug;
      Proggy;
      i := +1
     until(inttostr(loadsdone) = loadz)
      ClearDebug;
      Proggy;
     end.

    0wned. JK but still, listen to me....You need Until(IntToStr(LoadsDone) = Loadz);.

    Fix your main loop.
    SCAR Code:
    begin
       SetupSRL;
      SafeInitForm;
      SafeShowFormModal;
      SetupFormz;
     SetUp;
        SmartSetupEx((124),false,false);
        SetTargetDC(SmartGetDC);

    You also have more then 1 setup srl. Where it checks version, main loop many places. I will fix your script and post it in few minutes. Thanks,

    ~Kyle~
    0wnt by a 12 year old ;o

  9. #9
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    program Willow_Chopper;
    {.include SRL/SRL/Misc/Smart.scar}
    {.include srl/srl.scar}
    {.include srl/srl/skill/woodcutting.scar}
      var
      frmDesign : TForm;
      Username : TEdit;
      Password : TEdit;
      SmartWorld : TEdit;
      TreeBaseColor : TEdit;
      Start : TButton;
      Loads : TEdit;
      x , y , cx , cy , i , TreesChopped , loadsdone : Integer;
      loadz : string;
      TreeBaseColor1 : String;

    const
    ///Set up your colors below///
    WillowColor1 = 4487022;

    CurrentVersion  =  '2.0';// no need to change this

    yourSRLID='';

    yourSRLPW='';

    WillowColor2 = 4480100;

    BoothColor1 = 739167;//You have to set these colors If it cannot find the bank booth

    BoothColor2 = 671057;

    Procedure SetupFormz(sender: tobject);
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name := Username.text;
      Players[0].Pass := Password.text;
      Loads.text := loadz;
      TreeBaseColor.Text := TreeBaseColor1;
      FrmDesign.ModalResult := Mrok;

    end;

    Procedure InitForm;
    begin
    frmDesign := CreateForm;
    frmDesign.Left := 656;
    frmDesign.Top := 223;
    frmDesign.Width := 220;
    frmDesign.Height := 248;
    frmDesign.Caption := 'Willow Chopper';
    frmDesign.Color := clBtnFace;
    frmDesign.Font.Color := clWindowText;
    frmDesign.Font.Height := -14;
    frmDesign.Font.Name := 'MS Sans Serif';
    frmDesign.Font.Style := [];
    frmDesign.Visible := False;
    frmDesign.PixelsPerInch := 120;
    Username := TEdit.Create(frmDesign);
    Username.Parent := frmDesign;
    Username.Left := 8;
    Username.Top := 8;
    Username.Width := 113;
    Username.Height := 24;
    Username.TabOrder := 8;
    Username.Text := 'Username';
    Password := TEdit.Create(frmDesign);
    Password.Parent := frmDesign;
    Password.Left := 8;
    Password.Top := 48;
    Password.Width := 113;
    Password.Height := 24;
    Password.TabOrder := 9;
    Password.Text := 'Password';
    SmartWorld := TEdit.Create(frmDesign);
    SmartWorld.Parent := frmDesign;
    SmartWorld.Left := 8;
    SmartWorld.Top := 88;
    SmartWorld.Width := 113;
    SmartWorld.Height := 24;
    SmartWorld.TabOrder := 10;
    SmartWorld.Text := 'SmartWorld';
    TreeBaseColor := TEdit.Create(frmDesign);
    TreeBaseColor.Parent := frmDesign;
    TreeBaseColor.Left := 8;
    TreeBaseColor.Top := 128;
    TreeBaseColor.Width := 113;
    TreeBaseColor.Height := 24;
    TreeBaseColor.TabOrder := 11;
    TreeBaseColor.Text := 'TreeBaseColor';
    Start := TButton.Create(frmDesign);
    Start.Parent := frmDesign;
    Start.Left := 8;
    Start.Top := 168;
    Start.Width := 97;
    Start.Height := 25;
    Start.Caption := 'Start';
    Start.TabOrder := 12;
    Start.OnClick := @SetupFormz;
    Loads := TEdit.Create(frmDesign);
    Loads.Parent := frmDesign;
    Loads.Left := 120;
    Loads.Top := 48;
    Loads.Width := 89;
    Loads.Height := 24;
    Loads.TabOrder := 13;
    Loads.Text := 'Loads';
    end;

    Procedure SafeInitForm;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('InitForm', v);
    end;

    Procedure ShowFormModal;
    begin
      frmDesign.ShowModal;
    end;

    Procedure SafeShowFormModal;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('ShowFormModal', v);
    end;





    {****************************************************************************}
    {Procedure BankWalk                                                          }
    {By: Wade007                                                                 }
    {Description: This will walk to to the bank                                  }
    {****************************************************************************}


    Procedure BankWalk;
     begin
      RadialWalk(FindRoadColor,0,90,50,5,5)
      Flag;
      if(FindSymbol(x,y,'bank'))then
       begin
       writeln('Walking To bank!')
       Mouse(x,y,2,2,true)
       flag;
       FindNormalRandoms;
      end;
    end;
    {****************************************************************************
    Procedure WillowWalk
    By: Wade007
    Description: This will walk you to willows.
    {****************************************************************************}


    Procedure WillowWalk;
     begin
      If(Not(LoggedIn)) then LoginPlayer;
      setangle(true)
      Status('Walking to willows')
      writeln('Walking to willows')

     end;
    {*****************************************************************************
    function InFight: Boolean;
    By: WT-Fakawi
    Description: Returns as True if in fight.
    *****************************************************************************}


    function InFight: Boolean;
    var
      x, y : Integer;
    begin
      Result := (FindColor(x, y, 65280, 230, 130, 280, 180) or FindColor(x, y, 255,
        230, 130, 280, 180))
    end;
    {****************************************************************************
    Procedure Depositing
    By: the find and open bank part is by Wade007 and the deposit part is by frozen_soul
    Description: This will deposit your logs.
    *****************************************************************************}



    procedure Depositing;
      begin
        if FindObjCustom(cx, cy, ['booth', 'ooth'], [BoothColor1, BoothColor2], 3) then
          begin
          repeat
          Status('Banking');
          Mouse(cx,cy,2,2,false)
          chooseoption('Use-quickly')
          wait(1000)
           until(bankscreen)
             Begin
              for i := 2 to 28 do
              Begin
              if ExistsItem(i) then
              Begin
              MouseItem(i, false);
              ChooseOption('ll');
              Wait(1000 + random(500));
             end;
            end;
        Mouse(485, 41, 4, 4, True);
        Wait(500 + random(250));
      end;
           {case random(2) of       //Use this if the banking doesn't work.
              1: Deposit(2, 28, 2)
              2: Deposit(2, 28, 2)
              end;}

          closebank;
          FindNormalRandoms;
          loadsdone := loadsdone+1
          WillowWalk;
      end;
    end;

    {****************************************************************************
    Procedure: ChopDemWillows
    By: Wade007
    Description: This Chops trees (DUH!)
    *****************************************************************************}



    Procedure ChopDemWillows;
     var tries:Integer;
     Begin
       if FindObjCustom(cx, cy, ['illow', 'llow'], [WillowColor1, WillowColor2], 3) then
         begin
         Status('Chopping Willows');
         if(FindEnt(cx, cy, True))then exit;
         Mouse(cx,cy,2,2,False)
         ChooseOption('hop')
         flag;
         Wait(4000+random(800))
         TreesChopped := TreesChopped+1
         FindNormalRandoms;
     end else
      begin
        tries := tries+1;
        if (tries = 10)then
         begin
          Writeln('Could not find any trees :(')
          Writeln('Try changing the colors.')
         NextPlayer(false);
       end;
      end;
    end;

    {****************************************************************************
    Procedure FFindEnt
    By: Osmm
    Description: This will find an ent, and run away from it.
    *****************************************************************************}



    function FFindEnt(fx, fy: Integer; AvoidWhenFound: Boolean): Boolean;
    var
      arUpTextEntColorPoints: TPointArray;
      x, y, EntTime, tcts: Integer;
    begin
      if not(LoggedIn)then exit;
      GetMousePos(x, y);
      if(x <> fx)or(y <> fy)then
      mmouse(fx, fy, 0, 0);
      if(IsUpText('Chop'))then
      begin
        tcts := GetColorToleranceSpeed;
        ColorToleranceSpeed(2);
        SetColorspeed2Modifiers(0.4, 0.4);
        FindColorsTolerance(arUpTextEntColorPoints, 51657, 80, 6, 127, 20, 5);
        Result := Length(arUpTextEntColorPoints) > 10;
        ColorToleranceSpeed(tcts);
      end;
      if(result)then
        begin
          MarkTime(EntTime);
          WriteLn('Ent Found!!');
          Writeln('Waiting for it to go away.');
          begin
            case random(10) of
              1: mouse(628, 85, 5, 5, true);
              2: DoEmote(4);
              3: BoredHuman;
            end;
          end;
          Inc(EntsAvoided);
        end;
    end;

    {****************************************************************************
    Procedure Proggy
    By: Wade007
    Description: This will print a proggy to the debug box.
    *****************************************************************************}


    Procedure Proggy;
    begin
      Writeln('Willow Chopper by wade007 has run for ' +TimeRunning)
      Writeln('Willow Chopper has Chopped ' +intToStr(TreesChopped)+ ' Trees')
    end;


    {****************************************************************************
    Procedure: Running
    By: Wade007
    Description: This TINY procedure will run away if it is in a fight.
    *****************************************************************************}


    Procedure Running;
    begin
      If (InFight) then
        begin
        Writeln('We have found a fight! Running away!')
        Status('Running');
        BankWalk;
        wait(2000)
        WillowWalk;
        end else
         begin
         Exit;
         end;
    end;


    {****************************************************************************
    Procedure: SetUp
    By: Wade007
    Description: this will run when it is start up....
    *****************************************************************************}



    procedure SetUp;
    begin
      ScriptID := '651';
      if not(yourSRLID = '') then SRLID := yourSRLID;
      if not(yourSRLPW = '') then SRLPassword := yourSRLPW;
      If (GetPage('http://wade007.freehostia.com/version.txt')) > '2.0' then
      begin
      Writeln('Hmm... Your version is not up to date. please get the new update from the topic.')
      Writeln('I hope to have a direct download link for this in the near future.')
      logout;
      end else
       begin
       writeln('You have the latest version, Continueing.')
       end;
    end;


    {****************************************************************************
    MAIN LOOP
    Description: This is where it all begins...
    *****************************************************************************}



    begin
       SetupSRL;
      SafeInitForm;
      SafeShowFormModal;
     SetUp;
      SmartSetupEx((124),false,false);
        SetTargetDC(SmartGetDC);
      repeat
      If (not (loggedIn)) then loginplayer;
      WillowWalk;
      FindNormalRandoms;
       repeat
       ChopDemWillows;
       solvesandwich;
       Running;
       FindNormalRandoms;
       Until(InvFull);
      Running;
      bankWalk;
      wait(100)
      depositing;
      SetUp;
      ClearDebug;
      Proggy;
      i := +1
     until(inttostr(loadsdone) = loadz)
      ClearDebug;
      Proggy;
     end.

    I stopped cuz i was bored...Just read some more tuts and you'll get better...

  10. #10
    Join Date
    Nov 2007
    Location
    UK
    Posts
    242
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Oh, sweet, THANKS! btw i am 12...

  11. #11
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Kk srry =/ lol Your welcome, dunno if it works but try it.

  12. #12
    Join Date
    Nov 2007
    Location
    UK
    Posts
    242
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It works perfectly, You get credits for fixing it!
    (You don't need to apologize btw)

  13. #13
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Also, in the player array near the top add Players[0].Active := True;

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Type mismatch in script...
    By Dervish in forum OSR Help
    Replies: 2
    Last Post: 11-04-2008, 08:01 PM
  2. Sorry me again (Type mismatch in script)
    By StrikerX in forum OSR Help
    Replies: 8
    Last Post: 04-12-2008, 12:41 PM
  3. need help autofisher...Type mismatch in script
    By robeike in forum OSR Help
    Replies: 5
    Last Post: 02-22-2007, 12:17 PM

Posting Permissions

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