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 object Form1: TForm1
Left = 593 Left = 273
Height = 557 Height = 557
Top = 321 Top = 233
Width = 734 Width = 734
ActiveControl = ScriptPanel ActiveControl = ScriptPanel
Caption = 'THA FUKING SIMBA' Caption = 'THA FUKING SIMBA'
ClientHeight = 532 ClientHeight = 537
ClientWidth = 734 ClientWidth = 734
KeyPreview = True KeyPreview = True
Menu = MainMenu Menu = MainMenu
@ -201,8 +201,8 @@ object Form1: TForm1
end end
object StatusBar: TStatusBar object StatusBar: TStatusBar
Left = 0 Left = 0
Height = 21 Height = 23
Top = 511 Top = 514
Width = 734 Width = 734
Panels = < Panels = <
item item
@ -220,7 +220,7 @@ object Form1: TForm1
object PanelMemo: TPanel object PanelMemo: TPanel
Left = 0 Left = 0
Height = 154 Height = 154
Top = 357 Top = 360
Width = 734 Width = 734
Align = alBottom Align = alBottom
ClientHeight = 154 ClientHeight = 154
@ -240,19 +240,19 @@ object Form1: TForm1
Cursor = crVSplit Cursor = crVSplit
Left = 0 Left = 0
Height = 5 Height = 5
Top = 352 Top = 355
Width = 734 Width = 734
Align = alBottom Align = alBottom
ResizeAnchor = akBottom ResizeAnchor = akBottom
end end
object ScriptPanel: TPanel object ScriptPanel: TPanel
Left = 0 Left = 0
Height = 328 Height = 331
Top = 24 Top = 24
Width = 734 Width = 734
Align = alClient Align = alClient
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 328 ClientHeight = 331
ClientWidth = 734 ClientWidth = 734
DockSite = True DockSite = True
TabOrder = 4 TabOrder = 4
@ -260,7 +260,7 @@ object Form1: TForm1
OnDockOver = ScriptPanelDockOver OnDockOver = ScriptPanelDockOver
object PageControl1: TPageControl object PageControl1: TPageControl
Left = 155 Left = 155
Height = 293 Height = 296
Top = 0 Top = 0
Width = 579 Width = 579
Align = alClient Align = alClient
@ -279,7 +279,7 @@ object Form1: TForm1
object SearchPanel: TPanel object SearchPanel: TPanel
Left = 0 Left = 0
Height = 35 Height = 35
Top = 293 Top = 296
Width = 734 Width = 734
Align = alBottom Align = alBottom
BevelOuter = bvSpace BevelOuter = bvSpace
@ -375,7 +375,7 @@ object Form1: TForm1
end end
object LabeledEditSearch: TLabeledEdit object LabeledEditSearch: TLabeledEdit
Left = 104 Left = 104
Height = 27 Height = 21
Top = 6 Top = 6
Width = 174 Width = 174
EditLabel.AnchorSideLeft.Control = LabeledEditSearch EditLabel.AnchorSideLeft.Control = LabeledEditSearch
@ -383,10 +383,10 @@ object Form1: TForm1
EditLabel.AnchorSideTop.Side = asrCenter EditLabel.AnchorSideTop.Side = asrCenter
EditLabel.AnchorSideRight.Control = LabeledEditSearch EditLabel.AnchorSideRight.Control = LabeledEditSearch
EditLabel.AnchorSideBottom.Control = LabeledEditSearch EditLabel.AnchorSideBottom.Control = LabeledEditSearch
EditLabel.Left = 65 EditLabel.Left = 73
EditLabel.Height = 18 EditLabel.Height = 14
EditLabel.Top = 10 EditLabel.Top = 9
EditLabel.Width = 36 EditLabel.Width = 28
EditLabel.Caption = 'Find: ' EditLabel.Caption = 'Find: '
EditLabel.ParentColor = False EditLabel.ParentColor = False
LabelPosition = lpLeft LabelPosition = lpLeft
@ -399,9 +399,9 @@ object Form1: TForm1
end end
object CheckBoxMatchCase: TCheckBox object CheckBoxMatchCase: TCheckBox
Left = 320 Left = 320
Height = 22 Height = 17
Top = 7 Top = 7
Width = 98 Width = 72
Caption = 'Match case' Caption = 'Match case'
OnClick = CheckBoxMatchCaseClick OnClick = CheckBoxMatchCaseClick
TabOrder = 1 TabOrder = 1
@ -409,39 +409,35 @@ object Form1: TForm1
end end
object SplitterFunctionList: TSplitter object SplitterFunctionList: TSplitter
Left = 150 Left = 150
Height = 293 Height = 296
Top = 0 Top = 0
Width = 5 Width = 5
OnCanResize = SplitterFunctionListCanResize OnCanResize = SplitterFunctionListCanResize
Visible = False Visible = False
end end
inline frmFunctionList: TFunctionListFrame inline frmFunctionList: TFunctionListFrame
Height = 293 Height = 296
Width = 150 Width = 150
ClientHeight = 293 ClientHeight = 296
ClientWidth = 150 ClientWidth = 150
OnEndDock = nil OnEndDock = nil
TabOrder = 3 TabOrder = 3
inherited FunctionList: TTreeView inherited FunctionList: TTreeView
Height = 244 Height = 257
Top = 22
Width = 150 Width = 150
DefaultItemHeight = 19
OnChange = FunctionListChange OnChange = FunctionListChange
OnDeletion = nil OnDeletion = nil
OnEnter = FunctionListEnter OnEnter = FunctionListEnter
OnExit = FunctionListExit OnExit = FunctionListExit
end end
inherited editSearchList: TEdit inherited editSearchList: TEdit
Height = 27 Top = 275
Top = 266
Width = 150 Width = 150
OnExit = editSearchListExit OnExit = editSearchListExit
OnKeyDown = editSearchListKeyDown OnKeyDown = editSearchListKeyDown
OnKeyPress = editSearchListKeyPress OnKeyPress = editSearchListKeyPress
end end
inherited FunctionListLabel: TLabel inherited FunctionListLabel: TLabel
Height = 18
Width = 146 Width = 146
end end
end end
@ -2739,19 +2735,16 @@ object Form1: TForm1
Caption = 'Cu&t' Caption = 'Cu&t'
ImageIndex = 3 ImageIndex = 3
OnExecute = ActionCutExecute OnExecute = ActionCutExecute
ShortCut = 16472
end end
object ActionCopy: TAction object ActionCopy: TAction
Caption = '&Copy' Caption = '&Copy'
ImageIndex = 22 ImageIndex = 22
OnExecute = ActionCopyExecute OnExecute = ActionCopyExecute
ShortCut = 16451
end end
object ActionPaste: TAction object ActionPaste: TAction
Caption = '&Paste' Caption = '&Paste'
ImageIndex = 11 ImageIndex = 11
OnExecute = ActionPasteExecute OnExecute = ActionPasteExecute
ShortCut = 16470
end end
object ActionDelete: TAction object ActionDelete: TAction
Caption = '&Delete' 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 if CurrScript.SynEdit.Focused or ScriptPopup.HandleAllocated then
CurrScript.SynEdit.PasteFromClipboard CurrScript.SynEdit.PasteFromClipboard
else if Memo1.Focused then 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; end;
procedure TForm1.ActionPauseExecute(Sender: TObject); procedure TForm1.ActionPauseExecute(Sender: TObject);
@ -1438,6 +1443,7 @@ var
Methods : TExpMethodArr; Methods : TExpMethodArr;
LastSection : string; LastSection : string;
Sections : TStringList; Sections : TStringList;
Nodes : array of TTreeNode;
i : integer; i : integer;
Index : integer; Index : integer;
TempNode : TTreeNode; TempNode : TTreeNode;
@ -1459,11 +1465,13 @@ begin
LastSection := Methods[i].Section; LastSection := Methods[i].Section;
Index := Sections.IndexOf(LastSection); Index := Sections.IndexOf(LastSection);
if Index <> -1 then if Index <> -1 then
TempNode := Tree.Items.Item[index] TempNode := Nodes[index]
else else
begin begin
TempNode := Tree.Items.Add(nil,LastSection); TempNode := Tree.Items.Add(nil,LastSection);
Sections.Add(LastSection); Sections.Add(LastSection);
setlength(nodes,length(nodes)+1);
nodes[high(nodes)] := tempNode;
end; end;
end; end;
Temp2Node := Tree.Items.AddChild(Tempnode,GetMethodName(Methods[i].FuncDecl,false)); Temp2Node := Tree.Items.AddChild(Tempnode,GetMethodName(Methods[i].FuncDecl,false));

