Freddy1990
2009-12-17 07:54:31
Since I'm currently preparing for my exams, I don't have much time to work on SCAR. However, I know you're all patiently waiting for SCAR Luna 3.50, so I've decided to give you a little sneak peak. The program is far from complete, if I'd have to stick an arbitrary number onto it, I'd say it's somewhere along the lines of 10% completed. Currently it does not have many tools, neither does it support DTMs or OCR, the first thing to do is to complete as many FindBitmap/Color functions. It does features some nifty new abilities like the Color Picker History. Also, nothing is saved to the registry, neither by the regular or portable version.
Screenshot:

These are the functions currently available in the core aside from system functions like IntToStr and such:
The current version support error reporting. Note that several features in the program are there, but unfinished, like the multiple bitmaps to string converter. It works but is just a preliminary model, it's still going undergo big changes. The program also does not yet have a compatibility mode for SCAR 3.2x, so most 3.2x scripts won't run yet. It does fully support including files, the same way as before, no plugins yet though. You'll find it does feature several new functions that weren't in the previous versions, like FindBitmapsSpiral or IntToHex.
Note that this isn't an invitation for requests and suggestions, I have to stick to my strict plan on how I'm going to build this or it will turn into a mess… Feel free to report any bugs you may encounter though… Most of the functions have been tested, but only to so big of an extend, some may possibly have bugs… All FindX functions are completely new and theoretically faster than all the ones in SCAR 3.2x, also, the Spiral functions are 200-250% faster. Do take in account that the current release has memory leak tracking enabled, though I'm fairly confident it has no memory leaks, the tracking of such will slightly decrease performance, so the FindX functions might be slightly slower than advertised, though the final version will not feature memory leak tracking, only pre-release versions. The impact on the performance should be fairly minimal though.
You can find the sneak peak version here: http://freddy1990.com/svn/scarprerelease/Luna/
It is a portable version of the program and comes with a couple of example and benchmark scripts.
(NOTE: BitmapFromString is completely backwards compatible with all previous strings that were loaded by the function.)
If you have any questions on how to use certain functions, feel free to ask.
Screenshot:

