1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-25 18:52:15 -05:00

Added more functions to make SRL compile..

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@497 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Raymond 2010-01-28 23:34:03 +00:00
parent 276620c8d4
commit 1dafb7c86d
20 changed files with 2185 additions and 2039 deletions

View File

@ -1,11 +1,11 @@
object Form1: TForm1
Left = 593
Left = 273
Height = 557
Top = 321
Top = 233
Width = 734
ActiveControl = ScriptPanel
Caption = 'THA FUKING SIMBA'
ClientHeight = 532
ClientHeight = 537
ClientWidth = 734
KeyPreview = True
Menu = MainMenu
@ -201,8 +201,8 @@ object Form1: TForm1
end
object StatusBar: TStatusBar
Left = 0
Height = 21
Top = 511
Height = 23
Top = 514
Width = 734
Panels = <
item
@ -220,7 +220,7 @@ object Form1: TForm1
object PanelMemo: TPanel
Left = 0
Height = 154
Top = 357
Top = 360
Width = 734
Align = alBottom
ClientHeight = 154
@ -240,19 +240,19 @@ object Form1: TForm1
Cursor = crVSplit
Left = 0
Height = 5
Top = 352
Top = 355
Width = 734
Align = alBottom
ResizeAnchor = akBottom
end
object ScriptPanel: TPanel
Left = 0
Height = 328
Height = 331
Top = 24
Width = 734
Align = alClient
BevelOuter = bvNone
ClientHeight = 328
ClientHeight = 331
ClientWidth = 734
DockSite = True
TabOrder = 4
@ -260,7 +260,7 @@ object Form1: TForm1
OnDockOver = ScriptPanelDockOver
object PageControl1: TPageControl
Left = 155
Height = 293
Height = 296
Top = 0
Width = 579
Align = alClient
@ -279,7 +279,7 @@ object Form1: TForm1
object SearchPanel: TPanel
Left = 0
Height = 35
Top = 293
Top = 296
Width = 734
Align = alBottom
BevelOuter = bvSpace
@ -375,7 +375,7 @@ object Form1: TForm1
end
object LabeledEditSearch: TLabeledEdit
Left = 104
Height = 27
Height = 21
Top = 6
Width = 174
EditLabel.AnchorSideLeft.Control = LabeledEditSearch
@ -383,10 +383,10 @@ object Form1: TForm1
EditLabel.AnchorSideTop.Side = asrCenter
EditLabel.AnchorSideRight.Control = LabeledEditSearch
EditLabel.AnchorSideBottom.Control = LabeledEditSearch
EditLabel.Left = 65
EditLabel.Height = 18
EditLabel.Top = 10
EditLabel.Width = 36
EditLabel.Left = 73
EditLabel.Height = 14
EditLabel.Top = 9
EditLabel.Width = 28
EditLabel.Caption = 'Find: '
EditLabel.ParentColor = False
LabelPosition = lpLeft
@ -399,9 +399,9 @@ object Form1: TForm1
end
object CheckBoxMatchCase: TCheckBox
Left = 320
Height = 22
Height = 17
Top = 7
Width = 98
Width = 72
Caption = 'Match case'
OnClick = CheckBoxMatchCaseClick
TabOrder = 1
@ -409,39 +409,35 @@ object Form1: TForm1
end
object SplitterFunctionList: TSplitter
Left = 150
Height = 293
Height = 296
Top = 0
Width = 5
OnCanResize = SplitterFunctionListCanResize
Visible = False
end
inline frmFunctionList: TFunctionListFrame
Height = 293
Height = 296
Width = 150
ClientHeight = 293
ClientHeight = 296
ClientWidth = 150
OnEndDock = nil
TabOrder = 3
inherited FunctionList: TTreeView
Height = 244
Top = 22
Height = 257
Width = 150
DefaultItemHeight = 19
OnChange = FunctionListChange
OnDeletion = nil
OnEnter = FunctionListEnter
OnExit = FunctionListExit
end
inherited editSearchList: TEdit
Height = 27
Top = 266
Top = 275
Width = 150
OnExit = editSearchListExit
OnKeyDown = editSearchListKeyDown
OnKeyPress = editSearchListKeyPress
end
inherited FunctionListLabel: TLabel
Height = 18
Width = 146
end
end
@ -2739,19 +2735,16 @@ object Form1: TForm1
Caption = 'Cu&t'
ImageIndex = 3
OnExecute = ActionCutExecute
ShortCut = 16472
end
object ActionCopy: TAction
Caption = '&Copy'
ImageIndex = 22
OnExecute = ActionCopyExecute
ShortCut = 16451
end
object ActionPaste: TAction
Caption = '&Paste'
ImageIndex = 11
OnExecute = ActionPasteExecute
ShortCut = 16470
end
object ActionDelete: TAction
Caption = '&Delete'

File diff suppressed because it is too large Load Diff

View File

@ -981,7 +981,12 @@ begin
if CurrScript.SynEdit.Focused or ScriptPopup.HandleAllocated then
CurrScript.SynEdit.PasteFromClipboard
else if Memo1.Focused then
Memo1.PasteFromClipboard;
Memo1.PasteFromClipboard
else if LabeledEditSearch.Focused then
LabeledEditSearch.PasteFromClipboard
else if frmFunctionList.editSearchList.Focused then
frmFunctionList.editSearchList.PasteFromClipboard;
end;
procedure TForm1.ActionPauseExecute(Sender: TObject);
@ -1438,6 +1443,7 @@ var
Methods : TExpMethodArr;
LastSection : string;
Sections : TStringList;
Nodes : array of TTreeNode;
i : integer;
Index : integer;
TempNode : TTreeNode;
@ -1459,11 +1465,13 @@ begin
LastSection := Methods[i].Section;
Index := Sections.IndexOf(LastSection);
if Index <> -1 then
TempNode := Tree.Items.Item[index]
TempNode := Nodes[index]
else
begin
TempNode := Tree.Items.Add(nil,LastSection);
Sections.Add(LastSection);
setlength(nodes,length(nodes)+1);
nodes[high(nodes)] := tempNode;
end;
end;
Temp2Node := Tree.Items.AddChild(Tempnode,GetMethodName(Methods[i].FuncDecl,false));

View File