View File

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

View File

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

View File

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

View File

@ -21,50 +21,50 @@
File.inc for the Mufasa Macro Library File.inc for the Mufasa Macro Library
} }
function ps_CreateFile(Path: string): Integer; ps_decl; function ps_CreateFile(Path: string): Integer; extdecl;
begin begin
Result := CurrThread.Client.MFiles.CreateFile(Path); Result := CurrThread.Client.MFiles.CreateFile(Path);
end; end;
function ps_OpenFile(Path: string; Shared: Boolean): Integer; ps_decl; function ps_OpenFile(Path: string; Shared: Boolean): Integer; extdecl;
begin begin
Result := CurrThread.Client.MFiles.OpenFile(Path, Shared); Result := CurrThread.Client.MFiles.OpenFile(Path, Shared);
end; end;
function ps_RewriteFile(Path: string; Shared: Boolean): Integer; ps_decl; function ps_RewriteFile(Path: string; Shared: Boolean): Integer; extdecl;
begin begin
Result := CurrThread.Client.MFiles.RewriteFile(Path, Shared); Result := CurrThread.Client.MFiles.RewriteFile(Path, Shared);
end; end;
procedure ps_CloseFile(FileNum: Integer); ps_decl; procedure ps_CloseFile(FileNum: Integer); extdecl;
begin begin
CurrThread.Client.MFiles.CloseFile(FileNum); CurrThread.Client.MFiles.CloseFile(FileNum);
end; end;
function ps_EndOfFile(FileNum: Integer): Boolean; ps_decl; function ps_EndOfFile(FileNum: Integer): Boolean; extdecl;
begin begin
Result := CurrThread.Client.MFiles.EndOfFile(FileNum); Result := CurrThread.Client.MFiles.EndOfFile(FileNum);
end; end;
function ps_FileSize(FileNum: Integer): LongInt; ps_decl; function ps_FileSize(FileNum: Integer): LongInt; extdecl;
begin begin
Result := CurrThread.Client.MFiles.FileSizeMuf(FileNum); Result := CurrThread.Client.MFiles.FileSizeMuf(FileNum);
end; 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 begin
Result := CurrThread.Client.MFiles.ReadFileString(FileNum, s, x); Result := CurrThread.Client.MFiles.ReadFileString(FileNum, s, x);
end; end;
function ps_WriteFileString(FileNum: Integer; s: string): Boolean; ps_decl; function ps_WriteFileString(FileNum: Integer; s: string): Boolean; extdecl;
begin begin
Result := CurrThread.Client.MFiles.WriteFileString(FileNum, s); Result := CurrThread.Client.MFiles.WriteFileString(FileNum, s);
end; end;
function ps_SetFileCharPointer(FileNum, cChars, Origin: Integer): Integer; ps_decl; function ps_SetFileCharPointer(FileNum, cChars, Origin: Integer): Integer; extdecl;
begin begin
Result := CurrThread.Client.MFiles.SetFileCharPointer(Filenum, cChars, Origin); Result := CurrThread.Client.MFiles.SetFileCharPointer(Filenum, cChars, Origin);
end; end;
function ps_FilePointerPos(FileNum: Integer): Integer; ps_decl; function ps_FilePointerPos(FileNum: Integer): Integer; extdecl;
begin begin
Result := CurrThread.Client.MFiles.FilePointerPos(FileNum); Result := CurrThread.Client.MFiles.FilePointerPos(FileNum);
end; end;
@ -72,7 +72,37 @@ function ps_FileExists ( const FileName : string ) : Boolean;
begin begin
result := FileExists(FileName); result := FileExists(FileName);
end; end;
function ps_DirectoryExists ( const DirectoryName : string ) : Boolean; ps_decl; function ps_DirectoryExists ( const DirectoryName : string ) : Boolean; extdecl;
begin begin
result := DirectoryExists(DirectoryName); result := DirectoryExists(DirectoryName);
end; 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 begin
result := GetPage(S); result := GetPage(S);
end; end;