These are the functions currently available in the core aside from system functions like IntToStr and such:
function SimilarColors(const Color1, Color2, Tolerance: Integer): Boolean;
function SimilarBitmaps(const iBitmap1, iBitmap2, Tolerance: Integer): Boolean;
function GetTolerance(const Color1, Color2: Integer): Integer;
function GetClosestColor(const Color: Integer; const Colors: TIntegerArray): Integer;
function SetToleranceMode(const Mode: Byte): Byte;
function GetToleranceMode: Byte;
procedure SetTolMode2Modifiers(const HueChangeBounds, SatChangeBounds: Single);
procedure GetTolMode2Modifiers(out HueChangeBounds, SatChangeBounds: Single);
procedure SetTolMode3Modifiers(const Sensitivity: Integer);
procedure GetTolMode3Modifiers(out Sensitivity: Integer);
function BitmapAssigned(const iBitmap: Integer): Boolean;
function BitmapToString(const iBitmap: Integer): AnsiString;
function BitmapFromString(const Width, Height: Integer; const BitmapString: AnsiString): Integer;
function BitmapFromClient(const xs, ys, xe, ye: Integer): Integer;
function LoadBitmap(const FileName: string): Integer;
function FreeBitmap(const iBitmap: Integer): Boolean;
function SaveBitmap(const iBitmap: Integer; const FileName: string): Boolean;
function CreateBitmap(const Width, Height, Color: Integer): Integer;
procedure GetBitmapSize(const iBitmap: Integer; out Width, Height: Integer);
function GetBitmapPixel(const iBitmap: Integer; const x, y: Integer): Integer;
procedure SetBitmapPixel(const iBitmap: Integer; const x, y, Color: Integer);
procedure ReplaceBitmapColor(const iBitmap: Integer; const OldColor, NewColor: Integer);
procedure ReplaceBitmapColorTolerance(const iBitmap: Integer; const OldColor, NewColor, Tolerance: Integer);
function CountBitmap(const Bmp: Integer; const xs, ys, xe, ye: Integer): Integer;
function CountBitmapTolerance(const Bmp: Integer; const xs, ys, xe, ye, Tol: Integer): Integer;
function FindBitmap(const iBitmap: Integer; out x, y: Integer; const xs, ys, xe, ye: Integer): Boolean;
function FindBitmapTolerance(const iBitmap: Integer; out x, y: Integer; const xs, ys, xe, ye, Tolerance: Integer): Boolean;
function FindBitmaps(const iBitmap: Integer; out Points: TPointArray; const xs, ys, xe, ye: Integer): Boolean;
function FindBitmapsTolerance(const iBitmap: Integer; out Points: TPointArray; const xs, ys, xe, ye, Tolerance: Integer): Boolean;
function FindBitmapSpiral(const iBitmap: Integer; var x, y: Integer; const xs, ys, xe, ye: Integer): Boolean;
function FindBitmapSpiralTolerance(const iBitmap: Integer; var x, y: Integer; const xs, ys, xe, ye, Tolerance: Integer): Boolean;
function FindBitmapsSpiral(const iBitmap: Integer; out Points: TPointArray; const xs, ys, xe, ye: Integer): Boolean;
function FindBitmapsSpiralTolerance(const iBitmap: Integer; out Points: TPointArray; const xs, ys, xe, ye, Tolerance: Integer): Boolean;
function FindDeformedBitmap(const iBitmap: Integer; out x, y: Integer; const xs, ys, xe, ye: Integer; Range: Integer; AllowPartialAccuracy: Boolean; out Accuracy: Extended): Boolean;
function FindDeformedBitmapTolerance(const iBitmap: Integer; out x, y: Integer; const xs, ys, xe, ye, Tolerance: Integer; Range: Integer; AllowPartialAcc: Boolean; out Accuracy: Extended): Boolean;
function FindTranspDeformedBitmap(const iBitmap, TranspColor: Integer; out x, y: Integer; const xs, ys, xe, ye: Integer; Range: Integer; AllowPartialAcc: Boolean; out Accuracy: Extended): Boolean;
function FindTranspDeformedBitmapTolerance(const iBitmap, TranspColor: Integer; out x, y: Integer; const xs, ys, xe, ye, Tol: Integer; Range: Integer; AllowPartialAcc: Boolean; out Accuracy: Extended): Boolean;
procedure WriteLn(const s: string);
procedure Status(const s: string);
function AppPath: string;
procedure ClearDebug;
procedure TerminateScript;
function ScriptPath: string;
procedure Wait(const ms: Cardinal);
function GetSystemTime: Cardinal;
procedure ConvertTime(const ms: Cardinal; out h, m, s: Cardinal);
function TimeRunning: Cardinal;
procedure GetMousePos(out x, y: Integer);
procedure MoveMouse(x, y: Integer);
procedure ClickMouse(const x, y: Integer; const Button: TMouseButton);
procedure MoveMouseSmooth(const x, y: Integer);
procedure MoveMouseSmoothEx(const x, y, MinSleepTime, MaxSleepTime, MaxDistance, Gravity, Forces: Integer);
procedure HoldMouse(const x, y: Integer; const Button: TMouseButton);
procedure ReleaseMouse(const x, y: Integer; const Button: TMouseButton);
procedure MoveWindMouseEx(x, y, rx, ry, MouseSpeed: Integer);
procedure MoveWindMouse(const x, y, rx, ry: Integer);
procedure ClickWindMouse(const x, y, rx, ry: Integer; const Button: TMouseButton);
procedure MouseBox(const x1, y1, x2, y2: Integer);
procedure ClickMouseBox(const x1, y1, x2, y2: Integer; const Button: TMouseButton);
function GetCursorType: TCursor;
procedure SendKeys(const s: string);
procedure SendKeysHuman(const s: string);
procedure KeyDown(const Key: Byte);
procedure KeyUp(const Key: Byte);
function IsNumpadEnabled: Boolean;
function IsCapsLockEnabled: Boolean;
procedure ColorToRGB(const Color: Integer; out R, G, B: Byte);
function RGBToColor(const R, G, B: Byte): Integer;
function GetColor(const x, y: Integer): Integer;
function GetColors(const Points: TPointArray): TIntegerArray;
function CountColor(const Color: Integer; const xs, ys, xe, ye: Integer): Integer;
function CountColorTolerance(const Color: Integer; const xs, ys, xe, ye, Tol: Integer): Integer;
function FindColor(const Color: Integer; out x, y: Integer; const xs, ys, xe, ye: Integer): Boolean;
function FindColorTolerance(const Color: Integer; out x, y: Integer; const xs, ys, xe, ye, Tolerance: Integer): Boolean;
function FindColors(const Color: Integer; out Points: TPointArray; const xs, ys, xe, ye: Integer): Boolean;
function FindColorsTolerance(const Color: Integer; out Points: TPointArray; const xs, ys, xe, ye, Tolerance: Integer): Boolean;
function FindColorSpiral(const Color: Integer; out x, y: Integer; const xs, ys, xe, ye: Integer): Boolean;
function FindColorSpiralTolerance(const Color: Integer; out x, y: Integer; const xs, ys, xe, ye, Tolerance: Integer): Boolean;
function FindColorsSpiral(const Color: Integer; out Points: TPointArray; const xs, ys, xe, ye: Integer): Boolean;
function FindColorsSpiralTolerance(const Color: Integer; out Points: TPointArray; const xs, ys, xe, ye, Tolerance: Integer): Boolean;
function FindColorSkipBox(const Color: Integer; out x, y: Integer; const xs, ys, xe, ye: Integer; const SkipBox: TBox): Boolean;
function FindColorSkipBoxTolerance(const Color: Integer; out x, y: Integer; const xs, ys, xe, ye, Tolerance: Integer; const SkipBox: TBox): Boolean;
function FindColorsSkipBox(const Color: Integer; out Points: TPointArray; const xs, ys, xe, ye: Integer; const SkipBox: TBox): Boolean;
function FindColorsSkipBoxTolerance(const Color: Integer; out Points: TPointArray; const xs, ys, xe, ye, Tolerance: Integer; const SkipBox: TBox): Boolean;
function FindColorSkipBoxes(const Color: Integer; out x, y: Integer; const xs, ys, xe, ye: Integer; const SkipBoxes: TBoxArray): Boolean;
function FindColorSkipBoxesTolerance(const Color: Integer; out x, y: Integer; const xs, ys, xe, ye, Tol: Integer; const SkipBoxes: TBoxArray): Boolean;
function FindColorsSkipBoxes(const Color: Integer; out Points: TPointArray; const xs, ys, xe, ye: Integer; const SkipBoxes: TBoxArray): Boolean;
function FindColorsSkipBoxesTolerance(const Color: Integer; out Points: TPointArray; const xs, ys, xe, ye, Tol: Integer; const SkipBoxes: TBoxArray): Boolean;
function FindColorCircle(const Color: Integer; out x, y: Integer; const mx, my, r: Integer): Boolean;
function FindColorCircleTolerance(const Color: Integer; out x, y: Integer; const mx, my, r, Tolerance: Integer): Boolean;
function FindColorsCircle(const Color: Integer; out Points: TPointArray; const mx, my, r: Integer): Boolean;
function FindColorsCircleTolerance(const Color: Integer; out Points: TPointArray; const mx, my, r, Tolerance: Integer): Boolean;
function Random(const Range: Integer): Integer;
function ArcCos(const X: Extended): Extended;
function ArcSin(const X: Extended): Extended;
function Exp(const X: Extended): Extended;
function Power(const Base, Exponent: Extended): Extended;
function IntPow(const Base: Extended; const Exponent: Integer): Extended;
function MaxI(const A, B: Integer): Integer;
function MaxE(const A, B: Extended): Extended;
function MinI(const A, B: Integer): Integer;
function MinE(const A, B: Extended): Extended;
function SameValue(const A, B: Extended): Boolean;
function Ceil(const X: Extended): Integer;
function Floor(const X: Extended): Integer;
function Sqr(const X: Extended): Extended;
function Rand: Extended;
function Inversus(const X: Extended): Extended;
function InCircle(const x, y, mx, my, r: Integer): Boolean;
function InTriangle(const x, y, x1, y1, x2, y2, x3, y3: Integer): Boolean;
function PolarToCart(Point: PPoint): TPoint;
function CartToPolar(Point: TPoint): PPoint;
function DegToRad(const Degrees: Extended): Extended;
function RadToDeg(const Radians: Extended): Extended;
function IntPower(const Base: Extended; const Exponent: Integer): Extended;
function Tan(const X: Extended): Extended;
function Cotan(const X: Extended): Extended;
function ArcCos(const X: Extended): Extended;
function ArcSin(const X: Extended): Extended;
function ArcTan(const X: Extended): Extended;
function ArcTan2(const X: Extended): Extended;
procedure GetClientSize(out Width, Height: Integer);
function GetClientHandle: Hwnd;
procedure SetClientHandle(const Handle: Hwnd);
function Point(const X, Y: Integer): TPoint;
function Polar(const Radius, Theta: Extended): PPoint;
function IntToBox(const xStart, yStart, xEnd, yEnd: Integer): TBox;
function TPAInTPA(const TPA1, TPA2: TPointArray): Boolean;
function GetTPABounds(const TPA: TPointArray): TBox;
function MiddleTPAEx(const TPA: TPointArray; out x, y: Integer): Boolean;
function MiddleTPA(const TPA: TPointArray): TPoint;
procedure InvertTPA(var TPA: TPointArray);
function CombineTPA(const TPA1, TPA2: TPointArray): TPointArray;
function ReadInterSCARMessage(const Channel: string): string;
function SendInterSCARMessage(const Channel, Message: string): Boolean;
procedure DebugBitmap(const Bmp: Integer);
function ByteToHex(const Value: Byte): AnsiString;
function HexToByte(const Hex: AnsiString): Byte;
function IntToHex(const Value: Cardinal): AnsiString;
function HexToInt(const Hex: AnsiString): Cardinal;The current version support error reporting. Note that several features in the program are there, but unfinished, like the multiple bitmaps to string converter. It works but is just a preliminary model, it's still going undergo big changes. The program also does not yet have a compatibility mode for SCAR 3.2x, so most 3.2x scripts won't run yet. It does fully support including files, the same way as before, no plugins yet though. You'll find it does feature several new functions that weren't in the previous versions, like FindBitmapsSpiral or IntToHex.
Note that this isn't an invitation for requests and suggestions, I have to stick to my strict plan on how I'm going to build this or it will turn into a mess… Feel free to report any bugs you may encounter though… Most of the functions have been tested, but only to so big of an extend, some may possibly have bugs… All FindX functions are completely new and theoretically faster than all the ones in SCAR 3.2x, also, the Spiral functions are 200-250% faster. Do take in account that the current release has memory leak tracking enabled, though I'm fairly confident it has no memory leaks, the tracking of such will slightly decrease performance, so the FindX functions might be slightly slower than advertised, though the final version will not feature memory leak tracking, only pre-release versions. The impact on the performance should be fairly minimal though.
You can find the sneak peak version here: http://freddy1990.com/svn/scarprerelease/Luna/
It is a portable version of the program and comes with a couple of example and benchmark scripts.
(NOTE: BitmapFromString is completely backwards compatible with all previous strings that were loaded by the function.)
If you have any questions on how to use certain functions, feel free to ask.