Results 1 to 14 of 14

Thread: Type Mismatch...

  1. #1
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default Type Mismatch...

    Alright so I'm back... with yet another problem I can't figure out.

    I keep getting a type mismatch on this line:

    SCAR Code:
    procedure Cut_FindTrees;
    var
      TreeColor : TPointArray;
    begin
      SetArrayLength(TreeColor, 4);//[0]:= Normal, [3]:= Yew
      if(Players[CP].Strings[0] = 'Tree')then//This line..

    Here's the full script:

    SCAR Code:
    program FirstScript;
      {.Include SRL\SRL\Misc\SMART.SCAR}
      {.include SRL\SRL.scar}

    var
      HatchetDTM : Array of Integer;
      i, x, y, CP, NumOfLogs, TotalProggies : integer;

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

      Players[0].Name := '';
      Players[0].Pass := '';
      Players[0].Nick := '';
      Players[0].Active := True;
      Players[0].Pin := '';
      Players[0].Strings[0] := '';//Which tree to cut?
      Players[0].Integers[0] := 270;//How many logs to cut?
      Players[0].BoxRewards := ['Xp', 'mote', 'ostume'];
    end;

    procedure FindRandoms;
    begin
      LampSkill := 'woodcutting';
      FindNormalRandoms;
    end;

    procedure MyAntiBan;
    begin
      case Random(70) of
        0: RandomMovement;
        1: BoredHuman;
        2: HoverSkill('random', false);
        3: RandomRClick;
        4: begin
             case Random(2) of
               0: begin
                    KeyDown(VK_RIGHT);
                    Wait(50 + Random(1300));
                    KeyUp(VK_RIGHT);
                    Wait(60 + Random(2000));
                    KeyDown(VK_LEFT);
                    Wait(70 + Random(1100));
                    KeyUp(VK_LEFT)
                  end;
               1: begin
                    KeyDown(VK_LEFT);
                    Wait(50 + Random(1300));
                    KeyUp(VK_LEFT);
                    Wait(60 + Random(2000));
                    KeyDown(VK_RIGHT);
                    Wait(70 + Random(1100));
                    KeyUp(VK_RIGHT);
                  end;
              end;
           end;
        5: begin
             KeyDown(VK_LEFT);
             Wait(100 + Random(1200));
             KeyUp(VK_LEFT);
           end;
        6: begin
             KeyDown(VK_RIGHT);
             Wait(150 + Random(1100));
             KeyUp(VK_RIGHT);
           end;
        7..69:
      end;
    end;


    procedure HatchetDTMs;
    begin
     SetArrayLength(HatchetDTM, 7);//[0]:= Bronze, [6]:= Rune
       HatchetDTM[0] := DTMFromString('78DA630C646260D8C4C8800C7CAC9519F8813' +
           '44C94D113A86617AA1A982C5C8D1B50CD36026ABC816AD6125013' +
           '0C54B38E809A504C3763A80921EC1E00949107EF');
       HatchetDTM[1] := DTMFromString('78DA630C626260D8C4C8800C02BDBD19F8813' +
           '448F43F1030BA03D5EC47550391859140DA0DA8662B01355E4035' +
           '6B09A80906AA5947404D2850CD06026A42806AB6E157030033F30' +
           'C28');
       HatchetDTM[2] := DTMFromString('78DA630C626260D8C8C8800CCAF3F318F8813' +
           '448F43F10307A02D5EC40550391859140DA0DA8660B01355E4035' +
           '6B09A80904AA5947404D28A69BB1AAD98A5F0D0090050C8D');
       HatchetDTM[3] := DTMFromString('78DA63F4676260D8C0C8800C44454418F8813' +
           '448F43F1030BA03D5EC43550391859140DA05A8661701351E4035' +
           'EB09A80900AA5947404D28A69BB1AAD98A5F0D0095870B78');
       HatchetDTM[4] := DTMFromString('78DA630C646260D8C8C8800C1C1CE319F8813' +
           '44C94D10DA8E600AA1A982C5C8D2B50CD0E026A3C806A36105013' +
           '0054B38E809A504C3763A80901AAD9865F0D00C5940824');
       HatchetDTM[5] := DTMFromString('78DA63EC64626038C0C8800C9C829D18F8813' +
           '44C94B101A8E614AA1A982C8A9A7D04D4F402D5EC2742CD21026A' +
           '6A816AAEE05703006FA208C7');
       HatchetDTM[6] := DTMFromString('78DA630C606260D8C8C8800C5CA2531944803' +
           '44C94D11DA8662FAA1A982C5C8D1B50CD56026ABC806AD6125013' +
           '0C54B38E809A504C3763A80901AAD9865F0D00E749084A');;
    end;

    procedure Cut_FindHatchet;
    var
      b: Boolean;
    begin
      for i:= 0 to 6 do
        if(FindDTM(HatchetDTM[i], x, y, MIX1, MIY1, MIX2, MIY2))then
          begin
            b:= True;// assign b:= True, now you know it's found.
            Break;// break the loop - once found, no need to keep going through.
          end;
          begin
            if(b = True)then// since it's only a check, = is needed, rather than :=
              Writeln('Found hatchet.')
            else
            begin
              Writeln('Didn''t find hatchet, logging out.');
              LogOut;
            end;
          end;
    end;

    procedure Cut_FindTrees;
    var
      TreeColor : TPointArray;
    begin
      SetArrayLength(TreeColor, 1);//[0]:= Normal, [3]:= Yew
        if(Players[CP].Strings[0] = 'Tree')then
          TreeColor[0] := 6201748;
        if(Players[CP].Strings[0] = 'Oak')then
          TreeColor[0] := 2644816;
        if(Players[CP].Strings[0] = 'Willow')then
          TreeColor[0] := 8497045;
        if(Players[CP].Strings[0] = 'Yew')then
          TreeColor[0] := 1718835;
    end;

    {procedure Cut_Chop_Trees;
    begin
      repeat
        if(FindObjTPA(x, y, TreeColor[0], 5, ObjWidth, Height, minCount, ['hop']))then
        begin
          Wait(100 + Random(500));
          Mouse(x, y, 4, 4, True);
          repeat
            Wait(Random(5000));
            MyAntiBan;
          until(not(IsUpText('hop')) or (InvFull));
        end;
      until(InvFull or not LoggedIn);
      if(InvFull)then
        Writeln('Inventory full, dropping logs.');
      FindRandoms;
    end;}

       
    procedure Cut_ChopTrees;
    var
      s : String;
    begin
      repeat
        if(FindColorsTolerance(x, y, TreeColor, MSX1, MSY1, MSX2, MSY2, 5))then
        begin
          Wait(2000 + Random(1000));
          MMouse(x, y, 4, 4);
          s := RS_GetUpText;
          Wait(80 + Random(50));
          if((Pos('illow', s) <> 0) and (Pos('hop', s) <> 0))then
          begin
            Mouse(x, y, 3, 3, True);
            repeat
              Wait(Random(5000));
              MyAntiBan;
            until(not(IsUpText('illow')) or (InvFull));
          end;
        end;
      until(InvFull or not LoggedIn);
      if(InvFull)then
        Writeln('Inventory full, dropping logs.');
      FindRandoms;
    end;

    procedure Cut_DropLogs;
    begin
      if(InvFull)then
      begin
        Wait(500 + Random(100));
        for i := 2 to 28 do
          DropItem(i);
        NumOfLogs := NumOfLogs + 27;
        if(NumOfLogs >= Players[0].Integers[0])then
        begin
          Writeln('Cut desired number of logs, logging out.');
          Wait(50 + Random(1000));
          Logout;
        end;
      end;
      FindRandoms;
    end;

    procedure ProgReport;
    begin
      Inc(TotalProggies);
      Writeln(' _______________________________________________');
      Writeln(PadR('|            Coh3n''s Willow Chopper', 48) + '|');
      Writeln('|_________________First Script__________________|');
      Writeln('|                                               |');
      Writeln(PadR('|  Time run: ' + TimeRunning, 48) + '|');
      Writeln(PadR('|  Loads: ' + IntToStr(NumOfLogs / 27), 48) + '|');
      Writeln(PadR('|  Logs: ' + IntToStr(NumOfLogs), 48) + '|');
      Writeln('|_______________________________________________|');
    end;


    begin
      SMARTSetupEx(152, False, True, False);
      Wait(5000);
      SetTargetDC(SmartGetDC);
      SetupSRL;
      ActivateClient;
      DeclarePlayers;
      LoginPlayer;
      SetAngle(True);
      HatchetDTMs;
      Cut_FindHatchet;
      repeat
        if(ExistsItem(1))then
          Cut_ChopTrees;
          Cut_DropLogs;
          ProgReport;
          FindRandoms;
      until(not LoggedIn);
    end.

    Thanks again if you have the answer.
    Last edited by Coh3n; 05-30-2009 at 01:05 AM.

  2. #2
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    here ya go.
    Code:
    Players[CP].Strings[0]
    You missed out the [0] on the end which tells it which string it is
    T~M

  3. #3
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    scar Code:
    if(Players[CP].Strings = 'Tree')then
    to:
    scar Code:
    if(Players[CP].Strings[0] = 'Tree')then
    @TheMan: That's wrong.


  4. #4
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    Oh really?


    T~M

  5. #5
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by The Man View Post
    here ya go.
    Code:
    Players[CP].Strings[0]
    You missed out the [0] on the end which tells it which string it is
    T~M
    Ohhhhhhhhhh! Easy enough. Thanks.

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

    Default

    From cazaxs post.
    Hows the mans code wrong? Looks correct to me.

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

    Default

    Quote Originally Posted by Cazax View Post
    @TheMan: That's wrong.
    Umm, what?

  8. #8
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by The Cnr Sport View Post
    Hows the mans code wrong? Looks correct to me.
    Quote Originally Posted by Da 0wner View Post
    Umm, what?
    I think he was joking, but I don't know. Lol.

  9. #9
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Coh3n just a tip, check out JADs Guide to Fixing Those Annoying Errors.

    It's a big list of silly errors and their solutions.
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  10. #10
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    No I wrote that looked over your code again quickly and edited quickly, and he had already loaded the page so he didnt see my change.

    T~M

  11. #11
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by Nava2 View Post
    Coh3n just a tip, check out JADs Guide to Fixing Those Annoying Errors.

    It's a big list of silly errors and their solutions.
    Haha thanks

    Quote Originally Posted by The Man View Post
    No I wrote that looked over your code again quickly and edited quickly, and he had already loaded the page so he didnt see my change.

    T~M
    Ah, lol.
    Last edited by Coh3n; 05-30-2009 at 01:14 AM.

  12. #12
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by Cazax View Post
    scar Code:
    if(Players[CP].Strings = 'Tree')then
    to:
    scar Code:
    if(Players[CP].Strings[0] = 'Tree')then
    @TheMan: That's wrong.
    I did that, and the Type Mismatch still comes up?

    I updated the script in the first post.

    @Nava2: I checked JADs guide and I didn't help me with this particular problem, but now I know why I get some of those other errors.

  13. #13
    Join Date
    Jun 2007
    Location
    La Mirada, CA
    Posts
    2,484
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    The error is on the line below it. You are setting an integer to a TPointArray variable type. You need to make it a TIntegerArray and set it like treeColor := [34634]; or just make it a single integer.

    Or assign it like you are with treeColor[0] := 43534; however you want to do it. That is if you make it a TIntegerArray b/c obviously a single integer doesn't have any elements to the array .

    They do the same thing.
    Last edited by HyperSecret; 05-30-2009 at 01:51 AM.

    "Failure is the opportunity to begin again more intelligently" (Henry Ford)


  14. #14
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by HyperSecret View Post
    The error is on the line below it. You are setting an integer to a TPointArray variable type. You need to make it a TIntegerArray and set it like treeColor := [34634]; or just make it a single integer.

    Or assign it like you are with treeColor[0] := 43534; however you want to do it. That is if you make it a TIntegerArray b/c obviously a single integer doesn't have any elements to the array .

    They do the same thing.
    Okay I think I understand, 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
  •