View File

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

View File

@ -21,71 +21,81 @@
Math.inc for the Mufasa Macro Library Math.inc for the Mufasa Macro Library
} }
function ps_iAbs(a : integer) : integer;ps_decl; function ps_iAbs(a : integer) : integer;extdecl;
begin begin
result := abs(a); result := abs(a);
end; end;
function ps_ceil(e : extended) : integer;ps_decl; function ps_ceil(e : extended) : integer;extdecl;
begin begin
result := ceil(e); result := ceil(e);
end; end;
function ps_pow(base,exponent : extended) : extended; ps_decl; function ps_pow(base,exponent : extended) : extended; extdecl;
begin begin
result := power(base,exponent); result := power(base,exponent);
end; end;
function ps_Max(a,b : integer) : integer; ps_decl; function ps_Max(a,b : integer) : integer; extdecl;
begin begin
result := max(a,b); result := max(a,b);
end; end;
function ps_Min(a, b: Integer): Integer; ps_decl; function ps_Min(a, b: Integer): Integer; extdecl;
begin begin
result := min(a,b); result := min(a,b);
end; end;
function ps_MinE(a, b : extended) : extended; ps_decl; function ps_MinE(a, b : extended) : extended; extdecl;
begin begin
result := min(a,b); result := min(a,b);
end; end;
function ps_MaxE(a,b : extended) : extended; ps_decl; function ps_MaxE(a,b : extended) : extended; extdecl;
begin begin
result := max(a,b); result := max(a,b);
end; end;
function ps_Sqr(e : extended) : extended;ps_decl; function ps_Sqr(e : extended) : extended;extdecl;
begin begin
result := sqr(e); result := sqr(e);
end; end;
function ps_Point(x,y : integer) : TPoint;ps_decl; function ps_Point(x,y : integer) : TPoint;extdecl;
begin begin
result := classes.point(x,y); result := classes.point(x,y);
end; end;
function ps_Distance(x1,y1,x2,y2 : integer) : integer;ps_decl; function ps_Distance(x1,y1,x2,y2 : integer) : integer;extdecl;
begin begin
Result := Round(Sqrt(Sqr(x2-x1) + Sqr(y2-y1))); Result := Round(Sqrt(Sqr(x2-x1) + Sqr(y2-y1)));
end; end;
function ps_Hypot(X, Y: Extended): Extended;ps_decl; function ps_Hypot(X, Y: Extended): Extended;extdecl;
begin begin
result := hypot(x,y); result := hypot(x,y);
end; end;
function ps_RandomRange(const aFrom, aTo: Integer): Integer; ps_decl; function ps_RandomRange(const aFrom, aTo: Integer): Integer; extdecl;
begin begin
Result:=Random(Abs(aFrom-aTo))+Min(aTo,AFrom); Result:=Random(Abs(aFrom-aTo))+Min(aTo,AFrom);
end; end;
function ps_ArcTan2(x,y : extended) : extended; function ps_ArcTan2(x,y : extended) : extended; extdecl;
begin begin
result := ArcTan2(x,y); result := ArcTan2(x,y);
end; 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 var
Loop : longword; Loop : longword;
begin begin
@ -94,12 +104,12 @@ begin
result := result * loop; result := result * loop;
end; end;
function BinCoe(a, b: LongInt): Extended; ps_decl; function BinCoe(a, b: LongInt): Extended; extdecl;
begin begin
result := Factorial(a) / (factorial(b) * factorial(a-b)); result := Factorial(a) / (factorial(b) * factorial(a-b));
end; end;
function FixD(Degrees : extended) : Extended; ps_decl; function FixD(Degrees : extended) : Extended; extdecl;
begin; begin;
Result := Degrees; Result := Degrees;
while Result < 0 do while Result < 0 do
@ -108,7 +118,7 @@ begin;
Result := Result - 360; Result := Result - 360;
end; end;
function IntToBox(x1,y1,x2,y2 : integer) : TBox; ps_decl; function IntToBox(x1,y1,x2,y2 : integer) : TBox; extdecl;
begin; begin;
result.x1 := x1; result.x1 := x1;
result.y1 := y1; result.y1 := y1;
@ -116,12 +126,12 @@ begin;
result.y2 := y2; result.y2 := y2;
end; end;
function IntInBox(x, y: Integer; Box: TBox): Boolean; ps_decl; function IntInBox(x, y: Integer; Box: TBox): Boolean; extdecl;
begin; begin;
result := (((x >= Box.x1) and(x <= Box.x2)) and ((y >= box.y1) and (y <= box.y2))); result := (((x >= Box.x1) and(x <= Box.x2)) and ((y >= box.y1) and (y <= box.y2)));
end; end;
function PointToBox(PT1,PT2 : TPoint) : TBox; ps_decl; function PointToBox(PT1,PT2 : TPoint) : TBox; extdecl;
begin; begin;
result.x1 := PT1.x; result.x1 := PT1.x;
result.y1 := PT1.y; result.y1 := PT1.y;
@ -129,8 +139,12 @@ begin;
result.y2 := PT2.y; result.y2 := PT2.y;
end; end;
function PointInBox(PT : TPoint; Box: TBox): Boolean; ps_decl; function PointInBox(PT : TPoint; Box: TBox): Boolean; extdecl;
begin; begin;
result := (((PT.x >= Box.x1) and(PT.x <= Box.x2)) and ((PT.y>= box.y1) and (PT.y <= box.y2))); result := (((PT.x >= Box.x1) and(PT.x <= Box.x2)) and ((PT.y>= box.y1) and (PT.y <= box.y2)));
end; 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_right = 0;
ps_mouse_left = 1; ps_mouse_left = 1;
ps_mouse_middle = 2; ps_mouse_middle = 2;
procedure MoveMouse(x, y: integer); ps_decl; procedure MoveMouse(x, y: integer); extdecl;
begin begin
CurrThread.Client.IOManager.SetMousePos(X, Y); CurrThread.Client.IOManager.SetMousePos(X, Y);
end; end;
procedure GetMousePos(out x, y: integer); ps_decl; procedure GetMousePos(out x, y: integer); extdecl;
begin begin
CurrThread.Client.IOManager.GetMousePos(X, Y); CurrThread.Client.IOManager.GetMousePos(X, Y);
end; end;
@ -45,17 +45,17 @@ begin;
end; end;
end; end;
procedure HoldMouse(x, y: integer; clickType: integer); ps_decl; procedure HoldMouse(x, y: integer; clickType: integer); extdecl;
begin begin
CurrThread.Client.IOManager.HoldMouse(x, y, ConvIntClickType(clickType)); CurrThread.Client.IOManager.HoldMouse(x, y, ConvIntClickType(clickType));
end; end;
procedure ReleaseMouse(x, y: integer; clickType: integer); ps_decl; procedure ReleaseMouse(x, y: integer; clickType: integer); extdecl;
begin begin
CurrThread.Client.IOManager.ReleaseMouse(x, y, ConvIntClickType(clickType)); CurrThread.Client.IOManager.ReleaseMouse(x, y, ConvIntClickType(clickType));
end; end;
procedure ClickMouse(x, y: integer; clickType: integer); ps_decl; procedure ClickMouse(x, y: integer; clickType: integer); extdecl;
begin begin
CurrThread.Client.IOManager.ClickMouse(x, y, ConvIntClickType(clickType)); CurrThread.Client.IOManager.ClickMouse(x, y, ConvIntClickType(clickType));
end; end;

