Results 1 to 22 of 22

Thread: errors!

  1. #1
    Join Date
    Jan 2009
    Posts
    10
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    errors!

    i have 2 errors in my script

    Failed when compiling
    Line 4: [Error] (4:20): Identifier expected in script C:\Program Files\SCAR 3.15\Scripts\#1.scar
    Failed when compiling
    Line 1: [Error] (1:1): 'BEGIN' expected in script C:\Program Files\SCAR 3.15\Scripts\#1.scar

    help


    heres my script

    SCAR Code:
    ___________________________________________________________
    [                                                     ___   ]
    [     /\  /\      /\     !\      /\  /\    !   ! /   !      ]
    [    /  \/  \    /__\    ! )    /  \/  \   !   !/    !--    ]
    [   /        \  /    \   !/    /        \  !   ! \   !___   ]
    [___________________________________________________________]

    program New;
    procedure new1;
    begin
    movemouse(772, 338)Integer;
    end;


    procedure new2;
    var
    772, 338 :Integer
    begin
    if(findcolor(772, 338, color, xs, ys, xe, ye))then
    movemouse(772, 338)
    end;
    Begin
    Procedure new1;
    Procedure new2;
    end.

  2. #2
    Join Date
    Sep 2006
    Location
    Canada
    Posts
    1,124
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    SCAR Code:
    // ___________________________________________________________
    //[                                                     ___   ]
    //[     /\  /\      /\     !\      /\  /\    !   ! /   !      ]
    //[    /  \/  \    /__\    ! )    /  \/  \   !   !/    !--    ]
    //[   /        \  /    \   !/    /        \  !   ! \   !___   ]
    //[___________________________________________________________]

    program New;
    procedure new1;
    begin
    movemouse(772, 338); //removal of integer
    end;


    procedure new2;
    var
    x, y :Integer; // As far as I know numbers can not be variables (I think?)
    begin    //Above variable declaration also missing a semicolon
      if(findcolor(x, y, color, xs, ys, xe, ye))then  //you have to fill
      movemouse(x, y);        //and the parameters where to search
    end;

    Begin
      new1;     //main loop is wrong, you do not need
      new2;     //to include procedure here, just the name
    end.

    You also needed to comment out your big text at the top.

    Edit: Also I forgot to mention, FindColor will put the respective main screen coordinates into X and Y.

  3. #3
    Join Date
    Jan 2009
    Posts
    10
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    im so confused im new can u explain it in noobish form?

    how do i fill in this?

    SCAR Code:
    if(findcolor(x, y, color, xs, ys, xe, ye))then

  4. #4
    Join Date
    Sep 2006
    Location
    Canada
    Posts
    1,124
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Explain what? What are you having troubles with?

  5. #5
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    SCAR Code:
    if(findcolor(x, y, coloryouwant, xs, ys, xe, ye))then
    x, y are variables, so leave them as x, y.
    input a color for "coloryouwant"

    xs, ys, xe, ye is the coordinate box you want to search for the color in...
    srl ones are:
    mmx1,mmy1,mmx2,mmy2 - minimap
    msx1,msy1,msx2,msy2 - mainscreen
    mix1,miy1,mix2,miy2 - inventory
    MCX1, MCY1, MCX2, MCY2 - chatbox

    hope that helped

  6. #6
    Join Date
    Jan 2009
    Posts
    10
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    hey i added what you all said and i got this

    Line 19: [Error] (19:24): Unknown identifier 'green' in script C:\Program Files\SCAR 3.15\Scripts\#1remix.scar

    now this is wat the script looks like now

    SCAR Code:
    // ___________________________________________________________
    //[                                                     ___   ]
    //[     /\  /\      /\     !\      /\  /\    !   ! /   !      ]
    //[    /  \/  \    /__\    ! )    /  \/  \   !   !/    !--    ]
    //[   /        \  /    \   !/    /        \  !   ! \   !___   ]
    //[___________________________________________________________]

    program New;
    procedure new1;
    begin
    movemouse(772, 338);
    end;


    procedure new2;
    var
    y, x :Integer;
    begin;
      if(findcolor(772, 338, green, msx1,msy1,msx2,msy2 ))then  //<---- right over there
      movemouse(772, 338)
    end;
    Begin
      new1;
      new2;
    end.


    edit: ok i typed the color number that goes there and it said that was ok but now its msx1
    that its having problems with and i think after i get that settled out that ill have problems with msy1 then msx2 then msy2 so how can i stop that?

  7. #7
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    you need to include srl
    SCAR Code:
    // ___________________________________________________________
    //[                                                     ___   ]
    //[     /\  /\      /\     !\      /\  /\    !   ! /   !      ]
    //[    /  \/  \    /__\    ! )    /  \/  \   !   !/    !--    ]
    //[   /        \  /    \   !/    /        \  !   ! \   !___   ]
    //[___________________________________________________________]
     
    program New;
    {.Include SRL\SRL.SCAR}

    procedure new1;
    begin
    movemouse(772, 338);
    end;
     
     
    procedure new2;
    var
    y, x :Integer;
    begin;
      if(findcolor(772, 338, green, msx1,msy1,msx2,msy2 ))then  //<---- right over there
      movemouse(772, 338)
    end;
    Begin
      SetupSRL;
      new1;
      new2;
    end.

  8. #8
    Join Date
    Sep 2006
    Location
    Canada
    Posts
    1,124
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    When you grab a client with the crosshairs, the top left of the window that you grabbed is 0, 0 for x and y respectively. Lets say you wanted to search from the top left to the bottom right of a 100 x 100 px big window you would put
    SCAR Code:
    If(findcolor(x, y, 123456789, 0, 0, 100, 100))then

    Also those constants are in the SRL include and you need to include SRL and call SetupSRL to use them.

  9. #9
    Join Date
    Oct 2007
    Location
    http://ushort.us/oqmd65
    Posts
    2,605
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Fixed plus you didnt need procedure 1. Plus use mouse function, its less detectable.

    SCAR Code:
    // ___________________________________________________________
    //[                                                     ___   ]
    //[     /\  /\      /\     !\      /\  /\    !   ! /   !      ]
    //[    /  \/  \    /__\    ! )    /  \/  \   !   !/    !--    ]
    //[   /        \  /    \   !/    /        \  !   ! \   !___   ]
    //[___________________________________________________________]
     
    program New;
    {.include srl/srl.scar} // NEED TO INCLUDE THIS.

     
    procedure clickiffindcolor;
    var
    y, x :Integer;
    begin;
      if(findcolor(772, 338, 1234948585, msx1,msy1,msx2,msy2 ))then // Replace1234948585 with the color u want.
      mouse(772, 338,0,0,true)  // Will move the mouse and click there!
    end;

    Begin
      clickiffindcolor;
    end.
    I do visit every 2-6 months

  10. #10
    Join Date
    Jan 2009
    Posts
    10
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Capricorn View Post
    When you grab a client with the crosshairs, the top left of the window that you grabbed is 0, 0 for x and y respectively. Lets say you wanted to search from the top left to the bottom right of a 100 x 100 px big window you would put
    SCAR Code:
    If(findcolor(x, y, 123456789, 0, 0, 100, 100))then

    Also those constants are in the SRL include and you need to include SRL and call SetupSRL to use them.

    tytytytytytytyttytytytytytytyty

  11. #11
    Join Date
    Oct 2007
    Location
    http://ushort.us/oqmd65
    Posts
    2,605
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Use my way madmike, its better
    I do visit every 2-6 months

  12. #12
    Join Date
    Jan 2009
    Posts
    10
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i still gt this

    Line 19: [Error] (19:33): Unknown identifier 'msx' in script C:\Program Files\SCAR 3.15\Scripts\#1remix.scar

  13. #13
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    zasz you got it wrong
    SCAR Code:
    // ___________________________________________________________
    //[                                                     ___   ]
    //[     /\  /\      /\     !\      /\  /\    !   ! /   !      ]
    //[    /  \/  \    /__\    ! )    /  \/  \   !   !/    !--    ]
    //[   /        \  /    \   !/    /        \  !   ! \   !___   ]
    //[___________________________________________________________]
     
    program New;
    {.include srl/srl.scar} // NEED TO INCLUDE THIS.
     
     
    procedure clickiffindcolor;
    var
    y, x :Integer;
    begin;
      if(findcolor(772, 338, 1234948585, msx1,msy1,msx2,msy2 ))then // Replace1234948585 with the color u want.
      mouse(772, 338,0,0,true)  // Will move the mouse and click there!
    end;
     
    Begin
     setupsrl;
     clickiffindcolor;
    end.

    haha you forgot setupsrl;

  14. #14
    Join Date
    Oct 2007
    Location
    http://ushort.us/oqmd65
    Posts
    2,605
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    dang, Just add setupsrl to main loop and I WIN!
    I do visit every 2-6 months

  15. #15
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    // ___________________________________________________________
    //[                                                     ___   ]
    //[     /\  /\      /\     !\      /\  /\    !   ! /   !      ]
    //[    /  \/  \    /__\    ! )    /  \/  \   !   !/    !--    ]
    //[   /        \  /    \   !/    /        \  !   ! \   !___   ]
    //[___________________________________________________________]

    program New;
    {.include srl/srl.scar} // NEED TO INCLUDE THIS.

    procedure clickiffindcolor;
    var
      x, y : Integer;
    begin;
      if (findcolor(x, y, 1234948585, msx1, msy1, msx2, msy2))then // Replace1234948585 with the color u want.
        mouse(x, y, 0, 0, true)  // Will move the mouse and click there!
    end;

    Begin
      setupsrl;
      clickiffindcolor;
    end.

    No, I win.

    ~Sandstorm

  16. #16
    Join Date
    Jan 2009
    Posts
    10
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ok now i have this

    Line 46: [Error] (46:11): Unknown identifier 'CreateTPAFromBMP' in script C:\Program Files\SCAR 3.15\includes\SRL\SRL\Core\Math.scar

    and it opens a new tab for this aswell and the new tab is this

    SCAR Code:
    //-----------------------------------------------------------------//
    //--               Scar Standard Resource Library                --//
    //--               ยป Math Routines                               --//
    //-----------------------------------------------------------------//
    // * procedure LoadCoSineArrays;                                                                           // * by Mutant Squirrle
    // * function CreateTPAFromText(Txt : String; Chars : Integer) : TPointArray;                              // * by Raymond
    // * function GetSplinePt(Points: TPointArray; Theta: Extended): TPoint;                                   // * by BenLand100
    // * function MakeSplinePath(Points: TPointArray; ThetaInc: Extended): TPointArray;                        // * by BenLand100
    // * function MidPoints(Path: TPointArray; MaxDist: Integer): TPointArray;                                 // * by BenLand100
    // * function InAbstractBox(x1, y1, x2, y2, x3, y3, x4, y4: Integer; x, y: Integer): Boolean;              // * by BenLand100
    // * function inAngle(Origin: TPoint; Angle1, Angle2, Radius1, Radius2: Extended; X, Y: Integer): Boolean; // * by BenLand100
    // * function Sine(degrees: Integer): Extended;                                                            // * by ?
    // * function Cose(degrees: Integer): Extended;                                                            // * by ?

    Var
       SineArray, Cosearray: Array[0..360] Of Extended;
       
    {*******************************************************************************
    procedure LoadCoSineArrays;
    By: Mutant Squirrle
    Description: Loads arrays for use with Radial- and LinearWalk.
    *******************************************************************************}


    procedure LoadCoSineArrays;
    var
      i: Integer;
    begin
      for i := 0 to 360 do
      begin
        Sinearray[i] := Sin(i * Pi / 180);
        Cosearray[i] := Cos(i * Pi / 180);
      end;
    end;

    {*******************************************************************************
    Function CreateTPAFromText(Txt : String; Chars : Integer) : TPointArray;
    By: MastaRaymond
    Description: Returns the TPointArray of the inputted Text. Needs Wizzyplugin
    *******************************************************************************}


    Function CreateTPAFromText(Txt : String; Chars : Integer) : TPointArray;
    var
      TempBMP : integer;
    begin;
      TempBMP := CreateBitmapMaskFromText(Txt,Chars);
      Result := CreateTPAFromBMP( GetBitmapDC(TempBMP));
      FreeBitmap(TempBMP);
    end;


    {*******************************************************************************
    function GetSplinePt(Points: TPointArray; Theta: Extended): TPoint;
    By: BenLand100
    Description: Returns the point on a spline, defined by control points Points, at Theta
    *******************************************************************************}


    function GetSplinePt(Points: TPointArray; Theta: Extended): TPoint;
    var
      i, n: Integer;
      XTemp, YTemp: Extended;
    begin
      n := GetArrayLength(Points) - 1;
      for i := 0 to n do
      begin
        XTemp := XTemp + (BinCoe(n, i) * Points[i].x * Pow((1 - Theta), n - i) *
          Pow(Theta, i));
        YTemp := YTemp + (BinCoe(n, i) * Points[i].y * Pow((1 - Theta), n - i) *
          Pow(Theta, i));
      end;
      Result.x := Round(XTemp);
      Result.y := Round(YTemp);
    end;

    {*******************************************************************************
    function MakeSplinePath(Points: TPointArray; ThetaInc: Extended): TPointArray;
    By: BenLand100
    Description: Returns a spline, defined by control points Points, incrementing theta by ThetaInc
    *******************************************************************************}


    function MakeSplinePath(Points: TPointArray; ThetaInc: Extended): TPointArray;
    var
      i: Integer;
      t: Extended;
      temp, last: TPoint;
      done: Boolean;
    begin
      repeat
        if t >= 1 then
        begin
          t := 1;
          done := True;
        end;
        temp := GetSplinePt(Points, t);
        if ((temp.x <> last.x) and (temp.y <> last.y)) then
        begin
          i := i + 1;
          SetArrayLength(Result, i);
          Result[i - 1] := temp;
          last := temp;
        end;
        t := t + ThetaInc;
      until (done)
    end;

    {*******************************************************************************
    function MidPoints(Path: TPointArray; MaxDist: Integer): TPointArray;
    By: BenLand100
    Description: Adds midpoints to Path so no distance on it is greater than MaxDist
    *******************************************************************************}


    function MidPoints(Path: TPointArray; MaxDist: Integer): TPointArray;
    var
      i, c: Integer;
      last: TPoint;
      done: Boolean;
    begin
      if (getarraylength(path) > 0) then
      begin
        repeat
          last := Path[0];
          done := True;
          for i := 1 to GetArrayLength(Path) - 1 do
          begin
            if Sqrt(Pow((Path[i].x - last.x), 2) + Pow((Path[i].y - last.y), 2)) >
              MaxDist then
            begin
              done := False;
              SetArrayLength(Path, GetArrayLength(Path) + 1);
              for c := GetArrayLength(Path) - 1 downto i + 1 do
              begin
                Path[c] := Path[c - 1];
              end;
              Path[i].x := Round((last.x + Path[i + 1].x) / 2);
              Path[i].y := Round((last.y + Path[i + 1].y) / 2);
            end;
            last := Path[i];
          end;
        until (done);
      end;
      Result := Path;
    end;

    {*******************************************************************************
    function InAbstractBox(x1, y1, x2, y2, x3, y3, x4, y4: Integer; x, y: Integer): Boolean;
    By: BenLand100
    Description: Returns true if point x, y is in an abstract box defined by x1, y1, x2, y2, x3, y3, x4, y4
    An abstract box example:

    x1, y1     x2, y2
       +--------+
        \         /
         \       /
          +--+
    x4, y4    x3, y3
    *******************************************************************************}


    function InAbstractBox(x1, y1, x2, y2, x3, y3, x4, y4: Integer; x, y: Integer):
      Boolean;
    var
      U, D, R, L: Boolean;
      UB, DB, LB, RB, UM, DM, LM, RM: Extended;
    begin
      UM := (-y1 - -y2) div (x1 - x2);
      DM := (-y4 - -y3) div (x4 - x3);
      if x1 - x4 <> 0 then
      begin
        LM := (-y1 - -y4) div (x1 - x4);
      end else
      begin
        LM := Pi;
      end;
      if x2 - x3 <> 0 then
      begin
        RM := (-y2 - -y3) div (x2 - x3);
      end else
      begin
        RM := Pi;
      end;
      UB := -(UM * x1) + -y1
        RB := -(RM * x2) + -y2;
      DB := -(DM * x3) + -y3;
      LB := -(LM * x4) + -y4;
      if (UM * x + UB >= -y) then U := True;
      if (DM * x + DB <= -y) then D := True;
      if (RM <> Pi) and (RM >= 0) and (RM * x + RB <= -y) then R := True;
      if (RM <> Pi) and (RM < 0) and (RM * x + RB >= -y) then R := True;
      if (RM = Pi) and (x < x2) then R := True;
      if (LM <> Pi) and (LM >= 0) and (LM * x + LB >= -y) then L := True;
      if (LM <> Pi) and (LM < 0) and (LM * x + LB <= -y) then L := True;
      if (LM = Pi) and (x > x1) then L := True;
      if U and D and L and R then Result := True;
    end;

    {*******************************************************************************
    function inAngle(Origin: TPoint; Angle1, Angle2, Radius1, Radius2: Extended; X, Y: Integer): Boolean;
    By: BenLand100
    Description: Returns True if X and Y fall within Radius1 to Radius2 and Angle1 to Angle2
    Note1: EVERYTHING IS RELATIVE TO ORIGIN!!!
    Note2: This checks in the smallest segment of the circle formed by Angle1 and Angle 2
    Example: (Assume the origin is 0,0)
     inAngle(0, 90, 5, 10, origin, 5, 5) = true;
     inAngle(0, 90, 0, 5, origin, 5, 5) = false;
     inAngle(90, 0, 5, 10, origin, 5, 5) = false;
    *******************************************************************************}


    function inAngle(Origin: TPoint; Angle1, Angle2, Radius1, Radius2: Extended; x,
      y: Integer): Boolean;
    var
      PTemp: PPoint;
      OTemp: TPoint;
      MinAngle, MaxAngle, MinRadius, MaxRadius: Extended;
    begin
      Angle1 := FixD(Angle1);
      Angle2 := FixD(Angle2);
      MinAngle := Angle1;
      if Angle1 > Angle2 then MinAngle := Angle2;
      MaxAngle := Angle1;
      if Angle1 < Angle2 then MaxAngle := Angle2;
      MinRadius := Radius1;
      if Radius1 > Radius2 then MinRadius := Radius2;
      MaxRadius := Radius1;
      if Radius1 < Radius2 then MaxRadius := Radius2;
      OTemp.x := x;
      OTemp.y := y;
      PTemp := ToPolarOffset(OTemp, Origin);
      if (PTemp.R >= MinRadius) and (PTemp.R <= MaxRadius) then
        if (PTemp.T >= MinAngle) and (PTemp.T <= MaxAngle) then
          Result := True;
    end;

    {*******************************************************************************
    function Sine(degrees: Integer): Extended;
    By:
    Description:
    *******************************************************************************}


    function Sine(Degrees: Integer): Extended;
    begin
      Result := sinearray[Trunc(FixD(Degrees))];
    end;

    {*******************************************************************************
    function Cose(degrees: Integer): Extended;
    By:
    Description:
    *******************************************************************************}


    function Cose(Degrees: Integer): Extended;
    begin
      Result := cosearray[Trunc(FixD(Degrees))];
    end;

  17. #17
    Join Date
    Jan 2009
    Posts
    10
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    anyone got anything on that? ^

  18. #18
    Join Date
    Oct 2007
    Location
    http://ushort.us/oqmd65
    Posts
    2,605
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Post all of YOUR script so I can see whats wrong.
    I do visit every 2-6 months

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

    Default

    and don't double post please

  20. #20
    Join Date
    Jul 2008
    Location
    Canada
    Posts
    1,612
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

  21. #21
    Join Date
    Jan 2009
    Posts
    10
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    this is the script im making and im making an auto aimer

    SCAR Code:
    // ___________________________________________________________
    //[                                                     ___   ]
    //[     /\  /\      /\     !\      /\  /\    !   ! /   !      ]
    //[    /  \/  \    /__\    ! )    /  \/  \   !   !/    !--    ]
    //[   /        \  /    \   !/    /        \  !   ! \   !___   ]
    //[___________________________________________________________]

    program New;
    {.Include srl/srl.scar}

    procedure clickiffindcolor;
    var
      x, y : Integer;
    begin;
      if (findcolor(x, y, 1121569, msx311, msy-141, msx-155, msy210 ))then
      mouse(468, 519,0,0,true)
    end;

    Begin
      setupsrl;
      clickiffindcolor;
    end;


    when i press play it says

    Code:
    Line 46: [Error] (256:11): Unknown identifier 'CreateTPAFromBMP' in script C:\Program Files\SCAR 3.15\includes\SRL/SRL/Core/Math.scar
    and it adds this tap to its math.scar and i dont know why it aint working!

    SCAR Code:
    //-----------------------------------------------------------------//
    //--               Scar Standard Resource Library                --//
    //--               ยป Math Routines                               --//
    //-----------------------------------------------------------------//
    // * procedure LoadCoSineArrays;                                                                           // * by Mutant Squirrle
    // * function CreateTPAFromText(Txt : String; Chars : Integer) : TPointArray;                              // * by Raymond
    // * function GetSplinePt(Points: TPointArray; Theta: Extended): TPoint;                                   // * by BenLand100
    // * function MakeSplinePath(Points: TPointArray; ThetaInc: Extended): TPointArray;                        // * by BenLand100
    // * function MidPoints(Path: TPointArray; MaxDist: Integer): TPointArray;                                 // * by BenLand100
    // * function InAbstractBox(x1, y1, x2, y2, x3, y3, x4, y4: Integer; x, y: Integer): Boolean;              // * by BenLand100
    // * function inAngle(Origin: TPoint; Angle1, Angle2, Radius1, Radius2: Extended; X, Y: Integer): Boolean; // * by BenLand100
    // * function Sine(degrees: Integer): Extended;                                                            // * by ?
    // * function Cose(degrees: Integer): Extended;                                                            // * by ?

    Var
       SineArray, Cosearray: Array[0..360] Of Extended;
       
    {*******************************************************************************
    procedure LoadCoSineArrays;
    By: Mutant Squirrle
    Description: Loads arrays for use with Radial- and LinearWalk.
    *******************************************************************************}


    procedure LoadCoSineArrays;
    var
      i: Integer;
    begin
      for i := 0 to 360 do
      begin
        Sinearray[i] := Sin(i * Pi / 180);
        Cosearray[i] := Cos(i * Pi / 180);
      end;
    end;

    {*******************************************************************************
    Function CreateTPAFromText(Txt : String; Chars : Integer) : TPointArray;
    By: MastaRaymond
    Description: Returns the TPointArray of the inputted Text. Needs Wizzyplugin
    *******************************************************************************}


    Function CreateTPAFromText(Txt : String; Chars : Integer) : TPointArray;
    var
      TempBMP : integer;
    begin;
      TempBMP := CreateBitmapMaskFromText(Txt,Chars);
      Result := CreateTPAFromBMP( GetBitmapDC(TempBMP));   //<----------- theres the error line 46
      FreeBitmap(TempBMP);
    end;


    {*******************************************************************************
    function GetSplinePt(Points: TPointArray; Theta: Extended): TPoint;
    By: BenLand100
    Description: Returns the point on a spline, defined by control points Points, at Theta
    *******************************************************************************}


    function GetSplinePt(Points: TPointArray; Theta: Extended): TPoint;
    var
      i, n: Integer;
      XTemp, YTemp: Extended;
    begin
      n := GetArrayLength(Points) - 1;
      for i := 0 to n do
      begin
        XTemp := XTemp + (BinCoe(n, i) * Points[i].x * Pow((1 - Theta), n - i) *
          Pow(Theta, i));
        YTemp := YTemp + (BinCoe(n, i) * Points[i].y * Pow((1 - Theta), n - i) *
          Pow(Theta, i));
      end;
      Result.x := Round(XTemp);
      Result.y := Round(YTemp);
    end;

    {*******************************************************************************
    function MakeSplinePath(Points: TPointArray; ThetaInc: Extended): TPointArray;
    By: BenLand100
    Description: Returns a spline, defined by control points Points, incrementing theta by ThetaInc
    *******************************************************************************}


    function MakeSplinePath(Points: TPointArray; ThetaInc: Extended): TPointArray;
    var
      i: Integer;
      t: Extended;
      temp, last: TPoint;
      done: Boolean;
    begin
      repeat
        if t >= 1 then
        begin
          t := 1;
          done := True;
        end;
        temp := GetSplinePt(Points, t);
        if ((temp.x <> last.x) and (temp.y <> last.y)) then
        begin
          i := i + 1;
          SetArrayLength(Result, i);
          Result[i - 1] := temp;
          last := temp;
        end;
        t := t + ThetaInc;
      until (done)
    end;

    {*******************************************************************************
    function MidPoints(Path: TPointArray; MaxDist: Integer): TPointArray;
    By: BenLand100
    Description: Adds midpoints to Path so no distance on it is greater than MaxDist
    *******************************************************************************}


    function MidPoints(Path: TPointArray; MaxDist: Integer): TPointArray;
    var
      i, c: Integer;
      last: TPoint;
      done: Boolean;
    begin
      if (getarraylength(path) > 0) then
      begin
        repeat
          last := Path[0];
          done := True;
          for i := 1 to GetArrayLength(Path) - 1 do
          begin
            if Sqrt(Pow((Path[i].x - last.x), 2) + Pow((Path[i].y - last.y), 2)) >
              MaxDist then
            begin
              done := False;
              SetArrayLength(Path, GetArrayLength(Path) + 1);
              for c := GetArrayLength(Path) - 1 downto i + 1 do
              begin
                Path[c] := Path[c - 1];
              end;
              Path[i].x := Round((last.x + Path[i + 1].x) / 2);
              Path[i].y := Round((last.y + Path[i + 1].y) / 2);
            end;
            last := Path[i];
          end;
        until (done);
      end;
      Result := Path;
    end;

    {*******************************************************************************
    function InAbstractBox(x1, y1, x2, y2, x3, y3, x4, y4: Integer; x, y: Integer): Boolean;
    By: BenLand100
    Description: Returns true if point x, y is in an abstract box defined by x1, y1, x2, y2, x3, y3, x4, y4
    An abstract box example:

    x1, y1     x2, y2
       +--------+
        \         /
         \       /
          +--+
    x4, y4    x3, y3
    *******************************************************************************}


    function InAbstractBox(x1, y1, x2, y2, x3, y3, x4, y4: Integer; x, y: Integer):
      Boolean;
    var
      U, D, R, L: Boolean;
      UB, DB, LB, RB, UM, DM, LM, RM: Extended;
    begin
      UM := (-y1 - -y2) div (x1 - x2);
      DM := (-y4 - -y3) div (x4 - x3);
      if x1 - x4 <> 0 then
      begin
        LM := (-y1 - -y4) div (x1 - x4);
      end else
      begin
        LM := Pi;
      end;
      if x2 - x3 <> 0 then
      begin
        RM := (-y2 - -y3) div (x2 - x3);
      end else
      begin
        RM := Pi;
      end;
      UB := -(UM * x1) + -y1
        RB := -(RM * x2) + -y2;
      DB := -(DM * x3) + -y3;
      LB := -(LM * x4) + -y4;
      if (UM * x + UB >= -y) then U := True;
      if (DM * x + DB <= -y) then D := True;
      if (RM <> Pi) and (RM >= 0) and (RM * x + RB <= -y) then R := True;
      if (RM <> Pi) and (RM < 0) and (RM * x + RB >= -y) then R := True;
      if (RM = Pi) and (x < x2) then R := True;
      if (LM <> Pi) and (LM >= 0) and (LM * x + LB >= -y) then L := True;
      if (LM <> Pi) and (LM < 0) and (LM * x + LB <= -y) then L := True;
      if (LM = Pi) and (x > x1) then L := True;
      if U and D and L and R then Result := True;
    end;

    {*******************************************************************************
    function inAngle(Origin: TPoint; Angle1, Angle2, Radius1, Radius2: Extended; X, Y: Integer): Boolean;
    By: BenLand100
    Description: Returns True if X and Y fall within Radius1 to Radius2 and Angle1 to Angle2
    Note1: EVERYTHING IS RELATIVE TO ORIGIN!!!
    Note2: This checks in the smallest segment of the circle formed by Angle1 and Angle 2
    Example: (Assume the origin is 0,0)
     inAngle(0, 90, 5, 10, origin, 5, 5) = true;
     inAngle(0, 90, 0, 5, origin, 5, 5) = false;
     inAngle(90, 0, 5, 10, origin, 5, 5) = false;
    *******************************************************************************}


    function inAngle(Origin: TPoint; Angle1, Angle2, Radius1, Radius2: Extended; x,
      y: Integer): Boolean;
    var
      PTemp: PPoint;
      OTemp: TPoint;
      MinAngle, MaxAngle, MinRadius, MaxRadius: Extended;
    begin
      Angle1 := FixD(Angle1);
      Angle2 := FixD(Angle2);
      MinAngle := Angle1;
      if Angle1 > Angle2 then MinAngle := Angle2;
      MaxAngle := Angle1;
      if Angle1 < Angle2 then MaxAngle := Angle2;
      MinRadius := Radius1;
      if Radius1 > Radius2 then MinRadius := Radius2;
      MaxRadius := Radius1;
      if Radius1 < Radius2 then MaxRadius := Radius2;
      OTemp.x := x;
      OTemp.y := y;
      PTemp := ToPolarOffset(OTemp, Origin);
      if (PTemp.R >= MinRadius) and (PTemp.R <= MaxRadius) then
        if (PTemp.T >= MinAngle) and (PTemp.T <= MaxAngle) then
          Result := True;
    end;

    {*******************************************************************************
    function Sine(degrees: Integer): Extended;
    By:
    Description:
    *******************************************************************************}


    function Sine(Degrees: Integer): Extended;
    begin
      Result := sinearray[Trunc(FixD(Degrees))];
    end;

    {*******************************************************************************
    function Cose(degrees: Integer): Extended;
    By:
    Description:
    *******************************************************************************}


    function Cose(Degrees: Integer): Extended;
    begin
      Result := cosearray[Trunc(FixD(Degrees))];
    end;

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

    Default

    SCAR Code:
    // ___________________________________________________________
    //[                                                     ___   ]
    //[     /\  /\      /\     !\      /\  /\    !   ! /   !      ]
    //[    /  \/  \    /__\    ! )    /  \/  \   !   !/    !--    ]
    //[   /        \  /    \   !/    /        \  !   ! \   !___   ]
    //[___________________________________________________________]

    program New;
    {.Include srl/srl.scar}
    var
     x, y: integer;
     
    procedure clickiffoundcolor;
    begin
      if (FindColorSpiralTolerance(x, y, 1121569, MSX1, MSY1, MSX2, MSY2, 2)) then
      mouse(468, 519,0,0, true);
    end;

    Begin
      setupsrl;
      clickiffoundcolor;
    end.

    at the end of your script, the last end; has to be end.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Errors.....
    By MrDeeds in forum OSR Help
    Replies: 3
    Last Post: 06-04-2007, 07:44 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
  •