Results 1 to 18 of 18

Thread: DTMRotated Error

  1. #1
    Join Date
    Feb 2009
    Location
    UK
    Posts
    89
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default DTMRotated Error

    Sometimes when using DTMRotated I get the following error:
    SCAR Code:
    [Runtime Error] : Exception: Access violation at address 004B998D in module 'scar.exe'. Read of address 03280030 in line 81 in script C:\Program Files\SCAR 3.15\includes\SRL/SRL/Core/Color.scar

    Anyone know if this is a bug or my own mistakes?

  2. #2
    Join Date
    Oct 2007
    Location
    Denmark
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Is the DTM declared?

  3. #3
    Join Date
    Feb 2009
    Location
    UK
    Posts
    89
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I'm using a function to declare them since I'm using DDTMs. I had four in my script but only one of them would make this error but now they all are.

  4. #4
    Join Date
    Oct 2007
    Location
    Denmark
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Post your script please. Otherwise we can't help.

  5. #5
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Make sure you have the Params right

    DTMRotated(DTM, x, y, x1, y1, x2, y2);
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

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

    Default

    pretty sure it's cuz of not freeing/freeing when you weren't supposed to.. but it would help if you would show the script

  7. #7
    Join Date
    Feb 2009
    Location
    UK
    Posts
    89
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by 99_ View Post
    pretty sure it's cuz of not freeing/freeing when you weren't supposed to.. but it would help if you would show the script
    I just made new DDTMs and freed them and it seems to be working.

    Thanks!

    Edit: It's back! It's like a rash it keeps coming back even though it was totally gone the night before. -_-

    Anyway heres my script:
    SCAR Code:
    program AlKharidTanner;
    {.include SRL\SRL.scar}

    var
      x, y: Integer;

    function Floor1Color: Integer;
    var
      i, Red, Green, Blue, GC, TestColor, CX, CY: Integer;
      P: TPointArray;
      H, S, L: Extended;
    begin
      GC := 6061218;
      FFlag(0);
      if (FindSymbol(x, y, 'bank')) then
      begin
        CX := x;
        CY := y;
      end else
      begin
        CX := MMCX;
        CY := MMCY;
      end;
      FindColorsSpiralTolerance(CX, CY, P, GC, MMX1, MMY1, MMX2, MMY2, 30);
      for i := 0 to High(P) - 1 do
      begin
        if rs_OnMinimap(P[i].x,P[i].y) then
        begin
          TestColor := GetColor(P[i].x, P[i].y);
          ColorToRGB(TestColor, Red, Green, Blue);
          ColorToHSL(TestColor, H, S, L);
          if InRange(Red - Blue, 58, 82) then
            if InRange(Red - Green, 22, 54) then
              if InRange(Green - Blue, 19, 47) then
                if InRange(Round(S - H), 14, 31) then
                  if InRange(Round(L - H), 32, 52) then
                    if InRange(Round(L - S), 13, 26) then
                      if GetColor(P[i].x + 2, P[i].y + 2) = TestColor then
                        if GetColor(P[i].x + 1, P[i].y + 1) = TestColor then
                          if GetColor(P[i].x, P[i].y + 2) = TestColor then
                            if GetColor(P[i].x + 2, P[i].y) = TestColor then
                              if GetColor(P[i].x, P[i].y + 1) = TestColor then
                                if GetColor(P[i].x + 1, P[i].y) = TestColor then
                                  if GetColor(P[i].x + 2, P[i].y + 1) = TestColor then
                                    if GetColor(P[i].x + 1, P[i].y + 2) = TestColor then
                                    begin
                                      Result := TestColor;
                                      Writeln('Floor1Color = ' + IntToStr(Result));
                                      Exit;
                                    end;
        end;
      end;
      Writeln('Floor1Color could not be found.');
      Result := 0;
    end;

    function Floor2Color: Integer;
    var
      i, Red, Green, Blue, GC, TestColor: Integer;
      P: TPointArray;
      H, S, L: Extended;
    begin
      GC := 6983098;
      FFlag(0);
      FindColorsSpiralTolerance(MMCX, MMCY, P, GC, MMX1, MMY1, MMX2, MMY2, 30);
      for i := 0 to High(P) - 1 do
      begin
        if rs_OnMinimap(P[i].x,P[i].y) then
        begin
          TestColor := GetColor(P[i].x, P[i].y);
          ColorToRGB(TestColor, Red, Green, Blue);
          ColorToHSL(TestColor, H, S, L);
          if InRange(Red - Blue, 70, 90) then
            if InRange(Red - Green, 32, 67) then
              if InRange(Green - Blue, 17, 53) then
                if InRange(Round(S - H), 23, 40) then
                  if InRange(Round(L - H), 44, 59) then
                    if InRange(Round(L - S), 13, 25) then
                      if GetColor(P[i].x + 2, P[i].y + 2) = TestColor then
                        if GetColor(P[i].x + 1, P[i].y + 1) = TestColor then
                          if GetColor(P[i].x, P[i].y + 2) = TestColor then
                            if GetColor(P[i].x + 2, P[i].y) = TestColor then
                              if GetColor(P[i].x, P[i].y + 1) = TestColor then
                                if GetColor(P[i].x + 1, P[i].y) = TestColor then
                                  if GetColor(P[i].x + 2, P[i].y + 1) = TestColor then
                                    if GetColor(P[i].x + 1, P[i].y + 2) = TestColor then
                                    begin
                                      Result := TestColor;
                                      Writeln('Floor2Color = ' + IntToStr(Result));
                                      Exit;
                                    end;
        end;
      end;
      Writeln('Floor2Color could not be found.');
      Result := 0;
    end;

    function CactiColor: Integer;
    var
      i, Red, Green, Blue, GC, TestColor: Integer;
      P: TPointArray;
      H, S, L: Extended;
    begin
      GC := 3240012;
      FFlag(0);
      FindColorsSpiralTolerance(MMCX, MMCY, P, GC, MMX1, MMY1, MMX2, MMY2, 50);
      for i := 0 to High(P) - 1 do
      begin
        if rs_OnMinimap(P[i].x,P[i].y) then
        begin
          TestColor := GetColor(P[i].x, P[i].y);
          ColorToRGB(TestColor, Red, Green, Blue);
          ColorToHSL(TestColor, H, S, L);
          if InRange(Red - Blue, 3, 35) then
            if InRange(Green - Red, 19, 60) then
              if InRange(Green - Blue, 38, 78) then
                if InRange(Round(S - H), -9, 30) then
                  if InRange(Round(L - H), -6, 16) then
                    if InRange(Round(L - S), -32, 16) then
                      if GetColor(P[i].x + 2, P[i].y + 2) = TestColor then
                        if GetColor(P[i].x + 1, P[i].y + 1) = TestColor then
                          if GetColor(P[i].x, P[i].y + 2) = TestColor then
                            if GetColor(P[i].x + 2, P[i].y) = TestColor then
                              if GetColor(P[i].x, P[i].y + 1) = TestColor then
                                if GetColor(P[i].x + 1, P[i].y) = TestColor then
                                  if GetColor(P[i].x + 2, P[i].y + 1) = TestColor then
                                    if GetColor(P[i].x + 1, P[i].y + 2) = TestColor then
                                    begin
                                      Result := TestColor;
                                      Writeln('CactiColor = ' + IntToStr(Result));
                                      Exit;
                                    end;
        end;
      end;
      Writeln('CactiColor could not be found.');
      Result := 0;
    end;

    function TreeBaseColor: Integer;
    var
      i, Red, Green, Blue, GC, TestColor: Integer;
      P: TPointArray;
      H, S, L: Extended;
    begin
      GC := 1130626;
      FFlag(0);
      FindColorsSpiralTolerance(MMCX, MMCY, P, GC, MMX1, MMY1, MMX2, MMY2, 50);
      for i := 0 to High(P) - 1 do
      begin
        if rs_OnMinimap(P[i].x,P[i].y) then
        begin
          TestColor := GetColor(P[i].x, P[i].y);
          ColorToRGB(TestColor, Red, Green, Blue);
          ColorToHSL(TestColor, H, S, L);
          if InRange(Red - Blue, 100, 138) then
            if InRange(Red - Green, 57, 89) then
              if InRange(Green - Blue, 27, 66) then
                if InRange(Round(S - H), 51, 98) then
                  if InRange(Round(S - L), 23, 82) then
                    if InRange(Round(L - H), 12, 32) then
                      if GetColor(P[i].x, P[i].y + 1) = TestColor then
                      begin
                        Result := TestColor;
                        Writeln('TreeBaseColor = ' + IntToStr(Result));
                        Exit;
                      end;
        end;
      end;
      Writeln('TreeBaseColor could not be found.');
      Result := 0;
    end;

    function Walk1DDTM: Integer;
    var
      dtmMainPoint: TDTMPointDef;
      dtmSubPoints: Array [0..5] of TDTMPointDef;
      TempTDTM: TDTM;
    begin
      dtmMainPoint.x := 76;
      dtmMainPoint.y := 25;
      dtmMainPoint.AreaSize := 0;
      dtmMainPoint.AreaShape := 0;
      dtmMainPoint.Color := 6262182;
      dtmMainPoint.Tolerance := 255;

      dtmSubPoints[0].x := 76;
      dtmSubPoints[0].y := 25;
      dtmSubPoints[0].AreaSize := 0;
      dtmSubPoints[0].AreaShape := 0;
      dtmSubPoints[0].Color := 6262182;
      dtmSubPoints[0].Tolerance := 255;

      dtmSubPoints[1].x := 58;
      dtmSubPoints[1].y := 7;
      dtmSubPoints[1].AreaSize := 20;
      dtmSubPoints[1].AreaShape := 0;
      dtmSubPoints[1].Color := Floor2Color;
      dtmSubPoints[1].Tolerance := 0;

      dtmSubPoints[2].x := 31;
      dtmSubPoints[2].y := 9;
      dtmSubPoints[2].AreaSize := 4;
      dtmSubPoints[2].AreaShape := 1;
      dtmSubPoints[2].Color := CactiColor;
      dtmSubPoints[2].Tolerance := 0;

      dtmSubPoints[3].x := 80;
      dtmSubPoints[3].y := 48;
      dtmSubPoints[3].AreaSize := 4;
      dtmSubPoints[3].AreaShape := 1;
      dtmSubPoints[3].Color := CactiColor;
      dtmSubPoints[3].Tolerance := 0;

      dtmSubPoints[4].x := 49;
      dtmSubPoints[4].y := 43;
      dtmSubPoints[4].AreaSize := 16;
      dtmSubPoints[4].AreaShape := 0;
      dtmSubPoints[4].Color := Floor1Color;
      dtmSubPoints[4].Tolerance := 0;

      dtmSubPoints[5].x := 12;
      dtmSubPoints[5].y := 16;
      dtmSubPoints[5].AreaSize := 16;
      dtmSubPoints[5].AreaShape := 0;
      dtmSubPoints[5].Color := 800886;
      dtmSubPoints[5].Tolerance := 0;

      TempTDTM.MainPoint := dtmMainPoint;
      TempTDTM.SubPoints := dtmSubPoints;
      Result := AddDTM(TempTDTM);
    end;

    function Walk2DDTM: Integer;
    var
      dtmMainPoint: TDTMPointDef;
      dtmSubPoints: Array [0..3] of TDTMPointDef;
      TempTDTM: TDTM;
    begin
      dtmMainPoint.x := 66;
      dtmMainPoint.y := 16;
      dtmMainPoint.AreaSize := 15;
      dtmMainPoint.AreaShape := 0;
      dtmMainPoint.Color := Floor2Color;
      dtmMainPoint.Tolerance := 0;

      dtmSubPoints[0].x := 66;
      dtmSubPoints[0].y := 16;
      dtmSubPoints[0].AreaSize := 15;
      dtmSubPoints[0].AreaShape := 0;
      dtmSubPoints[0].Color := Floor2Color;
      dtmSubPoints[0].Tolerance := 0;

      dtmSubPoints[1].x := 25;
      dtmSubPoints[1].y := 53;
      dtmSubPoints[1].AreaSize := 5;
      dtmSubPoints[1].AreaShape := 1;
      dtmSubPoints[1].Color := CactiColor;
      dtmSubPoints[1].Tolerance := 0;

      dtmSubPoints[2].x := 73;
      dtmSubPoints[2].y := 103;
      dtmSubPoints[2].AreaSize := 5;
      dtmSubPoints[2].AreaShape := 1;
      dtmSubPoints[2].Color := CactiColor;
      dtmSubPoints[2].Tolerance := 0;

      dtmSubPoints[3].x := 7;
      dtmSubPoints[3].y := 42;
      dtmSubPoints[3].AreaSize := 5;
      dtmSubPoints[3].AreaShape := 1;
      dtmSubPoints[3].Color := 800886;
      dtmSubPoints[3].Tolerance := 255;

      TempTDTM.MainPoint := dtmMainPoint;
      TempTDTM.SubPoints := dtmSubPoints;
      Result := AddDTM(TempTDTM);
    end;

    function Walk3DDTM: Integer;
    var
      dtmMainPoint: TDTMPointDef;
      dtmSubPoints: Array [0..4] of TDTMPointDef;
      TempTDTM: TDTM;
    begin
      dtmMainPoint.x := 45;
      dtmMainPoint.y := 116;
      dtmMainPoint.AreaSize := 0;
      dtmMainPoint.AreaShape := 0;
      dtmMainPoint.Color := 6196132;
      dtmMainPoint.Tolerance := 255;

      dtmSubPoints[0].x := 45;
      dtmSubPoints[0].y := 116;
      dtmSubPoints[0].AreaSize := 0;
      dtmSubPoints[0].AreaShape := 0;
      dtmSubPoints[0].Color := 6196132;
      dtmSubPoints[0].Tolerance := 255;

      dtmSubPoints[1].x := 83;
      dtmSubPoints[1].y := 12;
      dtmSubPoints[1].AreaSize := 4;
      dtmSubPoints[1].AreaShape := 1;
      dtmSubPoints[1].Color := CactiColor;
      dtmSubPoints[1].Tolerance := 0;

      dtmSubPoints[2].x := 67;
      dtmSubPoints[2].y := 15;
      dtmSubPoints[2].AreaSize := 4;
      dtmSubPoints[2].AreaShape := 0;
      dtmSubPoints[2].Color := CactiColor;
      dtmSubPoints[2].Tolerance := 0;

      dtmSubPoints[3].x := 41;
      dtmSubPoints[3].y := 15;
      dtmSubPoints[3].AreaSize := 4;
      dtmSubPoints[3].AreaShape := 1;
      dtmSubPoints[3].Color := CactiColor;
      dtmSubPoints[3].Tolerance := 0;

      dtmSubPoints[4].x := 2;
      dtmSubPoints[4].y := 85;
      dtmSubPoints[4].AreaSize := 4;
      dtmSubPoints[4].AreaShape := 1;
      dtmSubPoints[4].Color := CactiColor;
      dtmSubPoints[4].Tolerance := 0;

      TempTDTM.MainPoint := dtmMainPoint;
      TempTDTM.SubPoints := dtmSubPoints;
      Result := AddDTM(TempTDTM);
    end;

    function Walk4DDTM: Integer;
    var
      dtmMainPoint: TDTMPointDef;
      dtmSubPoints: Array [0..4] of TDTMPointDef;
      TempTDTM: TDTM;
    begin
      dtmMainPoint.x := 50;
      dtmMainPoint.y := 125;
      dtmMainPoint.AreaSize := 16;
      dtmMainPoint.AreaShape := 0;
      dtmMainPoint.Color := Floor1Color;
      dtmMainPoint.Tolerance := 0;

      dtmSubPoints[0].x := 50;
      dtmSubPoints[0].y := 125;
      dtmSubPoints[0].AreaSize := 16;
      dtmSubPoints[0].AreaShape := 0;
      dtmSubPoints[0].Color := Floor1Color;
      dtmSubPoints[0].Tolerance := 0;

      dtmSubPoints[1].x := 102;
      dtmSubPoints[1].y := 79;
      dtmSubPoints[1].AreaSize := 16;
      dtmSubPoints[1].AreaShape := 1;
      dtmSubPoints[1].Color := Floor1Color;
      dtmSubPoints[1].Tolerance := 0;

      dtmSubPoints[2].x := 52;
      dtmSubPoints[2].y := 62;
      dtmSubPoints[2].AreaSize := 16;
      dtmSubPoints[2].AreaShape := 0;
      dtmSubPoints[2].Color := Floor2Color;
      dtmSubPoints[2].Tolerance := 0;

      dtmSubPoints[3].x := 77;
      dtmSubPoints[3].y := 107;
      dtmSubPoints[3].AreaSize := 4;
      dtmSubPoints[3].AreaShape := 1;
      dtmSubPoints[3].Color := CactiColor;
      dtmSubPoints[3].Tolerance := 0;

      dtmSubPoints[4].x := 17;
      dtmSubPoints[4].y := 64;
      dtmSubPoints[4].AreaSize := 4;
      dtmSubPoints[4].AreaShape := 1;
      dtmSubPoints[4].Color := CactiColor;
      dtmSubPoints[4].Tolerance := 0;

      TempTDTM.MainPoint := dtmMainPoint;
      TempTDTM.SubPoints := dtmSubPoints;
      Result := AddDTM(TempTDTM);
    end;

    procedure WalkToTanner;
    begin
      DTMRotated(Walk1DDTM, x, y, MMX1, MMY1, MMX2, MMY2);
      Mouse(x, y, 4, 4, True);
      FFlag(5);
      FreeDTM(Walk1DDTM);
      DTMRotated(Walk2DDTM, x, y, MMX1, MMY1, MMX2, MMY2);
      Mouse(x, y, 4, 4, True);
      FFlag(5);
      FreeDTM(Walk2DDTM);
    end;

    procedure WalkToBank;
    begin
      DTMRotated(Walk3DDTM, x, y, MMX1, MMY1, MMX2, MMY2);
      Mouse(x, y, 4, 4, True);
      FFlag(5);
      FreeDTM(Walk3DDTM);
      DTMRotated(Walk4DDTM, x, y, MMX1, MMY1, MMX2, MMY2);
      Mouse(x, y, 4, 4, True);
      FFlag(5);
      FreeDTM(Walk4DDTM);
    end;


    begin
      SetupSRL;
      ActivateClient;
      WalkToTanner;
      WalkToBank;
    end.

    All the DDTM's worked at the time I made them and all my AutoColor functions correctly output the colors they should.

    Please help!
    Last edited by Gearsnare; 04-12-2009 at 12:29 PM.

  8. #8
    Join Date
    Jul 2008
    Location
    Poland
    Posts
    375
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Try to change areaShape to 0 and i think that AreaSize := 16; is too much i think 4 is max. Maybe it can help but i'm not sure.
    :P

  9. #9
    Join Date
    Feb 2009
    Location
    UK
    Posts
    89
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I think it had to do with all the memory it was using, I tried on a different computer and it just froze. Now I've made DDTMs with 4 points and they seem to be working perfectly!

    Thanks for your help.

    Edit: My script was working perfectly, then 5 minutes later and start getting the error again.

    The DDTMs work but then suddenly stop working, I don't understand why.
    Last edited by Gearsnare; 04-12-2009 at 04:01 PM.

  10. #10
    Join Date
    Jul 2008
    Location
    Poland
    Posts
    375
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    insted useing:
    SCAR Code:
    procedure WalkToTanner;
    begin
      DTMRotated(Walk1DDTM, x, y, MMX1, MMY1, MMX2, MMY2);
      Mouse(x, y, 4, 4, True);
      FFlag(5);
      FreeDTM(Walk1DDTM);
      DTMRotated(Walk2DDTM, x, y, MMX1, MMY1, MMX2, MMY2);
      Mouse(x, y, 4, 4, True);
      FFlag(5);
      FreeDTM(Walk2DDTM);
    end;
    use:
    SCAR Code:
    procedure WalkToTanner;
    var
    DTM: integer;
    begin
      DTM := Walk1DDTM;
      DTMRotated(DTM, x, y, MMX1, MMY1, MMX2, MMY2);
      Mouse(x, y, 4, 4, True);
      FFlag(5);
    //  FreeDTM(DTM);
      DTM := Walk2DDTM;
      DTMRotated(DTM, x, y, MMX1, MMY1, MMX2, MMY2);
      Mouse(x, y, 4, 4, True);
      FFlag(5);
      FreeDTM(DTM);
    end;

    It should help.
    :P

  11. #11
    Join Date
    Dec 2007
    Posts
    2,112
    Mentioned
    71 Post(s)
    Quoted
    580 Post(s)

    Default

    do u get a file access error?

  12. #12
    Join Date
    Feb 2009
    Location
    UK
    Posts
    89
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I think it had to do with not being able to find the DDTMs, I have created new ones and they seem to be working.

    SCAR Code:
    program TouchWood;

    var
      Luck: Integer;

    begin
      Luck := Luck + 50;
    end.

  13. #13
    Join Date
    Dec 2007
    Posts
    2,112
    Mentioned
    71 Post(s)
    Quoted
    580 Post(s)

    Default

    i had the same problem i did the same thing u did made new dtms and then i redownloaded includes and the old 1's worked again

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

    Default

    Make sure that the DTM reference doesn't = 0. So check the integer to see if it is 0 or a number.

    Remember, the integer you set a DTM to is just a pointer to the memory where the DTM is stored.
    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

  15. #15
    Join Date
    Jul 2008
    Location
    Poland
    Posts
    375
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    procedure WalkToTanner;
    begin
      DTMRotated(Walk1DDTM, x, y, MMX1, MMY1, MMX2, MMY2);//creating DTM in memory and serching it
      Mouse(x, y, 4, 4, True);
      FFlag(5);
      FreeDTM(Walk1DDTM);// creating another one DTM in memory and freeing it
       ...
    end;
    Maybe i'm wrong??
    :P

  16. #16
    Join Date
    Feb 2009
    Location
    UK
    Posts
    89
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Iroki View Post
    SCAR Code:
    procedure WalkToTanner;
    begin
      DTMRotated(Walk1DDTM, x, y, MMX1, MMY1, MMX2, MMY2);//creating DTM in memory and serching it
      Mouse(x, y, 4, 4, True);
      FFlag(5);
      FreeDTM(Walk1DDTM);// creating another one DTM in memory and freeing it
       ...
    end;
    Maybe i'm wrong??
    Might be but I still had the errors when I set each one individually, if anyone knows if this code actually frees the DDTMs please say.

    SCAR Code:
    function LoadDDTM(DDTMNumber: Integer): Integer;
    var
      dtmMainPoint: TDTMPointDef;
      dtmSubPoints: array[0..3] of TDTMPointDef;
      TempTDTM: TDTM;
    begin
      case DDTMNumber of
        1:
        begin
          dtmMainPoint.x := 133;
          dtmMainPoint.y := 27;
          dtmMainPoint.AreaSize := 0;
          dtmMainPoint.AreaShape := 0;
          dtmMainPoint.Color := 255;
          dtmMainPoint.Tolerance := 255;

          dtmSubPoints[0].x := 133;
          dtmSubPoints[0].y := 27;
          dtmSubPoints[0].AreaSize := 0;
          dtmSubPoints[0].AreaShape := 0;
          dtmSubPoints[0].Color := 255;
          dtmSubPoints[0].Tolerance := 255;

          dtmSubPoints[1].x := 79;
          dtmSubPoints[1].y := 48;
          dtmSubPoints[1].AreaSize := 0;
          dtmSubPoints[1].AreaShape := 0;
          dtmSubPoints[1].Color := FloorColor;
          dtmSubPoints[1].Tolerance := 0;

          dtmSubPoints[2].x := 98;
          dtmSubPoints[2].y := 91;
          dtmSubPoints[2].AreaSize := 0;
          dtmSubPoints[2].AreaShape := 0;
          dtmSubPoints[2].Color := FloorColor;
          dtmSubPoints[2].Tolerance := 0;

          dtmSubPoints[3].x := 130;
          dtmSubPoints[3].y := 60;
          dtmSubPoints[3].AreaSize := 0;
          dtmSubPoints[3].AreaShape := 0;
          dtmSubPoints[3].Color := CactiColor;
          dtmSubPoints[3].Tolerance := 0;
        end;
      end;
      TempTDTM.MainPoint := dtmMainPoint;
      TempTDTM.SubPoints := dtmSubPoints;
      Result := AddDTM(TempTDTM);
    end;

    procedure Walking;
      DTMRotated(LoadDDTM(1), x, y, MMX1, MMY1, MMX2, MMY2);
      Mouse(x, y, 2, 2, True);
      FFlag(5);
      FreeDTM(LoadDDTM(1));
    SCAR Code:
    if (YourActivity = 'ReadingThis') then
        Inc(ViewCount);

  17. #17
    Join Date
    Oct 2007
    Location
    Denmark
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    function LoadDDTM(DDTMNumber: Integer): Integer;
    var
      dtmMainPoint: TDTMPointDef;
      dtmSubPoints: array[0..3] of TDTMPointDef;
      TempTDTM: TDTM;
    begin
      case DDTMNumber of
        1:
        begin
          dtmMainPoint.x := 133;
          dtmMainPoint.y := 27;
          dtmMainPoint.AreaSize := 0;
          dtmMainPoint.AreaShape := 0;
          dtmMainPoint.Color := 255;
          dtmMainPoint.Tolerance := 255;

          dtmSubPoints[0].x := 133;
          dtmSubPoints[0].y := 27;
          dtmSubPoints[0].AreaSize := 0;
          dtmSubPoints[0].AreaShape := 0;
          dtmSubPoints[0].Color := 255;
          dtmSubPoints[0].Tolerance := 255;

          dtmSubPoints[1].x := 79;
          dtmSubPoints[1].y := 48;
          dtmSubPoints[1].AreaSize := 0;
          dtmSubPoints[1].AreaShape := 0;
          dtmSubPoints[1].Color := FloorColor;
          dtmSubPoints[1].Tolerance := 0;

          dtmSubPoints[2].x := 98;
          dtmSubPoints[2].y := 91;
          dtmSubPoints[2].AreaSize := 0;
          dtmSubPoints[2].AreaShape := 0;
          dtmSubPoints[2].Color := FloorColor;
          dtmSubPoints[2].Tolerance := 0;

          dtmSubPoints[3].x := 130;
          dtmSubPoints[3].y := 60;
          dtmSubPoints[3].AreaSize := 0;
          dtmSubPoints[3].AreaShape := 0;
          dtmSubPoints[3].Color := CactiColor;
          dtmSubPoints[3].Tolerance := 0;
        end;
      end;
      TempTDTM.MainPoint := dtmMainPoint;
      TempTDTM.SubPoints := dtmSubPoints;
      Result := AddDTM(TempTDTM);
    end;

    procedure Walking;
    var
      DTM: Integer;
    begin
      DTM := LoadDDTM(1);
      DTMRotated(DTM, x, y, MMX1, MMY1, MMX2, MMY2);
      Mouse(x, y, 2, 2, True);
      FFlag(5);
      FreeDTM(DTM);
    end;

    You need to put the DDTM in a variable. Otherwise you will load it two times.
    This way you loads it into a variable, searches for it and then frees the variable

  18. #18
    Join Date
    Jul 2008
    Location
    Poland
    Posts
    375
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    look at 10th post
    :P

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
  •