View File

@ -1,9 +1,14 @@
function rs_GetUpText: String; ps_decl; function rs_GetUpText: String; extdecl;
begin begin
Result := CurrThread.Client.MOCR.GetUpTextAtEx(7, 7, true); Result := CurrThread.Client.MOCR.GetUpTextAtEx(7, 7, true);
end; 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 var
bmp: TMufasaBitmap; bmp: TMufasaBitmap;
begin begin
@ -12,12 +17,12 @@ begin
Result := CurrThread.Client.MBitmaps.AddBMP(bmp); Result := CurrThread.Client.MBitmaps.AddBMP(bmp);
end; end;
function MaskFromText(text, font: String): TMask; ps_decl; function MaskFromText(text, font: String): TMask; extdecl;
begin begin
Result := CurrThread.Client.MOCR.TextToMask(text,font); Result := CurrThread.Client.MOCR.TextToMask(text,font);
end; 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 begin
Result := CurrThread.Client.MOCR.TextToFontTPA(text, font, w, h); Result := CurrThread.Client.MOCR.TextToFontTPA(text, font, w, h);
end; end;

View File

@ -21,7 +21,7 @@
Other.inc for the Mufasa Macro Library Other.inc for the Mufasa Macro Library
} }
procedure psWait(t: Integer); ps_decl; procedure psWait(t: Integer); extdecl;
{$ifdef MSWINDOWS} {$ifdef MSWINDOWS}
begin begin
Sleep(t); Sleep(t);
@ -42,13 +42,13 @@ begin
end; end;
{$endif} {$endif}
procedure ClearDebug; ps_decl; procedure ClearDebug; extdecl;
begin begin
if Assigned(CurrThread.DebugMemo) then if Assigned(CurrThread.DebugMemo) then
CurrThread.Synchronize(@CurrThread.DebugMemo.Clear); CurrThread.Synchronize(@CurrThread.DebugMemo.Clear);
end; end;
procedure SaveScreenshot(FileName: string); ps_decl; procedure SaveScreenshot(FileName: string); extdecl;
var var
w,h : integer; w,h : integer;
bmp: TMufasaBitmap; bmp: TMufasaBitmap;
@ -62,35 +62,35 @@ end;
procedure DisplayDebugImgWindow(w,h : integer); ps_decl; procedure DisplayDebugImgWindow(w,h : integer); extdecl;
begin; begin;
CurrThread.DebugImg.DispSize^ := Classes.Point(w,h); CurrThread.DebugImg.DispSize^ := Classes.Point(w,h);
CurrThread.Synchronize( CurrThread.DebugImg.ShowForm); CurrThread.Synchronize( CurrThread.DebugImg.ShowForm);
end; end;
procedure DrawBitmapDebugImg(bmp : integer); ps_decl; procedure DrawBitmapDebugImg(bmp : integer); extdecl;
begin; begin;
CurrThread.DebugImg.ToDrawBitmap^ := CurrThread.Client.MBitmaps[bmp]; CurrThread.DebugImg.ToDrawBitmap^ := CurrThread.Client.MBitmaps[bmp];
CurrThread.Synchronize(CurrThread.DebugImg.DrawBitmap); CurrThread.Synchronize(CurrThread.DebugImg.DrawBitmap);
end; end;
function GetDebugBitmap : integer; ps_decl; function GetDebugBitmap : integer; extdecl;
begin; begin;
result := CurrThread.Client.MBitmaps.CreateBMP(0,0); result := CurrThread.Client.MBitmaps.CreateBMP(0,0);
CurrThread.DebugImg.GetDebugBitmap^ := CurrThread.Client.MBitmaps[result]; CurrThread.DebugImg.GetDebugBitmap^ := CurrThread.Client.MBitmaps[result];
CurrThread.Synchronize(CurrThread.DebugImg.GetBitmap); CurrThread.Synchronize(CurrThread.DebugImg.GetBitmap);
end; end;
procedure TerminateScript; ps_decl; procedure TerminateScript; extdecl;
begin; begin;
CurrThread.Terminate; CurrThread.Terminate;
end; end;
function GetTimeRunning: LongWord; ps_decl; function GetTimeRunning: LongWord; extdecl;
begin; begin;
result := GetTickCount - CurrThread.StartTime; result := GetTickCount - CurrThread.StartTime;
end; end;
procedure ConvertTime(Time : integer; var h,m,s : integer); ps_decl; procedure ConvertTime(Time : integer; var h,m,s : integer); extdecl;
var var
x : integer; x : integer;
begin; begin;
@ -101,27 +101,27 @@ begin;
x := x mod (1000 * 60); x := x mod (1000 * 60);
s := x div (1000); s := x div (1000);
end; 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 begin
decodedate(sourcedate,year,month,day); decodedate(sourcedate,year,month,day);
end; 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 begin
decodetime(datetime,hour,min,sec,msec); decodetime(datetime,hour,min,sec,msec);
end; end;
function ps_Now : TDateTime; ps_decl; function ps_Now : TDateTime; extdecl;
begin begin
result := now; result := now;
end; end;
function ps_Date : TDateTime; ps_decl; function ps_Date : TDateTime; extdecl;
begin begin
result := date; result := date;
end; end;
function ps_GetTickCount : Longword; ps_decl; function ps_GetTickCount : Longword; extdecl;
begin begin
result := GetTickCount; result := GetTickCount;
end; end;
procedure HakunaMatata; ps_decl; procedure HakunaMatata; extdecl;
begin; begin;
OpenWebPage('http://www.youtube.com/v/ejEVczA8PLU&hl=en&fs=1&autoplay=1'); OpenWebPage('http://www.youtube.com/v/ejEVczA8PLU&hl=en&fs=1&autoplay=1');
end; 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 window.inc for the Mufasa Macro Library
} }
procedure SetDesktopAsClient; ps_decl; procedure SetDesktopAsClient; extdecl;
begin; begin;
CurrThread.Client.IOManager.SetDesktop; CurrThread.Client.IOManager.SetDesktop;
end; end;
function SetTargetArray(P: Integer; w, h: integer): integer; ps_decl; function SetTargetArray(P: Integer; w, h: integer): integer; extdecl;
begin begin
result:= CurrThread.Client.IOManager.SetTarget(PRGB32(P), classes.point(w,h)); result:= CurrThread.Client.IOManager.SetTarget(PRGB32(P), classes.point(w,h));
end; end;
function SetTargetBitmap(bitmap: Integer): integer; ps_decl; function SetTargetBitmap(bitmap: Integer): integer; extdecl;
begin; begin;
result:= CurrThread.Client.IOManager.SetTarget(CurrThread.Client.MBitmaps[Bitmap]); result:= CurrThread.Client.IOManager.SetTarget(CurrThread.Client.MBitmaps[Bitmap]);
end; end;
function SetEIOSTarget(name: string; args: Variant): integer; ps_decl; function SetEIOSTarget(name: string; args: Variant): integer; extdecl;
begin begin
result:= CurrThread.Client.IOManager.SetTarget(name, @args); result:= CurrThread.Client.IOManager.SetTarget(name, @args);
end; end;
procedure SetImageTarget(idx: integer); ps_decl; procedure SetImageTarget(idx: integer); extdecl;
begin begin
CurrThread.Client.IOManager.SetImageTarget(idx); CurrThread.Client.IOManager.SetImageTarget(idx);
end; end;
procedure SetKeyMouseTarget(idx: integer); ps_decl; procedure SetKeyMouseTarget(idx: integer); extdecl;
begin begin
CurrThread.Client.IOManager.SetKeyMouseTarget(idx); CurrThread.Client.IOManager.SetKeyMouseTarget(idx);
end; end;
function GetImageTarget: integer; ps_decl; function GetImageTarget: integer; extdecl;
begin begin
CurrThread.Client.IOManager.GetImageTarget(result); CurrThread.Client.IOManager.GetImageTarget(result);
end; end;
function GetKeyMouseTarget: integer; ps_decl; function GetKeyMouseTarget: integer; extdecl;
begin begin
CurrThread.Client.IOManager.GetKeyMouseTarget(result); CurrThread.Client.IOManager.GetKeyMouseTarget(result);
end; end;
procedure FreeTarget(idx: integer); ps_decl; procedure FreeTarget(idx: integer); extdecl;
begin begin
CurrThread.Client.IOManager.FreeTarget(idx); CurrThread.Client.IOManager.FreeTarget(idx);
end; end;
procedure GetClientDimensions(out w, h: integer); ps_decl; procedure GetClientDimensions(out w, h: integer); extdecl;
begin begin
CurrThread.Client.IOManager.GetDimensions(w, h); CurrThread.Client.IOManager.GetDimensions(w, h);
end; end;
function Freeze: boolean; ps_decl; function Freeze: boolean; extdecl;
begin begin
CurrThread.Client.IOManager.SetFrozen(true); CurrThread.Client.IOManager.SetFrozen(true);
result := true; //dunno what the result is supposed to mean result := true; //dunno what the result is supposed to mean
end; end;
function Unfreeze: boolean; ps_decl; function Unfreeze: boolean; extdecl;
begin begin
CurrThread.Client.IOManager.SetFrozen(false); CurrThread.Client.IOManager.SetFrozen(false);
result := true; //dunno what the result is supposed to mean result := true; //dunno what the result is supposed to mean
end; end;
procedure ActivateClient; ps_decl; procedure ActivateClient; extdecl;
begin begin
CurrThread.Client.IOManager.ActivateClient; CurrThread.Client.IOManager.ActivateClient;
end; end;
function IsTargetValid: boolean; ps_decl; function IsTargetValid: boolean; extdecl;
begin begin
result:= CurrThread.Client.IOManager.TargetValid; result:= CurrThread.Client.IOManager.TargetValid;
end; 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('IncludePath','string').SetString(CurrThread.IncludePath);
Sender.Comp.AddConstantN('PluginPath','string').SetString(CurrThread.PluginPath); Sender.Comp.AddConstantN('PluginPath','string').SetString(CurrThread.PluginPath);
Sender.Comp.AddConstantN('FontPath','string').SetString(CurrThread.FontPath); 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('TDateTime','Double');
Sender.Comp.AddTypeS('TIntegerArray', 'Array of LongInt'); Sender.Comp.AddTypeS('TIntegerArray', 'Array of LongInt');
Sender.Comp.AddTypeS('TExtendedArray','Array of extended'); Sender.Comp.AddTypeS('TExtendedArray','Array of extended');
Sender.Comp.AddTypeS('TBoolArray', 'Array of Boolean'); Sender.Comp.AddTypeS('TBoolArray', 'Array of Boolean');
Sender.Comp.AddTypes('TBox', 'record X1,Y1,X2,Y2 : Integer; end;'); 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('TPointArray','Array of TPoint');
Sender.Comp.AddTypeS('T2DPointArray','Array of TPointArray'); Sender.Comp.AddTypeS('T2DPointArray','Array of TPointArray');
Sender.Comp.AddTypeS('TPointArrayArray','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'); SetCurrSection('Math');
AddFunction(nil,'function Round(e:extended) : integer'); AddFunction(nil,'function Round(e:extended) : integer');
AddFunction(@ps_ceil,'function ceil(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_pow,'function pow(base,exponent : extended) : extended');
AddFunction(@ps_max,'function Max(a, b: Integer): Integer;'); AddFunction(@ps_max,'function Max(a, b: Integer): Integer;');
AddFunction(@ps_min,'function Min(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(@ps_ArcTan2,'function ArcTan2(x,y : extended) : extended;');
AddFunction(@IntToBox,'function IntToBox(x1,y1,x2,y2 : integer) : TBox;'); AddFunction(@IntToBox,'function IntToBox(x1,y1,x2,y2 : integer) : TBox;');
AddFunction(@IntInBox,'function IntInBox(x, y: Integer; Box: TBox): Boolean;'); 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(@PointInBox,'function PointInBox(PT : TPoint; Box: TBox): Boolean;');
AddFunction(@ps_sqr,'function Sqr(e : extended) : extended;'); AddFunction(@ps_sqr,'function Sqr(e : extended) : extended;');
AddFunction(@ps_point,'function Point(x,y:integer) : TPoint;'); AddFunction(@ps_point,'function Point(x,y:integer) : TPoint;');
AddFunction(@ps_Distance,'function Distance(x1,y1,x2,y2 : integer) : integer;'); AddFunction(@ps_Distance,'function Distance(x1,y1,x2,y2 : integer) : integer;');
AddFunction(@ps_hypot,'function Hypot(X, Y: Extended): Extended;'); AddFunction(@ps_hypot,'function Hypot(X, Y: Extended): Extended;');
AddFunction(@ps_RandomRange,'function RandomRange(aFrom,aTo: Integer): Integer;'); 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(@BinCoe,'function BinCoe(a, b: LongInt): Extended;');
AddFunction(@FixD,'function FixD(Degrees : extended) : Extended;'); AddFunction(@FixD,'function FixD(Degrees : extended) : Extended;');
AddFunction(@InRange,'function InRange(value,min,max : integer) : boolean;'); 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_FilePointerPos, 'function FilePointerPos(FileNum: Integer): Integer;');
AddFunction(@ps_DirectoryExists,'function DirectoryExists( const DirectoryName : string ) : Boolean;'); AddFunction(@ps_DirectoryExists,'function DirectoryExists( const DirectoryName : string ) : Boolean;');
AddFunction(@ps_FileExists,'function FileExists ( const FileName : 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} {other}
SetCurrSection('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_StrToFloatDef, 'function StrToFloatDef(value: String; default: Extended): Extended;');
AddFunction(@ps_StrToBool, 'function StrToBool(value: String): Boolean;'); AddFunction(@ps_StrToBool, 'function StrToBool(value: String): Boolean;');
AddFunction(@ps_StrToBoolDef, 'function StrToBoolDef(value: String; default: Boolean): 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} {web}
SetCurrSection('Web'); SetCurrSection('Web');
AddFunction(@OpenWebPage,'procedure OpenWebPage(url : string);'); 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(@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(@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(@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(@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(@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'); 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} { OCR}
SetCurrSection('OCR'); SetCurrSection('OCR');
AddFunction(@rs_GetUpText, 'function rs_GetUpText: string;'); 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(@BitmapFromText, 'function BitmapFromText(text, font: String): integer;');
AddFunction(@TPAFromText, 'function TPAFromText(text, font: String;out w,h : integer): TPointArray;'); AddFunction(@TPAFromText, 'function TPAFromText(text, font: String;out w,h : integer): TPointArray;');
AddFunction(@MaskFromText, 'function MaskFromText(text, font: String): TMask;'); AddFunction(@MaskFromText, 'function MaskFromText(text, font: String): TMask;');

View File

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

View File

@ -62,6 +62,7 @@ type
// Possibly turn x, y into a TPoint var. // Possibly turn x, y into a TPoint var.
function FindColor(out x, y: Integer; Color, xs, ys, xe, ye: Integer): Boolean; 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 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 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 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; 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; TClient(Client).IOManager.FreeReturnData;
end; 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; function TMFinder.FindColoredArea(var x, y: Integer; Color, xs, ys, xe, ye, MinArea: Integer): Boolean;
var var
PtrData: TRetData; PtrData: TRetData;

View File

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