@ -20,42 +20,42 @@
Bitmap.inc for the Mufasa Macro Library
}
function CreateBitmapString(bmp : integer) : string; ps_decl;
function CreateBitmapString(bmp : integer) : string; extdecl;
begin;
result := CurrThread.Client.MBitmaps[bmp].ToString;
end;
function GetMufasaBitmap(bmp : integer): TMufasaBitmap; ps_decl;
function GetMufasaBitmap(bmp : integer): TMufasaBitmap; extdecl;
begin;
result := CurrThread.Client.MBitmaps[bmp];
end;
function CreateBitmap(w,h : integer):integer; ps_decl;
function CreateBitmap(w,h : integer):integer; extdecl;
begin
result := CurrThread.Client.MBitmaps.CreateBMP(w,h);
end;
procedure FreeBitmap(Number : integer); ps_decl;
procedure FreeBitmap(Number : integer); extdecl;
begin
CurrThread.Client.MBitmaps.FreeBMP(Number);
end;
procedure SaveBitmap(Bmp : integer; path : string); ps_decl;
procedure SaveBitmap(Bmp : integer; path : string); extdecl;
begin;
CurrThread.Client.MBitmaps[Bmp].SaveToFile(Path);
end;
function BitmapFromString(Width,height : integer; Data : string) : integer; ps_decl;
function BitmapFromString(Width,height : integer; Data : string) : integer; extdecl;
begin;
Result := CurrThread.Client.MBitmaps.CreateBMPFromString(Width,Height,Data);
end;
function LoadBitmap(Path : String) : integer; ps_decl;
function LoadBitmap(Path : String) : integer; extdecl;
begin;
Result := CurrThread.Client.MBitmaps.CreateBMPFromFile(Path);
end;
procedure SetBitmapSize(Bmp,NewW,NewH : integer); ps_decl;
procedure SetBitmapSize(Bmp,NewW,NewH : integer); extdecl;
begin;
if (NewW>=0) and (NewH >=0) then
CurrThread.Client.MBitmaps[Bmp].SetSize(NewW,NewH)
@ -63,7 +63,7 @@ begin;
raise exception.createfmt('Wrong Width or Height in SetBitmapSize: (%d,%d)',[NewW,NewH]);
end;
procedure StretchBitmapResize(Bmp,NewW,NewH : integer); ps_decl;
procedure StretchBitmapResize(Bmp,NewW,NewH : integer); extdecl;
begin;
if (NewW>=0) and (NewH >=0) then
CurrThread.Client.MBitmaps[Bmp].StretchResize(NewW,NewH)
@ -71,7 +71,7 @@ begin;
raise exception.createfmt('Wrong Width or Height in ScretchResize: (%d,%d)',[NewW,NewH]);
end;
procedure GetBitmapSize(Bmp : integer; out BmpW,BmpH : integer); ps_decl;
procedure GetBitmapSize(Bmp : integer; out BmpW,BmpH : integer); extdecl;
begin;
With CurrThread.Client.MBitmaps[bmp] do
begin;
@ -80,129 +80,129 @@ begin;
end;
end;
procedure SetBitmapName(Bmp : integer; name : string); ps_decl;
procedure SetBitmapName(Bmp : integer; name : string); extdecl;
begin;
CurrThread.Client.MBitmaps[Bmp].BmpName:= name;
end;
function CreateMirroredBitmap(Bmp : integer) : integer; ps_decl;
function CreateMirroredBitmap(Bmp : integer) : integer; extdecl;
begin;
Result := CurrThread.Client.MBitmaps.CreateMirroredBitmap(Bmp, MirrorWidth);
end;
function CreateMirroredBitmapEx(Bmp : integer; MirrorStyle : TBmpMirrorStyle) : integer; ps_decl;
function CreateMirroredBitmapEx(Bmp : integer; MirrorStyle : TBmpMirrorStyle) : integer; extdecl;
begin;
Result := CurrThread.Client.MBitmaps.CreateMirroredBitmap(Bmp,MirrorStyle);
end;
function FastGetPixel(bmp,x,y : integer) : LongWord; ps_decl;
function FastGetPixel(bmp,x,y : integer) : LongWord; extdecl;
begin;
Result := CurrThread.Client.MBitmaps[Bmp].FastGetPixel(x,y);
end;
function FastGetPixels(bmp : integer; TPA : TPointArray) : TIntegerArray; ps_decl;
function FastGetPixels(bmp : integer; TPA : TPointArray) : TIntegerArray; extdecl;
begin;
result := CurrThread.Client.MBitmaps[Bmp].FastGetPixels(TPA);
end;
procedure FastSetPixel(Bmp,x,y : integer; Color : TColor); ps_decl;
procedure FastSetPixel(Bmp,x,y : integer; Color : TColor); extdecl;
begin
CurrThread.Client.MBitmaps[bmp].FastSetPixel(x,y,color);
end;
procedure FastSetPixels(Bmp : integer; TPA : TPointArray; Colors : TIntegerArray); ps_decl;
procedure FastSetPixels(Bmp : integer; TPA : TPointArray; Colors : TIntegerArray); extdecl;
begin;
CurrThread.Client.MBitmaps[Bmp].FastSetPixels(TPA,Colors);
end;
procedure DrawTPABitmap(bitmap : integer; TPA : TPointArray; Color : integer); ps_decl;
procedure DrawTPABitmap(bitmap : integer; TPA : TPointArray; Color : integer); extdecl;
begin
CurrThread.Client.MBitmaps[Bitmap].DrawTPA(TPA,Color);
end;
procedure DrawATPABitmap(bitmap : integer; ATPA : T2DPointArray); ps_decl;
procedure DrawATPABitmap(bitmap : integer; ATPA : T2DPointArray); extdecl;
begin
CurrThread.Client.MBitmaps[bitmap].DrawATPA(ATPA);
end;
procedure DrawATPABitmapEx(bitmap : integer; ATPA : T2DPointArray; Colors : TIntegerArray); ps_decl;
procedure DrawATPABitmapEx(bitmap : integer; ATPA : T2DPointArray; Colors : TIntegerArray); extdecl;
begin
CurrThread.Client.MBitmaps[bitmap].DrawATPA(ATPA,Colors);
end;
procedure FastDrawClear(bmp : integer; Color : TColor); ps_decl;
procedure FastDrawClear(bmp : integer; Color : TColor); extdecl;
begin;
CurrThread.Client.MBitmaps[bmp].FastDrawClear(Color);
end;
procedure FastDrawTransparent(x, y: Integer; SourceBitmap, TargetBitmap: Integer); ps_decl;
procedure FastDrawTransparent(x, y: Integer; SourceBitmap, TargetBitmap: Integer); extdecl;
begin;
CurrThread.Client.MBitmaps[SourceBitmap].FastDrawTransparent(x,y,CurrThread.Client.MBitmaps[TargetBitmap]);
end;
procedure SetTransparentColor(Bmp : integer; Color : TColor); ps_decl;
procedure SetTransparentColor(Bmp : integer; Color : TColor); extdecl;
begin
CurrThread.Client.MBitmaps[Bmp].SetTransparentColor(Color);
end;
function GetTransparentColor(Bmp : integer) : TColor; ps_decl;
function GetTransparentColor(Bmp : integer) : TColor; extdecl;
begin;
Result := CurrThread.Client.MBitmaps[bmp].GetTransparentColor;
end;
procedure FastReplaceColor(bmp: Integer; OldColor, NewColor: TColor); ps_decl;
procedure FastReplaceColor(bmp: Integer; OldColor, NewColor: TColor); extdecl;
begin
CurrThread.Client.MBitmaps[Bmp].FastReplaceColor(OldColor,NewColor);
end;
procedure ps_CopyClientToBitmap(bmp, xs, ys, xe, ye: Integer); ps_decl;
procedure ps_CopyClientToBitmap(bmp, xs, ys, xe, ye: Integer); extdecl;
begin
CurrThread.Client.MBitmaps.GetBMP(bmp).CopyClientToBitmap(CurrThread.Client.IOManager, True, xs, ys, xe, ye);
end;
function BitmapFromClient(const xs, ys, xe, ye: Integer): Integer; ps_decl;
function BitmapFromClient(const xs, ys, xe, ye: Integer): Integer; extdecl;
begin;
result := CurrThread.Client.MBitmaps.CreateBMP(0,0);
CurrThread.Client.MBitmaps[result].CopyClientToBitmap(CurrThread.Client.IOManager,True,xs,ys,xe,ye);
end;
function FindBitmap(Bitmap: integer; out x, y: Integer): Boolean; ps_decl;
function FindBitmap(Bitmap: integer; out x, y: Integer): Boolean; extdecl;
begin;
with CurrThread.Client do
result := MFinder.FindBitmap( MBitmaps[bitmap],x,y);
end;
function FindBitmapIn(bitmap: integer; out x, y: Integer; xs, ys, xe, ye: Integer): Boolean; ps_decl;
function FindBitmapIn(bitmap: integer; out x, y: Integer; xs, ys, xe, ye: Integer): Boolean; extdecl;
begin;
with CurrThread.Client do
result := MFinder.FindBitmapIn( MBitmaps[bitmap],x,y,xs,ys,xe,ye);
end;
function FindBitmapToleranceIn(bitmap: integer; out x, y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer): Boolean; ps_decl;
function FindBitmapToleranceIn(bitmap: integer; out x, y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer): Boolean; extdecl;
begin;
with CurrThread.Client do
result := MFinder.FindBitmapToleranceIn( MBitmaps[bitmap],x,y,xs,ys,xe,ye,tolerance);
end;
function FindBitmapSpiral(bitmap: Integer; var x, y: Integer; xs, ys, xe, ye: Integer): Boolean; ps_decl;
function FindBitmapSpiral(bitmap: Integer; var x, y: Integer; xs, ys, xe, ye: Integer): Boolean; extdecl;
begin;
with CurrThread.Client do
result := MFinder.FindBitmapSpiral(Mbitmaps[bitmap],x,y,xs,ys,xe,ye);
end;
function FindBitmapsSpiralTolerance(bitmap: integer; x, y: Integer; out Points : TPointArray; xs, ys, xe, ye,tolerance: Integer): Boolean; ps_decl;
function FindBitmapsSpiralTolerance(bitmap: integer; x, y: Integer; out Points : TPointArray; xs, ys, xe, ye,tolerance: Integer): Boolean; extdecl;
begin;
with CurrThread.Client do
result := MFinder.FindBitmapsSpiralTolerance(MBitmaps[bitmap],x,y,points,xs,ys,xe,ye,tolerance);
end;
function FindBitmapSpiralTolerance(bitmap: integer; var x, y: Integer; xs, ys, xe, ye,tolerance : integer): Boolean; ps_decl;
function FindBitmapSpiralTolerance(bitmap: integer; var x, y: Integer; xs, ys, xe, ye,tolerance : integer): Boolean; extdecl;
begin;
with CurrThread.Client do
result := MFinder.FindBitmapSpiralTolerance(MBitmaps[bitmap],x,y,xs,ys,xe,ye,tolerance);
end;
function RotateBitmap(bitmap: Integer; angle: Extended): Integer; ps_decl;
function RotateBitmap(bitmap: Integer; angle: Extended): Integer; extdecl;
begin;
with CurrThread.Client.MBitmaps do
begin;
@ -211,7 +211,7 @@ begin;
end;
end;
function Desaturate(Bitmap : integer) : integer; ps_decl;
function Desaturate(Bitmap : integer) : integer; extdecl;
begin;
with CurrThread.Client.MBitmaps do
begin;
@ -219,15 +219,15 @@ begin;
Bmp[Bitmap].Desaturate(Bmp[result]);
end;
end;
procedure InvertBitmap(Bitmap : integer); ps_decl;
procedure InvertBitmap(Bitmap : integer); extdecl;
begin;
CurrThread.Client.MBitmaps[Bitmap].Invert;
end;
function CopyBitmap(Bitmap : integer) : integer; ps_decl;
function CopyBitmap(Bitmap : integer) : integer; extdecl;
begin;
result := Currthread.Client.MBitmaps.CopyBMP(bitmap);
end;
function GreyScaleBitmap(Bitmap : integer) : integer; ps_decl;
function GreyScaleBitmap(Bitmap : integer) : integer; extdecl;
begin;
with CurrThread.Client.MBitmaps do
begin;
@ -235,7 +235,7 @@ begin;
Bmp[Bitmap].GreyScale(Bmp[result]);
end;
end;
function BrightnessBitmap(Bitmap,br : integer) : integer; ps_decl;
function BrightnessBitmap(Bitmap,br : integer) : integer; extdecl;
begin;
with CurrThread.Client.MBitmaps do
begin;
@ -243,7 +243,7 @@ begin;
Bmp[Bitmap].Brightness(Bmp[result],br);
end;
end;
function ContrastBitmap(bitmap : integer; co : extended) : integer; ps_decl;
function ContrastBitmap(bitmap : integer; co : extended) : integer; extdecl;
begin;
with CurrThread.Client.MBitmaps do
begin;
@ -252,7 +252,7 @@ begin;
end;
end;
function PosterizeBitmap(Bitmap : integer; po : integer) : integer; ps_decl;
function PosterizeBitmap(Bitmap : integer; po : integer) : integer; extdecl;
begin;
with CurrThread.Client.MBitmaps do
begin
@ -260,16 +260,16 @@ begin;
Bmp[bitmap].Posterize(Bmp[result],po);
end;
end;
function CreateMaskFromBitmap(Bitmap : integer) : TMask; ps_decl;
function CreateMaskFromBitmap(Bitmap : integer) : TMask; extdecl;
begin;
result := CurrThread.Client.MBitmaps[Bitmap].CreateTMask;
end;
function FindMaskTolerance(mask: TMask; out x, y: Integer; xs,ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean; ps_decl;
function FindMaskTolerance(mask: TMask; out x, y: Integer; xs,ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean; extdecl;
begin;
result := CurrThread.Client.MFinder.FindMaskTolerance(Mask,x,y,xs,ys,xe,ye,tolerance,contourtolerance);
end;
function FindBitmapMaskTolerance(mask: Integer; out x, y: Integer; xs, ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean; ps_decl;
function FindBitmapMaskTolerance(mask: Integer; out x, y: Integer; xs, ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean; extdecl;
begin;
psWriteln('Better be using FindMaskTolerance in combination with CreateMaskFromBitmap, more efficient.');
with CurrThread.Client do
@ -278,7 +278,7 @@ end;
function FindDeformedBitmapToleranceIn(bitmap: integer; out x,
y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer; Range: Integer;
AllowPartialAccuracy: Boolean; out accuracy: Extended): Boolean; ps_decl;
AllowPartialAccuracy: Boolean; out accuracy: Extended): Boolean; extdecl;
begin;
result := CurrThread.Client.MFinder.FindDeformedBitmapToleranceIn(CurrThread.Client.MBitmaps[Bitmap],x,y,xs,ys,xe,ye,tolerance,range,AllowPartialAccuracy,accuracy);
end;

View File

@ -21,99 +21,104 @@
Colour.inc for the Mufasa Macro Library
}
function GetColor(x,y : integer) : TColor; ps_decl;
function GetColor(x,y : integer) : TColor; extdecl;
begin;
Result := CurrThread.Client.IOManager.GetColor(x,y);
end;
procedure GetColorsWrap(Coords : TPointArray; var Colors: TIntegerArray); ps_decl;
procedure GetColorsWrap(Coords : TPointArray; var Colors: TIntegerArray); extdecl;
begin
Colors := CurrThread.Client.MFinder.GetColors(coords);
end;
function GetColors(Coords : TPointArray) : TIntegerArray; ps_decl;
function GetColors(Coords : TPointArray) : TIntegerArray; extdecl;
begin
result := CurrThread.Client.MFinder.GetColors(coords);
end;
function findcolor(out x, y: integer; color, x1, y1, x2, y2: integer): boolean; ps_decl;
function findcolor(out x, y: integer; color, x1, y1, x2, y2: integer): boolean; extdecl;
begin
Result := CurrThread.Client.MFinder.FindColor(x, y, color, x1, y1, x2, y2);
end;
function findcolortoleranceOptimised(out x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean; ps_decl;
function findcolortoleranceOptimised(out x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean; extdecl;
begin
Result := CurrThread.Client.MFinder.FindColorToleranceOptimised(x, y, color, x1, y1, x2, y2, tol);
end;
function findcolortolerance(out x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean; ps_decl;
function findcolortolerance(out x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean; extdecl;
begin
Result := CurrThread.Client.MFinder.FindColorTolerance(x, y, color, x1, y1, x2, y2, tol);
end;
function FindColors(out TPA: TPointArray; Color, x1, y1, x2, y2: Integer): Boolean; ps_decl;
function FindColors(out TPA: TPointArray; Color, x1, y1, x2, y2: Integer): Boolean; extdecl;
begin
Result := CurrThread.Client.MFinder.FindColors(TPA, color, x1, y1, x2, y2);
end;
procedure SetColorToleranceSpeed(cts: Integer); ps_decl;
procedure SetColorToleranceSpeed(cts: Integer); extdecl;
begin
CurrThread.Client.MFinder.SetToleranceSpeed(cts);
end;
function GetToleranceSpeed: Integer; ps_decl;
function GetToleranceSpeed: Integer; extdecl;
begin
CurrThread.Client.MFinder.GetToleranceSpeed;
end;
procedure SetToleranceSpeed2Modifiers(nHue, nSat: Extended); ps_decl;
procedure SetToleranceSpeed2Modifiers(nHue, nSat: Extended); extdecl;
begin
CurrThread.Client.MFinder.SetToleranceSpeed2Modifiers(nHue, nSat);
end;
procedure GetToleranceSpeed2Modifiers(out hMod, sMod: Extended); ps_decl;
procedure GetToleranceSpeed2Modifiers(out hMod, sMod: Extended); extdecl;
begin
CurrThread.Client.MFinder.GetToleranceSpeed2Modifiers(hMod, sMod);
end;
function SimilarColors(Col1,Col2,Tol : integer) : boolean; ps_decl;
function SimilarColors(Col1,Col2,Tol : integer) : boolean; extdecl;
begin;
Result := CurrThread.Client.MFinder.SimilarColors(Col1,Col2,Tol);
end;
function CountColor(Color, xs, ys, xe, ye: Integer): Integer; ps_decl;
function CountColor(Color, xs, ys, xe, ye: Integer): Integer; extdecl;
begin;
result := CurrThread.Client.MFinder.CountColor(color,xs,ys,xe,ye);
end;
function CountColorTolerance(Color, xs, ys, xe, ye, Tolerance: Integer): Integer; ps_decl;
function CountColorTolerance(Color, xs, ys, xe, ye, Tolerance: Integer): Integer; extdecl;
begin;
result := CurrThread.Client.MFinder.CountColorTolerance(color,xs,ys,xe,ye,tolerance);
end;
function FindColorsToleranceOptimised(out Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean; ps_decl;
function FindColorsToleranceOptimised(out Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean; extdecl;
begin;
result := CurrThread.Client.MFinder.FindColorsToleranceOptimised(points,color,xs,ys,xe,ye,tolerance);
end;
function FindColorsTolerance(out Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean; ps_decl;
function FindColorsTolerance(out Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean; extdecl;
begin;
result := CurrThread.Client.MFinder.FindColorsTolerance(points,color,xs,ys,xe,ye,tolerance);
end;
function FindColorSpiral(var x, y: Integer; color, xs, ys, xe, ye: Integer): Boolean; ps_decl;
function FindColorSpiral(var x, y: Integer; color, xs, ys, xe, ye: Integer): Boolean; extdecl;
begin;
result := CurrThread.Client.MFinder.FindColorSpiral(x,y,color,xs,ys,xe,ye);
end;
function FindColorsSpiralTolerance(x, y: Integer; out Points: TPointArray; color, xs, ys, xe, ye: Integer; Tolerance: Integer) : boolean; ps_decl;
function FindColorSpiralTolerance(var x, y: Integer; color, xs, ys, xe, ye,Tol: Integer): Boolean;
begin
result := CurrThread.Client.MFinder.FindColorSpiralTolerance(x,y,color,xs,ys,xe,ye,tol);
end;
function FindColorsSpiralTolerance(x, y: Integer; out Points: TPointArray; color, xs, ys, xe, ye: Integer; Tolerance: Integer) : boolean; extdecl;
begin;
result := CurrThread.Client.MFinder.FindColorsSpiralTolerance(x,y,Points,color,xs,ys,xe,ye,tolerance);
end;
function FindColoredArea(var x, y: Integer; color, xs, ys, xe, ye: Integer; MinArea: Integer): Boolean; ps_decl;
function FindColoredArea(var x, y: Integer; color, xs, ys, xe, ye: Integer; MinArea: Integer): Boolean; extdecl;
begin;
result := CurrThread.Client.MFinder.FindColoredArea(x,y,color,xs,ys,xe,ye,minarea);
end;
function FindColoredAreaTolerance(var x, y: Integer; Color, xs, ys, xe, ye, MinArea, tol: Integer): Boolean; ps_decl;
function FindColoredAreaTolerance(var x, y: Integer; Color, xs, ys, xe, ye, MinArea, tol: Integer): Boolean; extdecl;
begin;
result := CurrThread.Client.MFinder.FindColoredAreaTolerance(x,y,color,xs,ys,xe,ye,minarea,tol);
end;

View File

@ -21,7 +21,7 @@
DTM.inc for the Mufasa Macro Library
}
function ps_FindDTM(DTM: Integer; out x, y: Integer; x1, y1, x2, y2: Integer): Boolean; ps_decl;
function ps_FindDTM(DTM: Integer; out x, y: Integer; x1, y1, x2, y2: Integer): Boolean; extdecl;
var
temp: pDTM;
begin
@ -35,7 +35,7 @@ begin
end;
end;
function ps_FindDTMs(DTM: Integer; out p: TPointArray; x1, y1, x2, y2: Integer): Boolean; ps_decl;
function ps_FindDTMs(DTM: Integer; out p: TPointArray; x1, y1, x2, y2: Integer): Boolean; extdecl;
var
temp: pDTM;
begin
@ -50,7 +50,7 @@ end;
function ps_FindDTMRotated(DTM: Integer; out x, y: Integer; x1, y1, x2, y2:
Integer; sAngle, eAngle, aStep: Extended;
out aFound: Extended): Boolean; ps_decl;
out aFound: Extended): Boolean; extdecl;
var
temp: pDTM;
begin
@ -64,7 +64,7 @@ begin
end;
end;
function ps_FindDTMsRotated(DTM: Integer; out Points: TPointArray; x1, y1, x2, y2: Integer; sAngle, eAngle, aStep: Extended; out aFound: T2DExtendedArray): Boolean; ps_decl;
function ps_FindDTMsRotated(DTM: Integer; out Points: TPointArray; x1, y1, x2, y2: Integer; sAngle, eAngle, aStep: Extended; out aFound: T2DExtendedArray): Boolean; extdecl;
var
temp: pDTM;
begin
@ -75,7 +75,7 @@ begin
Result := False;
end;
{function ps_FindDTMsRotated(DTM: Integer; out Points: TPointArray; x1, ps_decl;
{function ps_FindDTMsRotated(DTM: Integer; out Points: TPointArray; x1, extdecl;
y1, x2, y2: Integer; sAngle, eAngle,
aStep: Extended; out aFound: T2DExtendedArray)
: Boolean;
@ -84,7 +84,7 @@ begin
sAngle, eAngle, aStep, aFound);
end; }
function ps_DTMFromString(DTMString: String): Integer; ps_decl;
function ps_DTMFromString(DTMString: String): Integer; extdecl;
var
dtm: pDTM;
begin
@ -95,27 +95,27 @@ begin
end;
end;
procedure ps_FreeDTM(DTM: Integer); ps_decl;
procedure ps_FreeDTM(DTM: Integer); extdecl;
begin
CurrThread.Client.MDTM.FreeDTM(DTM);
end;
function ps_GetDTM(index: Integer; out dtm: pDTM): Boolean; ps_decl;
function ps_GetDTM(index: Integer; out dtm: pDTM): Boolean; extdecl;
begin
Result := CurrThread.Client.MDTM.GetDTM(index, dtm);
end;
function ps_AddDTM(d: TDTM): Integer; ps_decl;
function ps_AddDTM(d: TDTM): Integer; extdecl;
begin
Result := CurrThread.Client.MDTM.AddDTM(d);
end;
function ps_AddpDTM(d: pDTM): Integer; ps_decl;
function ps_AddpDTM(d: pDTM): Integer; extdecl;
begin
Result := CurrThread.Client.MDTM.AddpDTM(d);
end;
Procedure ps_PrintpDTM(aDTM : pDTM);ps_decl;
Procedure ps_PrintpDTM(aDTM : pDTM);extdecl;
begin
PrintpDTM(aDTM);
end;

View File

@ -21,50 +21,50 @@
File.inc for the Mufasa Macro Library
}
function ps_CreateFile(Path: string): Integer; ps_decl;
function ps_CreateFile(Path: string): Integer; extdecl;
begin
Result := CurrThread.Client.MFiles.CreateFile(Path);
end;
function ps_OpenFile(Path: string; Shared: Boolean): Integer; ps_decl;
function ps_OpenFile(Path: string; Shared: Boolean): Integer; extdecl;
begin
Result := CurrThread.Client.MFiles.OpenFile(Path, Shared);
end;
function ps_RewriteFile(Path: string; Shared: Boolean): Integer; ps_decl;
function ps_RewriteFile(Path: string; Shared: Boolean): Integer; extdecl;
begin
Result := CurrThread.Client.MFiles.RewriteFile(Path, Shared);
end;
procedure ps_CloseFile(FileNum: Integer); ps_decl;
procedure ps_CloseFile(FileNum: Integer); extdecl;
begin
CurrThread.Client.MFiles.CloseFile(FileNum);
end;
function ps_EndOfFile(FileNum: Integer): Boolean; ps_decl;
function ps_EndOfFile(FileNum: Integer): Boolean; extdecl;
begin
Result := CurrThread.Client.MFiles.EndOfFile(FileNum);
end;
function ps_FileSize(FileNum: Integer): LongInt; ps_decl;
function ps_FileSize(FileNum: Integer): LongInt; extdecl;
begin
Result := CurrThread.Client.MFiles.FileSizeMuf(FileNum);
end;
function ps_ReadFileString(FileNum: Integer; out s: string; x: Integer): Boolean; ps_decl;
function ps_ReadFileString(FileNum: Integer; out s: string; x: Integer): Boolean; extdecl;
begin
Result := CurrThread.Client.MFiles.ReadFileString(FileNum, s, x);
end;
function ps_WriteFileString(FileNum: Integer; s: string): Boolean; ps_decl;
function ps_WriteFileString(FileNum: Integer; s: string): Boolean; extdecl;
begin
Result := CurrThread.Client.MFiles.WriteFileString(FileNum, s);
end;
function ps_SetFileCharPointer(FileNum, cChars, Origin: Integer): Integer; ps_decl;
function ps_SetFileCharPointer(FileNum, cChars, Origin: Integer): Integer; extdecl;
begin
Result := CurrThread.Client.MFiles.SetFileCharPointer(Filenum, cChars, Origin);
end;
function ps_FilePointerPos(FileNum: Integer): Integer; ps_decl;
function ps_FilePointerPos(FileNum: Integer): Integer; extdecl;
begin
Result := CurrThread.Client.MFiles.FilePointerPos(FileNum);
end;
@ -72,7 +72,37 @@ function ps_FileExists ( const FileName : string ) : Boolean;
begin
result := FileExists(FileName);
end;
function ps_DirectoryExists ( const DirectoryName : string ) : Boolean; ps_decl;
function ps_DirectoryExists ( const DirectoryName : string ) : Boolean; extdecl;
begin
result := DirectoryExists(DirectoryName);
end;
procedure ps_WriteINI(Section, KeyName, NewString, FileName: string);extdecl;
var
tempini : TIniFile;
begin;
tempini := TIniFile.Create(FileName,True);
tempini.WriteString(Section,keyname,newstring);
tempini.free;
end;
function ps_ReadINI(Section, KeyName, FileName: string): string;extdecl;
var
tempini : TIniFile;
begin;
tempini := TIniFile.Create(FileName,True);
Result := tempini.ReadString(section,keyname,'');
tempini.free;
end;
procedure ps_DeleteINI(Section, KeyName, FileName: string); extdecl;
var
tempini : TIniFile;
begin;
tempini := TIniFile.Create(FileName,True);
if KeyName = '' then
tempini.EraseSection(Section)
else
Tempini.DeleteKey(section,keyname);
tempini.free;
end;

View File

@ -1,4 +1,4 @@
function ps_GetPage(S: String): String; ps_decl;
function ps_GetPage(S: String): String; extdecl;
begin
result := GetPage(S);
end;

View File

@ -21,32 +21,32 @@
Keyboard.inc for the Mufasa Macro Library
}
procedure KeyDown(key: Word); ps_decl;
procedure KeyDown(key: Word); extdecl;
begin
CurrThread.Client.IOManager.KeyDown(key);
end;
procedure KeyUp(key: Word); ps_decl;
procedure KeyUp(key: Word); extdecl;
begin
CurrThread.Client.IOManager.KeyUp(key);
end;
procedure SendKeys(s: string); ps_decl;
procedure SendKeys(s: string); extdecl;
begin
CurrThread.Client.IOManager.SendText(s);
end;
procedure PressKey(key: Word); ps_decl;
procedure PressKey(key: Word); extdecl;
begin
CurrThread.Client.IOManager.PressKey(key);
end;
function isKeyDown(key: Word): boolean; ps_decl;
function isKeyDown(key: Word): boolean; extdecl;
begin
Result := CurrThread.Client.IOManager.isKeyDown(key);
end;
function GetKeyCode(c :char) : integer; ps_decl;
function GetKeyCode(c :char) : integer; extdecl;
begin
result := CurrThread.Client.IOManager.GetKeyCode(c);
end;

View File

@ -21,71 +21,81 @@
Math.inc for the Mufasa Macro Library
}
function ps_iAbs(a : integer) : integer;ps_decl;
function ps_iAbs(a : integer) : integer;extdecl;
begin
result := abs(a);
end;
function ps_ceil(e : extended) : integer;ps_decl;
function ps_ceil(e : extended) : integer;extdecl;
begin
result := ceil(e);
end;
function ps_pow(base,exponent : extended) : extended; ps_decl;
function ps_pow(base,exponent : extended) : extended; extdecl;
begin
result := power(base,exponent);
end;
function ps_Max(a,b : integer) : integer; ps_decl;
function ps_Max(a,b : integer) : integer; extdecl;
begin
result := max(a,b);
end;
function ps_Min(a, b: Integer): Integer; ps_decl;
function ps_Min(a, b: Integer): Integer; extdecl;
begin
result := min(a,b);
end;
function ps_MinE(a, b : extended) : extended; ps_decl;
function ps_MinE(a, b : extended) : extended; extdecl;
begin
result := min(a,b);
end;
function ps_MaxE(a,b : extended) : extended; ps_decl;
function ps_MaxE(a,b : extended) : extended; extdecl;
begin
result := max(a,b);
end;
function ps_Sqr(e : extended) : extended;ps_decl;
function ps_Sqr(e : extended) : extended;extdecl;
begin
result := sqr(e);
end;
function ps_Point(x,y : integer) : TPoint;ps_decl;
function ps_Point(x,y : integer) : TPoint;extdecl;
begin
result := classes.point(x,y);
end;
function ps_Distance(x1,y1,x2,y2 : integer) : integer;ps_decl;
function ps_Distance(x1,y1,x2,y2 : integer) : integer;extdecl;
begin
Result := Round(Sqrt(Sqr(x2-x1) + Sqr(y2-y1)));
end;
function ps_Hypot(X, Y: Extended): Extended;ps_decl;
function ps_Hypot(X, Y: Extended): Extended;extdecl;
begin
result := hypot(x,y);
end;
function ps_RandomRange(const aFrom, aTo: Integer): Integer; ps_decl;
function ps_RandomRange(const aFrom, aTo: Integer): Integer; extdecl;
begin
Result:=Random(Abs(aFrom-aTo))+Min(aTo,AFrom);
end;
function ps_ArcTan2(x,y : extended) : extended;
function ps_ArcTan2(x,y : extended) : extended; extdecl;
begin
result := ArcTan2(x,y);
end;
function Factorial(number: longword): Int64; ps_decl;
procedure ps_IncEx(var x : integer; increase : integer); extdecl;
begin
x := x + increase;
end;
procedure ps_DecEx(var x : integer; Decrease : integer); extdecl;
begin
x := x - Decrease;
end;
function Factorial(number: longword): Int64; extdecl;
var
Loop : longword;
begin
@ -94,12 +104,12 @@ begin
result := result * loop;
end;
function BinCoe(a, b: LongInt): Extended; ps_decl;
function BinCoe(a, b: LongInt): Extended; extdecl;
begin
result := Factorial(a) / (factorial(b) * factorial(a-b));
end;
function FixD(Degrees : extended) : Extended; ps_decl;
function FixD(Degrees : extended) : Extended; extdecl;
begin;
Result := Degrees;
while Result < 0 do
@ -108,7 +118,7 @@ begin;
Result := Result - 360;
end;
function IntToBox(x1,y1,x2,y2 : integer) : TBox; ps_decl;
function IntToBox(x1,y1,x2,y2 : integer) : TBox; extdecl;
begin;
result.x1 := x1;
result.y1 := y1;
@ -116,12 +126,12 @@ begin;
result.y2 := y2;
end;
function IntInBox(x, y: Integer; Box: TBox): Boolean; ps_decl;
function IntInBox(x, y: Integer; Box: TBox): Boolean; extdecl;
begin;
result := (((x >= Box.x1) and(x <= Box.x2)) and ((y >= box.y1) and (y <= box.y2)));
end;
function PointToBox(PT1,PT2 : TPoint) : TBox; ps_decl;
function PointToBox(PT1,PT2 : TPoint) : TBox; extdecl;
begin;
result.x1 := PT1.x;
result.y1 := PT1.y;
@ -129,8 +139,12 @@ begin;
result.y2 := PT2.y;
end;
function PointInBox(PT : TPoint; Box: TBox): Boolean; ps_decl;
function PointInBox(PT : TPoint; Box: TBox): Boolean; extdecl;
begin;
result := (((PT.x >= Box.x1) and(PT.x <= Box.x2)) and ((PT.y>= box.y1) and (PT.y <= box.y2)));
end;
function ps_floor(e : extended) : integer; extdecl;
begin;
result := floor(e);
end;

View File

@ -25,12 +25,12 @@ const
ps_mouse_right = 0;
ps_mouse_left = 1;
ps_mouse_middle = 2;
procedure MoveMouse(x, y: integer); ps_decl;
procedure MoveMouse(x, y: integer); extdecl;
begin
CurrThread.Client.IOManager.SetMousePos(X, Y);
end;
procedure GetMousePos(out x, y: integer); ps_decl;
procedure GetMousePos(out x, y: integer); extdecl;
begin
CurrThread.Client.IOManager.GetMousePos(X, Y);
end;
@ -45,17 +45,17 @@ begin;
end;
end;
procedure HoldMouse(x, y: integer; clickType: integer); ps_decl;
procedure HoldMouse(x, y: integer; clickType: integer); extdecl;
begin
CurrThread.Client.IOManager.HoldMouse(x, y, ConvIntClickType(clickType));
end;
procedure ReleaseMouse(x, y: integer; clickType: integer); ps_decl;
procedure ReleaseMouse(x, y: integer; clickType: integer); extdecl;
begin
CurrThread.Client.IOManager.ReleaseMouse(x, y, ConvIntClickType(clickType));
end;
procedure ClickMouse(x, y: integer; clickType: integer); ps_decl;
procedure ClickMouse(x, y: integer; clickType: integer); extdecl;
begin
CurrThread.Client.IOManager.ClickMouse(x, y, ConvIntClickType(clickType));
end;

View File

@ -1,9 +1,14 @@
function rs_GetUpText: String; ps_decl;
function rs_GetUpText: String; extdecl;
begin
Result := CurrThread.Client.MOCR.GetUpTextAtEx(7, 7, true);
end;
function BitmapFromText(text, font: String): integer; ps_decl;
function rs_GetUpTextAt(x, y : integer): string; extdecl;
begin
result := CurrThread.Client.MOCR.GetUpTextAtEx(x,y,true);
end;
function BitmapFromText(text, font: String): integer; extdecl;
var
bmp: TMufasaBitmap;
begin
@ -12,12 +17,12 @@ begin
Result := CurrThread.Client.MBitmaps.AddBMP(bmp);
end;
function MaskFromText(text, font: String): TMask; ps_decl;
function MaskFromText(text, font: String): TMask; extdecl;
begin
Result := CurrThread.Client.MOCR.TextToMask(text,font);
end;
function TPAFromText(text, font: String;out w,h : integer): TPointArray; ps_decl;
function TPAFromText(text, font: String;out w,h : integer): TPointArray; extdecl;
begin
Result := CurrThread.Client.MOCR.TextToFontTPA(text, font, w, h);
end;

View File

@ -21,7 +21,7 @@
Other.inc for the Mufasa Macro Library
}
procedure psWait(t: Integer); ps_decl;
procedure psWait(t: Integer); extdecl;
{$ifdef MSWINDOWS}
begin
Sleep(t);
@ -42,13 +42,13 @@ begin
end;
{$endif}
procedure ClearDebug; ps_decl;
procedure ClearDebug; extdecl;
begin
if Assigned(CurrThread.DebugMemo) then
CurrThread.Synchronize(@CurrThread.DebugMemo.Clear);
end;
procedure SaveScreenshot(FileName: string); ps_decl;
procedure SaveScreenshot(FileName: string); extdecl;
var
w,h : integer;
bmp: TMufasaBitmap;
@ -62,35 +62,35 @@ end;
procedure DisplayDebugImgWindow(w,h : integer); ps_decl;
procedure DisplayDebugImgWindow(w,h : integer); extdecl;
begin;
CurrThread.DebugImg.DispSize^ := Classes.Point(w,h);
CurrThread.Synchronize( CurrThread.DebugImg.ShowForm);
end;
procedure DrawBitmapDebugImg(bmp : integer); ps_decl;
procedure DrawBitmapDebugImg(bmp : integer); extdecl;
begin;
CurrThread.DebugImg.ToDrawBitmap^ := CurrThread.Client.MBitmaps[bmp];
CurrThread.Synchronize(CurrThread.DebugImg.DrawBitmap);
end;
function GetDebugBitmap : integer; ps_decl;
function GetDebugBitmap : integer; extdecl;
begin;
result := CurrThread.Client.MBitmaps.CreateBMP(0,0);
CurrThread.DebugImg.GetDebugBitmap^ := CurrThread.Client.MBitmaps[result];
CurrThread.Synchronize(CurrThread.DebugImg.GetBitmap);
end;
procedure TerminateScript; ps_decl;
procedure TerminateScript; extdecl;
begin;
CurrThread.Terminate;
end;
function GetTimeRunning: LongWord; ps_decl;
function GetTimeRunning: LongWord; extdecl;
begin;
result := GetTickCount - CurrThread.StartTime;
end;
procedure ConvertTime(Time : integer; var h,m,s : integer); ps_decl;
procedure ConvertTime(Time : integer; var h,m,s : integer); extdecl;
var
x : integer;
begin;
@ -101,27 +101,27 @@ begin;
x := x mod (1000 * 60);
s := x div (1000);
end;
procedure ps_DecodeDate ( const SourceDate : TDateTime; out Year, Month, Day : Word ); ps_decl;
procedure ps_DecodeDate ( const SourceDate : TDateTime; out Year, Month, Day : Word ); extdecl;
begin
decodedate(sourcedate,year,month,day);
end;
procedure ps_DecodeTime(DateTime : TDateTime; var Hour,Min,Sec,MSec : word); ps_decl;
procedure ps_DecodeTime(DateTime : TDateTime; var Hour,Min,Sec,MSec : word); extdecl;
begin
decodetime(datetime,hour,min,sec,msec);
end;
function ps_Now : TDateTime; ps_decl;
function ps_Now : TDateTime; extdecl;
begin
result := now;
end;
function ps_Date : TDateTime; ps_decl;
function ps_Date : TDateTime; extdecl;
begin
result := date;
end;
function ps_GetTickCount : Longword; ps_decl;
function ps_GetTickCount : Longword; extdecl;
begin
result := GetTickCount;
end;
procedure HakunaMatata; ps_decl;
procedure HakunaMatata; extdecl;
begin;
OpenWebPage('http://www.youtube.com/v/ejEVczA8PLU&hl=en&fs=1&autoplay=1');
end;

View File

@ -1 +1 @@
function psFormat(const fmt : string;const args : array of const) : string; ps_decl; ps_decl; begin; Result := Format(fmt,Args); end; function Capitalize(str : string) : string; ps_decl; var i , l : integer; cap : boolean; begin; result := str; l := length(str); cap := true; for i := 1 to l do if cap and (str[i] in ['a'..'z'] + ['A'..'Z']) then begin; result[i] := UpperCase(str[i])[1]; cap := false; end else if not (str[i] in ['a'..'z'] + ['A'..'Z']) then cap := true; end; ps_decl; ps_decl; begin; result := BoolToStr(bool,true); end; ps_decl; begin; begin result := inttostr(int); end; ps_decl; begin result := floattostr(flt); end; function ps_StrToInt(value: String): Integer; ps_decl; begin result := StrToInt(value); end; function ps_StrToIntDef(value: String; default: Integer): Integer; ps_decl; begin result := StrToIntDef(value,default); end; begin; ps_decl; begin result := StrToFloat(value); end; begin; Result := Format(fmt,Args); begin result := StrToFloatDef(value,default); end; begin; begin result := StrToBool(value); end; function ps_StrToBoolDef(value: String; default: Boolean): Boolean; ps_decl; begin result := StrToBoolDef(value,default); end; function ps_Between(s1, s2, str: string): string; ps_decl; var I,J : integer; begin; Result := ''; I := pos(s1,str); if I > 0 then begin; i := i + length(s1); j := posex(s2,str,i); if j > 0 then Result := copy(str,i,j-i); end; end;
function psFormat(const fmt : string;const args : array of const) : string; Result := Format(fmt,Args); ps_decl; Result := Format(fmt,Args); ps_decl; begin; Result := Format(fmt,Args); end; function Capitalize(str : string) : string; Result := Format(fmt,Args); ps_decl; var i , l : integer; cap : boolean; begin; result := str; l := length(str); cap := true; for i := 1 to l do if cap and (str[i] in ['a'..'z'] + ['A'..'Z']) then begin; result[i] := UpperCase(str[i])[1]; cap := false; end else if not (str[i] in ['a'..'z'] + ['A'..'Z']) then cap := true; end; type StrExtr =(Numbers, Letters, Others); function ExtractFromStr( Str : string; Extract : StrExtr) : string; extdecl; var Range : set of char; i : integer; begin; case Extract of Numbers : Range := ['0'..'9']; Letters : Range := ['A'..'Z'] + ['a'..'z']; end; ps_decl; end; for i := length(str) downto 1 do if str[i] in Range then result := str[i] + result; end; function ps_BoolToStr(bool : boolean) : string; extdecl; begin; result := BoolToStr(bool,true); end; function ps_Replace(Text, FindStr, ReplaceStr: string; Flags: TReplaceFlags): string; extdecl; begin; result := StringReplace(Text,FindStr,ReplaceStr,Flags); end; function ps_IntToStr(int : integer) : string; extdecl; begin result := inttostr(int); end; begin result := floattostr(flt); end; function ps_StrToInt(value: String): Integer; extdecl; begin result := StrToInt(value); end; function ps_StrToIntDef(value: String; default: Integer): Integer; extdecl; begin result := StrToIntDef(value,default); end; begin; begin result := StrToFloat(value); end; Result := Format(fmt,Args); begin result := StrToFloatDef(value,default); end; end; begin result := StrToBool(value); end; function ps_StrToBoolDef(value: String; default: Boolean): Boolean; extdecl; begin result := StrToBoolDef(value,default); end; function ps_Between(s1, s2, str: string): string; extdecl; var I,J : integer; begin; Result := ''; I := pos(s1,str); if I > 0 then begin; i := i + length(s1); j := posex(s2,str,i); if j > 0 then Result := copy(str,i,j-i); end; end;

View File

@ -21,74 +21,74 @@
window.inc for the Mufasa Macro Library
}
procedure SetDesktopAsClient; ps_decl;
procedure SetDesktopAsClient; extdecl;
begin;
CurrThread.Client.IOManager.SetDesktop;
end;
function SetTargetArray(P: Integer; w, h: integer): integer; ps_decl;
function SetTargetArray(P: Integer; w, h: integer): integer; extdecl;
begin
result:= CurrThread.Client.IOManager.SetTarget(PRGB32(P), classes.point(w,h));
end;
function SetTargetBitmap(bitmap: Integer): integer; ps_decl;
function SetTargetBitmap(bitmap: Integer): integer; extdecl;
begin;
result:= CurrThread.Client.IOManager.SetTarget(CurrThread.Client.MBitmaps[Bitmap]);
end;
function SetEIOSTarget(name: string; args: Variant): integer; ps_decl;
function SetEIOSTarget(name: string; args: Variant): integer; extdecl;
begin
result:= CurrThread.Client.IOManager.SetTarget(name, @args);
end;
procedure SetImageTarget(idx: integer); ps_decl;
procedure SetImageTarget(idx: integer); extdecl;
begin
CurrThread.Client.IOManager.SetImageTarget(idx);
end;
procedure SetKeyMouseTarget(idx: integer); ps_decl;
procedure SetKeyMouseTarget(idx: integer); extdecl;
begin
CurrThread.Client.IOManager.SetKeyMouseTarget(idx);
end;
function GetImageTarget: integer; ps_decl;
function GetImageTarget: integer; extdecl;
begin
CurrThread.Client.IOManager.GetImageTarget(result);
end;
function GetKeyMouseTarget: integer; ps_decl;
function GetKeyMouseTarget: integer; extdecl;
begin
CurrThread.Client.IOManager.GetKeyMouseTarget(result);
end;
procedure FreeTarget(idx: integer); ps_decl;
procedure FreeTarget(idx: integer); extdecl;
begin
CurrThread.Client.IOManager.FreeTarget(idx);
end;
procedure GetClientDimensions(out w, h: integer); ps_decl;
procedure GetClientDimensions(out w, h: integer); extdecl;
begin
CurrThread.Client.IOManager.GetDimensions(w, h);
end;
function Freeze: boolean; ps_decl;
function Freeze: boolean; extdecl;
begin
CurrThread.Client.IOManager.SetFrozen(true);
result := true; //dunno what the result is supposed to mean
end;
function Unfreeze: boolean; ps_decl;
function Unfreeze: boolean; extdecl;
begin
CurrThread.Client.IOManager.SetFrozen(false);
result := true; //dunno what the result is supposed to mean
end;
procedure ActivateClient; ps_decl;
procedure ActivateClient; extdecl;
begin
CurrThread.Client.IOManager.ActivateClient;
end;
function IsTargetValid: boolean; ps_decl;
function IsTargetValid: boolean; extdecl;
begin
result:= CurrThread.Client.IOManager.TargetValid;
end;

View File

@ -26,11 +26,15 @@ Sender.Comp.AddConstantN('ScriptPath','string').SetString(CurrThread.ScriptPath)
Sender.Comp.AddConstantN('IncludePath','string').SetString(CurrThread.IncludePath);
Sender.Comp.AddConstantN('PluginPath','string').SetString(CurrThread.PluginPath);
Sender.Comp.AddConstantN('FontPath','string').SetString(CurrThread.FontPath);
Sender.Comp.AddTypeS('TReplaceFlag', '(rfReplaceAll, rfIgnoreCase)');
Sender.Comp.AddTypeS('TReplaceFlags','set of TReplaceFlag');
Sender.Comp.AddTypeS('StrExtr','(Numbers, Letters, Others);');
Sender.Comp.AddTypeS('TDateTime','Double');
Sender.Comp.AddTypeS('TIntegerArray', 'Array of LongInt');
Sender.Comp.AddTypeS('TExtendedArray','Array of extended');
Sender.Comp.AddTypeS('TBoolArray', 'Array of Boolean');
Sender.Comp.AddTypes('TBox', 'record X1,Y1,X2,Y2 : Integer; end;');
Sender.Comp.AddTypeS('TBoxArray','Array of TBox');
Sender.Comp.AddTypeS('TPointArray','Array of TPoint');
Sender.Comp.AddTypeS('T2DPointArray','Array of TPointArray');
Sender.Comp.AddTypeS('TPointArrayArray','Array of TPointArray');

View File

@ -44,6 +44,7 @@ AddFunction(@ps_addpDTM, 'function AddpDTM(d: pDTM): Integer;');
SetCurrSection('Math');
AddFunction(nil,'function Round(e:extended) : integer');
AddFunction(@ps_ceil,'function ceil(e : extended) : integer');
AddFunction(@ps_floor,'function floor(e : extended) : integer');
AddFunction(@ps_pow,'function pow(base,exponent : extended) : extended');
AddFunction(@ps_max,'function Max(a, b: Integer): Integer;');
AddFunction(@ps_min,'function Min(a, b: Integer): Integer;');
@ -53,13 +54,15 @@ AddFunction(@ps_iAbs,'function iAbs(a : integer) : integer;');
AddFunction(@ps_ArcTan2,'function ArcTan2(x,y : extended) : extended;');
AddFunction(@IntToBox,'function IntToBox(x1,y1,x2,y2 : integer) : TBox;');
AddFunction(@IntInBox,'function IntInBox(x, y: Integer; Box: TBox): Boolean;');
AddFunction(@PointToBox,'function PointToBox(PT1,PT2 : TPoint; Box: TBox): Boolean;');
AddFunction(@PointToBox,'function PointToBox(PT1,PT2 : TPoint): TBox;');
AddFunction(@PointInBox,'function PointInBox(PT : TPoint; Box: TBox): Boolean;');
AddFunction(@ps_sqr,'function Sqr(e : extended) : extended;');
AddFunction(@ps_point,'function Point(x,y:integer) : TPoint;');
AddFunction(@ps_Distance,'function Distance(x1,y1,x2,y2 : integer) : integer;');
AddFunction(@ps_hypot,'function Hypot(X, Y: Extended): Extended;');
AddFunction(@ps_RandomRange,'function RandomRange(aFrom,aTo: Integer): Integer;');
AddFunction(@ps_incex,'procedure IncEx(var x : integer; increase : integer);');
AddFunction(@ps_DecEx,'procedure DecEx(var x : integer; Decrease : integer);');
AddFunction(@BinCoe,'function BinCoe(a, b: LongInt): Extended;');
AddFunction(@FixD,'function FixD(Degrees : extended) : Extended;');
AddFunction(@InRange,'function InRange(value,min,max : integer) : boolean;');
@ -95,6 +98,9 @@ AddFunction(@ps_SetFileCharPointer, 'Function SetFileCharPointer(FileNum, cChars
AddFunction(@ps_FilePointerPos, 'function FilePointerPos(FileNum: Integer): Integer;');
AddFunction(@ps_DirectoryExists,'function DirectoryExists( const DirectoryName : string ) : Boolean;');
AddFunction(@ps_FileExists,'function FileExists ( const FileName : string ) : Boolean;');
AddFunction(@ps_WriteINI,'procedure WriteINI(Section, KeyName, NewString, FileName: string);');
AddFunction(@ps_ReadINI,'function ReadINI(Section, KeyName, FileName: string): string;');
AddFunction(@ps_DeleteINI,'procedure DeleteINI(Section, KeyName, FileName: string);');
{other}
SetCurrSection('Other');
@ -134,7 +140,9 @@ AddFunction(@ps_StrToFloat, 'function StrToFloat(value: String): Extended;');
AddFunction(@ps_StrToFloatDef, 'function StrToFloatDef(value: String; default: Extended): Extended;');
AddFunction(@ps_StrToBool, 'function StrToBool(value: String): Boolean;');
AddFunction(@ps_StrToBoolDef, 'function StrToBoolDef(value: String; default: Boolean): Boolean;');
AddFunction(@ExtractFromStr,'function ExtractFromStr( Str : string; Extract : StrExtr) : string;');
AddFunction(@ps_Replace,'function Replace(Text, FindStr, ReplaceStr: string; Flags: TReplaceFlags): string;');
AddFunction(@ps_Replace,'function ReplaceWrap(Text, FindStr, ReplaceStr: string; Flags: TReplaceFlags): string;');
{web}
SetCurrSection('Web');
AddFunction(@OpenWebPage,'procedure OpenWebPage(url : string);');
@ -173,6 +181,7 @@ AddFunction(@CountColorTolerance,'function CountColorTolerance(Color, xs, ys, xe
AddFunction(@FindColorsToleranceOptimised,'function FindColorsToleranceOptimised(out Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean;');
AddFunction(@FindColorsTolerance,'function FindColorsTolerance(out Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean;');
AddFunction(@FindColorSpiral,'function FindColorSpiral(var x, y: Integer; color, xs, ys, xe, ye: Integer): Boolean;');
AddFunction(@FindColorSpiralTolerance,'function FindColorSpiralTolerance(var x, y: Integer; color, xs, ys, xe, ye,Tol: Integer): Boolean;');
AddFunction(@FindColorsSpiralTolerance,'function FindColorsSpiralTolerance(x, y: Integer; out Points: TPointArray; color, xs, ys, xe, ye: Integer; Tolerance: Integer) : boolean;');
AddFunction(@FindColoredArea, 'function FindColoredArea(var x, y: Integer; color, xs, ys, xe, ye, MinArea: Integer): Boolean');
AddFunction(@FindColoredAreaTolerance, 'function FindColoredAreaTolerance(var x, y : Integer; color, xs, ys, xe, ye, MinArea, Tolerance : Integer): Boolean');
@ -198,6 +207,7 @@ AddFunction(@GetKeyCode,'function GetKeyCode(c : char) : integer;');
{ OCR}
SetCurrSection('OCR');
AddFunction(@rs_GetUpText, 'function rs_GetUpText: string;');
AddFunction(@rs_GetUpTextAt, 'function rs_GetUpTextAt(x, y : integer): string;');
AddFunction(@BitmapFromText, 'function BitmapFromText(text, font: String): integer;');
AddFunction(@TPAFromText, 'function TPAFromText(text, font: String;out w,h : integer): TPointArray;');
AddFunction(@MaskFromText, 'function MaskFromText(text, font: String): TMask;');

View File

@ -173,6 +173,7 @@ uses
uPSC_extctrls, //Compile-libs
uPSUtils,
fontloader,
IniFiles,//Silly INI files
uPSR_std, uPSR_controls,uPSR_classes,uPSR_graphics,uPSR_stdctrls,uPSR_forms,
uPSR_extctrls, //Runtime-libs
Graphics, //For Graphics types
@ -183,17 +184,20 @@ uses
forms,//Forms
lclintf // for GetTickCount and others.
;
{$ifdef Linux}
{$define PS_StdCall}
{$else}
//{$define PS_StdCall}
{$endif}
{$MACRO ON}
{$ifdef PS_StdCall}
{$define ps_decl := stdcall}
{$define extdecl := stdcall}
{$else}
{$define ps_decl := REGISTER}
{$define extdecl := REGISTER}
{$endif}
{Some General PS Functions here}
procedure psWriteln(str : string); stdcall;
procedure psWriteln(str : string); extdecl;
begin
if Assigned(CurrThread.DebugTo) then
CurrThread.DebugTo(str)
@ -297,7 +301,6 @@ function TMThread.ProcessDirective(DirectiveName, DirectiveArgs: string): boolea
var
plugin_idx, i: integer;
begin
writeln('Running Directive: ' + DirectiveName);
if CompareText(DirectiveName,'LOADDLL') = 0 then
begin
if DirectiveArgs <> '' then

View File

@ -62,6 +62,7 @@ type
// Possibly turn x, y into a TPoint var.
function FindColor(out x, y: Integer; Color, xs, ys, xe, ye: Integer): Boolean;
function FindColorSpiral(var x, y: Integer; color, xs, ys, xe, ye: Integer): Boolean;
function FindColorSpiralTolerance(var x, y: Integer; color, xs, ys, xe, ye,Tol: Integer): Boolean;
function FindColorTolerance(out x, y: Integer; Color, xs, ys, xe, ye, tol: Integer): Boolean;
function FindColorsTolerance(out Points: TPointArray; Color, xs, ys, xe, ye, Tol: Integer): Boolean;
function FindColorsSpiralTolerance(x, y: Integer; out Points: TPointArray; color, xs, ys, xe, ye: Integer; Tolerance: Integer) : boolean;
@ -535,6 +536,81 @@ begin
TClient(Client).IOManager.FreeReturnData;
end;
function TMFinder.FindColorSpiralTolerance(var x, y: Integer; color, xs, ys,
xe, ye, Tol: Integer): Boolean;
var
PtrData: TRetData;
RowData : TPRGB32Array;
dX, dY, clR, clG, clB,i,Hispiral: Integer;
H1, S1, L1, H2, S2, L2: Extended;
R,G,B : extended; //percentage R,G,B.. (Needed for HSL).
D : Extended; //CMax - Cmin
HueXTol, SatXTol: Extended;
CMax, CMin : extended;
label Hit;
begin
Result := false;
// checks for valid xs,ys,xe,ye? (may involve GetDimensions)
DefaultOperations(xs,ys,xe,ye);
// calculate delta x and y
dX := xe - xs;
dY := ye - ys;
//next, convert the color to r,g,b
ColorToRGB(Color, clR, clG, clB);
if Cts = 2 then
RGBToHSL(clR,clG,clB,H1,S1,L1);
PtrData := TClient(Client).IOManager.ReturnData(xs, ys, dX + 1, dY + 1);
//Load rowdata
RowData:= CalculateRowPtrs(ptrdata,dy+1);
//Load the spiral path
LoadSpiralPath(x-xs,y-ys,0,0,dx,dy);
HiSpiral := (dy+1) * (dx + 1) -1;
case CTS of
0:
for i := 0 to HiSpiral do
if ((abs(clB-RowData[ClientTPA[i].y][ClientTPA[i].x].B) <= Tol) and
(abs(clG-RowData[ClientTPA[i].y][ClientTPA[i].x].G) <= Tol) and
(Abs(clR-RowData[ClientTPA[i].y][ClientTPA[i].x].R) <= Tol)) then
goto Hit;
1:
begin
Tol := Sqr(Tol);
for i := 0 to HiSpiral do
if (sqr(clB - RowData[ClientTPA[i].y][ClientTPA[i].x].B) +
sqr(clG - RowData[ClientTPA[i].y][ClientTPA[i].x].G) +
sqr(clR-RowData[ClientTPA[i].y][ClientTPA[i].x].R)) <= Tol then
goto Hit;
end;
2:
{ Can be optimized a lot... RGBToHSL isn't really inline, }
begin
HueXTol := hueMod * Tol;
SatXTol := satMod * Tol;
for i := 0 to HiSpiral do
begin
RGBToHSL(RowData[ClientTPA[i].y][ClientTPA[i].x].R,
RowData[ClientTPA[i].y][ClientTPA[i].x].G,
RowData[ClientTPA[i].y][ClientTPA[i].x].B,H2,S2,L2);
if ((abs(H1 - H2) <= HueXTol) and (abs(S1 - S2) <= SatXTol) and (abs(L1 - L2) <= Tol)) then
goto Hit;
end;
end;
end;
Result := False;
TClient(Client).IOManager.FreeReturnData;
Exit;
Hit:
Result := True;
x := ClientTPA[i].x + xs;
y := ClientTPA[i].y + ys;
TClient(Client).IOManager.FreeReturnData;
end;
function TMFinder.FindColoredArea(var x, y: Integer; Color, xs, ys, xe, ye, MinArea: Integer): Boolean;
var
PtrData: TRetData;

View File

@ -97,7 +97,7 @@ type
add seperate tpa or boolean array for every point that is to be matched ?
}
pDTM = record
pDTM = packed record
l: Integer;
p: TPointArray;
c, t, asz, ash: TIntegerArray;