Merge branch 'master' of git://villavu.com/simba
@ -1,8 +1,9 @@
|
|||||||
Updater in Simba
|
Updater in Simba
|
||||||
================
|
================
|
||||||
|
|
||||||
A notice should appear in the Simba GUI, or you can alternatively
|
As soon as there is an update for Simba, an extra icon will appear in the icon
|
||||||
use Tools -> Update.
|
bar. If you click it, an update window will appear. Click *update* and Simba
|
||||||
|
will update itself. Note that you will have to restart Simba to use the updated
|
||||||
Don't forget to restart Simba when it has been updated!
|
version.
|
||||||
|
|
||||||
|
Alternatively you can use Tools -> Update to update.
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
Not Well Known Features
|
Not Well Known Features
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
|
Simba has several features that are relatively unknown.
|
||||||
|
A few will be listed here.
|
||||||
|
|
||||||
Timestamped Writeln
|
Timestamped Writeln
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
Simba can timestamp all your *writeln* calls.
|
Simba can timestamp all your debug.
|
||||||
|
|
||||||
.. code-block:: pascal
|
.. code-block:: pascal
|
||||||
|
|
||||||
|
@ -2,4 +2,4 @@ Simba Script Manager
|
|||||||
====================
|
====================
|
||||||
|
|
||||||
Community-created scripts will be available for download from the
|
Community-created scripts will be available for download from the
|
||||||
Script Manager.
|
Script Manager. The script manager will appear in release 1.0.
|
||||||
|
@ -60,6 +60,11 @@ This is the only supported way. You can simply do a svn checkout on the srl
|
|||||||
repository, but if you can do that, then you should be able to set up SRL
|
repository, but if you can do that, then you should be able to set up SRL
|
||||||
yourself as well.
|
yourself as well.
|
||||||
|
|
||||||
|
Setting up SRL 5 with Simba
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
This will follow later, upon SRL 5 release. (Which will be quite soon)
|
||||||
|
|
||||||
Installing scripts
|
Installing scripts
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
6
Doc/sphinx/mmlref/libmml.rst
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
libMML
|
||||||
|
======
|
||||||
|
|
||||||
|
libMML is an effort to bring the entire MML to a single standalone library.
|
||||||
|
|
||||||
|
MML usage will appear here soon.
|
@ -6,6 +6,10 @@ provide scripts with the required functionality, but also used to pick colours
|
|||||||
and select windows with Simba itself. The MML can run without any user
|
and select windows with Simba itself. The MML can run without any user
|
||||||
interface.
|
interface.
|
||||||
|
|
||||||
|
There currently is an effort to create a standalone library of the MML; called
|
||||||
|
*libMML*. This way any application can just load the library and use the MML
|
||||||
|
functionality.
|
||||||
|
|
||||||
The MML is split up in "Core" classes and "Addon" classes.
|
The MML is split up in "Core" classes and "Addon" classes.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
@ -20,3 +24,4 @@ The MML is split up in "Core" classes and "Addon" classes.
|
|||||||
mmlref/finder.rst
|
mmlref/finder.rst
|
||||||
mmlref/bitmap.rst
|
mmlref/bitmap.rst
|
||||||
mmlref/ocr.rst
|
mmlref/ocr.rst
|
||||||
|
mmlref/libmml
|
||||||
|
@ -25,7 +25,7 @@ This means your settings.xml has become corrupt somehow, or Simba may not be
|
|||||||
able to create it. If a settings.xml exists in your Simba directory, you can
|
able to create it. If a settings.xml exists in your Simba directory, you can
|
||||||
delete it. (All your settings will be lost, but this shouldn't be a bug deal)
|
delete it. (All your settings will be lost, but this shouldn't be a bug deal)
|
||||||
|
|
||||||
There is a bug report pending on this issue.
|
Note that this should no longer happen with Simba 750 and up.
|
||||||
|
|
||||||
..
|
..
|
||||||
Anything else?
|
Anything else?
|
||||||
|
@ -2,3 +2,5 @@ Tutorial
|
|||||||
=================
|
=================
|
||||||
|
|
||||||
Complete tutorial.
|
Complete tutorial.
|
||||||
|
|
||||||
|
.. What should be in here in the first place?
|
||||||
|
@ -5,22 +5,8 @@ Currently Simba is still in its beta stages; this includes the documentation.
|
|||||||
You will probably notice some parts of the documentation aren't finished or are just
|
You will probably notice some parts of the documentation aren't finished or are just
|
||||||
plain missing.
|
plain missing.
|
||||||
|
|
||||||
So what's new in Simba? This documentation system.
|
|
||||||
|
|
||||||
Simba is being updated almost every day. To see changes as they are added, view
|
Simba is being updated almost every day. To see changes as they are added, view
|
||||||
http://git.villavu.com/?p=simba.git;a=summary. Each commit should be explained
|
http://git.villavu.com/?p=simba.git;a=summary. Each commit should be explained
|
||||||
tersely in one line, and the exact changes can be viewed with "commitdiff". This
|
tersely in one line, and the exact changes can be viewed with "commitdiff".
|
||||||
is a very verbose list of changes, large features or changes will be listed below:
|
|
||||||
|
|
||||||
Changelog for 715::
|
|
||||||
|
|
||||||
- Array Operator support. (=, <>, +)
|
|
||||||
- Foldable comments
|
|
||||||
- Add Disguise
|
|
||||||
- Add Status
|
|
||||||
- Add ClearDebugImg
|
|
||||||
- Add PosEx
|
|
||||||
- Add a new interpreter
|
|
||||||
- Fix Hypot
|
|
||||||
- Fix Extension Menu Checkbox
|
|
||||||
|
|
||||||
|
A list of new features since 750 will show up here eventually.
|
||||||
|
@ -64,6 +64,10 @@ some issues remain. The biggest issue is the interpreter that
|
|||||||
executes your program. It is an external component and does not
|
executes your program. It is an external component and does not
|
||||||
play too well on Linux. Hopefully this will be improved upon soon.
|
play too well on Linux. Hopefully this will be improved upon soon.
|
||||||
|
|
||||||
|
There are plans on supporting interpreter for alternative languages such as
|
||||||
|
Python, these would largely resolve the current problems wit the PascalScript
|
||||||
|
interpreter on Linux/Mac.
|
||||||
|
|
||||||
Fast
|
Fast
|
||||||
~~~~
|
~~~~
|
||||||
|
|
||||||
@ -91,5 +95,5 @@ Well Documented
|
|||||||
~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Simba is well documented. (You're looking the documentation right now...)
|
Simba is well documented. (You're looking the documentation right now...)
|
||||||
There is still stuff left to document but overall the documentation is pretty
|
There is still a lot left to document but overall the documentation is pretty
|
||||||
good.
|
good.
|
||||||
|
BIN
Fonts/XPChars/32.bmp
Normal file
After Width: | Height: | Size: 210 B |
BIN
Fonts/XPChars/44.bmp
Normal file
After Width: | Height: | Size: 210 B |
Before Width: | Height: | Size: 366 B After Width: | Height: | Size: 366 B |
Before Width: | Height: | Size: 366 B After Width: | Height: | Size: 262 B |
Before Width: | Height: | Size: 366 B After Width: | Height: | Size: 366 B |
Before Width: | Height: | Size: 366 B After Width: | Height: | Size: 366 B |
Before Width: | Height: | Size: 366 B After Width: | Height: | Size: 366 B |
Before Width: | Height: | Size: 366 B After Width: | Height: | Size: 314 B |
Before Width: | Height: | Size: 366 B After Width: | Height: | Size: 366 B |
Before Width: | Height: | Size: 366 B After Width: | Height: | Size: 366 B |
Before Width: | Height: | Size: 366 B After Width: | Height: | Size: 366 B |
Before Width: | Height: | Size: 366 B After Width: | Height: | Size: 366 B |
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 210 B |
Before Width: | Height: | Size: 342 B After Width: | Height: | Size: 366 B |
Before Width: | Height: | Size: 390 B After Width: | Height: | Size: 314 B |
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
This file is part of the Simba Project
|
This file is part of the Simba Project
|
||||||
Copyright (c) 2009 by Raymond van Venetië and Merlijn Wajer
|
Copyright (c) 2009 by Raymond van Venetië and Merlijn Wajer
|
||||||
|
|
||||||
Simba is free software: you can redistribute it and/or modify
|
Simba is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -15,8 +15,8 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with MML. If not, see <http://www.gnu.org/licenses/>.
|
along with MML. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
See the file COPYING, included in this distribution,
|
See the file COPYING, included in this distribution,
|
||||||
for details about the copyright.
|
for details about the copyright.
|
||||||
|
|
||||||
Script Manager for the Simba project.
|
Script Manager for the Simba project.
|
||||||
}
|
}
|
||||||
@ -45,10 +45,13 @@ type
|
|||||||
|
|
||||||
TSimbaScript = class(TObject)
|
TSimbaScript = class(TObject)
|
||||||
private
|
private
|
||||||
|
function IsInstalled: boolean;
|
||||||
procedure LoadFromNode( Script : TDOMNode);
|
procedure LoadFromNode( Script : TDOMNode);
|
||||||
public
|
public
|
||||||
Name, Version, Author, Description: String;
|
Name, Version, Author, Description: String;
|
||||||
Tags, Files: TStringList;
|
Tags, Files: TStringList;
|
||||||
|
LocalScript : TSimbaScript;
|
||||||
|
property Installed : boolean read IsInstalled;
|
||||||
procedure Dbg;
|
procedure Dbg;
|
||||||
constructor Create;
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -76,10 +79,13 @@ type
|
|||||||
FLScripts: TList; //Array of the local scripts
|
FLScripts: TList; //Array of the local scripts
|
||||||
FVersion : String;
|
FVersion : String;
|
||||||
FUpdating : boolean;
|
FUpdating : boolean;
|
||||||
|
function FindScriptByName(name : string) : Integer;
|
||||||
|
function FindLScriptByName(name : string) : Integer;
|
||||||
function GetLScriptCount: integer;
|
function GetLScriptCount: integer;
|
||||||
function GetMainDir: string;
|
function GetMainDir: string;
|
||||||
function GetScript(index : integer): TSimbaScript;
|
function GetScript(index : integer): TSimbaScript;
|
||||||
function GetScriptCount: integer;
|
function GetScriptCount: integer;
|
||||||
|
procedure MatchLocalOnline;
|
||||||
public
|
public
|
||||||
property MainDir : string read GetMainDir write FMaindir;
|
property MainDir : string read GetMainDir write FMaindir;
|
||||||
property SimbaScript[index : integer] : TSimbaScript read GetScript;
|
property SimbaScript[index : integer] : TSimbaScript read GetScript;
|
||||||
@ -87,7 +93,7 @@ type
|
|||||||
procedure LUpdate; //Loads the local scripts, uses MainDir
|
procedure LUpdate; //Loads the local scripts, uses MainDir
|
||||||
function NewVersion(Script : integer) : boolean; //Checks for updates for Script
|
function NewVersion(Script : integer) : boolean; //Checks for updates for Script
|
||||||
procedure InstallNewScript(Script : integer); //Installs Script (Online -> Local)
|
procedure InstallNewScript(Script : integer); //Installs Script (Online -> Local)
|
||||||
procedure UpdateScript(Script : integer); //Updates all the info/files of local script
|
procedure UpdateScript(Script : integer; ignoreupdating : boolean = false); //Updates all the info/files of local script
|
||||||
procedure LSave; //Saves the local scripts, uses MainDir
|
procedure LSave; //Saves the local scripts, uses MainDir
|
||||||
property LScriptCount : integer read GetLScriptCount; //LScript = Local Script = Installed Script
|
property LScriptCount : integer read GetLScriptCount; //LScript = Local Script = Installed Script
|
||||||
property ScriptCount : integer read GetScriptCount; //Online script
|
property ScriptCount : integer read GetScriptCount; //Online script
|
||||||
@ -128,34 +134,6 @@ uses
|
|||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
{ TForm1 }
|
{ TForm1 }
|
||||||
procedure fill(s: TMMLSettings);
|
|
||||||
var
|
|
||||||
i:integer;
|
|
||||||
ss: TSimbaScript;
|
|
||||||
LI: TListItem;
|
|
||||||
strarr: TStringArray;
|
|
||||||
b: TButton;
|
|
||||||
|
|
||||||
begin
|
|
||||||
if not s.ListKeys('Scripts/ScriptList', strarr) then
|
|
||||||
writeln('ListKeys returned false');
|
|
||||||
writeln('strarr length: ' + inttostr(length(strarr)));
|
|
||||||
for i := 0 to high(strarr) do
|
|
||||||
begin
|
|
||||||
writeln(s.GetKeyValue('Scripts/ScriptList/Script/Name'));
|
|
||||||
ss := TSimbaScript.Create();
|
|
||||||
ss.Name := s.GetKeyValue('Scripts/ScriptList/Script/Name');
|
|
||||||
ss.Author:= s.GetKeyValue('Scripts/ScriptList/Script/Author');
|
|
||||||
ss.Description:= s.GetKeyValue('Scripts/ScriptList/Script/Description');
|
|
||||||
LI := Form1.ListView1.Items.Add;
|
|
||||||
LI.Caption := ss.Name;
|
|
||||||
LI.Data := ss;
|
|
||||||
LI.ImageIndex:= 0;
|
|
||||||
|
|
||||||
s.DeleteKey('Scripts/ScriptList/Script');
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TForm1.FormCreate(Sender: TObject);
|
procedure TForm1.FormCreate(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Mng := TScriptManager.Create;
|
Mng := TScriptManager.Create;
|
||||||
@ -171,10 +149,11 @@ begin
|
|||||||
begin
|
begin
|
||||||
Memo1.Clear;
|
Memo1.Clear;
|
||||||
Script := TSimbaScript(Item.data);
|
Script := TSimbaScript(Item.data);
|
||||||
Memo1.Lines.Add('Name: ' + Script.Name);
|
Memo1.Lines.add('Name: ' + Script.Name);
|
||||||
Memo1.lines.add('Author: ' + Script.Author);
|
Memo1.lines.add('Author: ' + Script.Author);
|
||||||
Memo1.Lines.add('Version: ' + Script.Version);
|
Memo1.Lines.add('Version: ' + Script.Version);
|
||||||
Memo1.Lines.Add('Description: ' + Script.Description);
|
Memo1.Lines.add('Installed: '+ BoolToStr(Script.Installed,true));
|
||||||
|
Memo1.Lines.add('Description: ' + Script.Description);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -221,6 +200,11 @@ end;
|
|||||||
|
|
||||||
{ TSimbaScript }
|
{ TSimbaScript }
|
||||||
|
|
||||||
|
function TSimbaScript.IsInstalled: boolean;
|
||||||
|
begin
|
||||||
|
Result := (LocalScript <> nil);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSimbaScript.LoadFromNode(Script: TDOMNode);
|
procedure TSimbaScript.LoadFromNode(Script: TDOMNode);
|
||||||
function NodeContents(ItemStr : string; node : TDOMNode) : string;
|
function NodeContents(ItemStr : string; node : TDOMNode) : string;
|
||||||
var
|
var
|
||||||
@ -268,6 +252,7 @@ begin
|
|||||||
Writeln(' Author: ' + Author);
|
Writeln(' Author: ' + Author);
|
||||||
Writeln(' Version: ' + Version);
|
Writeln(' Version: ' + Version);
|
||||||
Writeln(' Description: ' + Description);
|
Writeln(' Description: ' + Description);
|
||||||
|
Writeln(' Installed: '+ BoolToStr(Installed,true));
|
||||||
Writeln(' Tags:');
|
Writeln(' Tags:');
|
||||||
for i := 0 to Tags.Count - 1 do
|
for i := 0 to Tags.Count - 1 do
|
||||||
Writeln(' ' + Tags[i]);
|
Writeln(' ' + Tags[i]);
|
||||||
@ -279,7 +264,6 @@ end;
|
|||||||
constructor TSimbaScript.Create;
|
constructor TSimbaScript.Create;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
{stuff here}
|
{stuff here}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -296,6 +280,26 @@ end;
|
|||||||
|
|
||||||
{ TScriptManager }
|
{ TScriptManager }
|
||||||
|
|
||||||
|
function TScriptManager.FindScriptByName(name: string): Integer;
|
||||||
|
var
|
||||||
|
I : integer;
|
||||||
|
begin
|
||||||
|
for i := FScripts.Count - 1 downto 0 do
|
||||||
|
if TSimbaScript(FScripts[i]).Name = Name then
|
||||||
|
exit(i);
|
||||||
|
result := -1;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TScriptManager.FindLScriptByName(name: string): Integer;
|
||||||
|
var
|
||||||
|
I : integer;
|
||||||
|
begin
|
||||||
|
for i := FScripts.Count - 1 downto 0 do
|
||||||
|
if TLSimbaScript(FLScripts[i]).Name = Name then
|
||||||
|
exit(i);
|
||||||
|
result := -1;
|
||||||
|
end;
|
||||||
|
|
||||||
function TScriptManager.GetLScriptCount: integer;
|
function TScriptManager.GetLScriptCount: integer;
|
||||||
begin
|
begin
|
||||||
result := FLScripts.Count;
|
result := FLScripts.Count;
|
||||||
@ -316,6 +320,25 @@ begin
|
|||||||
result := FScripts.Count;
|
result := FScripts.Count;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TScriptManager.MatchLocalOnline;
|
||||||
|
var
|
||||||
|
Scrpt : TLSimbaScript;
|
||||||
|
I,II : integer;
|
||||||
|
begin
|
||||||
|
for ii := 0 to LScriptCount - 1 do
|
||||||
|
begin
|
||||||
|
Scrpt := TLSimbaScript(FLScripts[ii]);
|
||||||
|
if Scrpt.OnlineScript = nil then
|
||||||
|
for i := 0 to ScriptCount-1 do
|
||||||
|
if TSimbaScript(FScripts[i]).Name = Scrpt.Name then
|
||||||
|
begin
|
||||||
|
Scrpt.OnlineScript := TSimbaScript(FScripts[i]);
|
||||||
|
Break;
|
||||||
|
end;
|
||||||
|
Scrpt.OnlineScript.LocalScript := Scrpt;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TScriptManager.Update;
|
procedure TScriptManager.Update;
|
||||||
var
|
var
|
||||||
XMLFile : string;
|
XMLFile : string;
|
||||||
@ -325,6 +348,7 @@ var
|
|||||||
Subs : TStringList;
|
Subs : TStringList;
|
||||||
Down : TDownloadThread;
|
Down : TDownloadThread;
|
||||||
SScript : TSimbaScript;
|
SScript : TSimbaScript;
|
||||||
|
I : integer;
|
||||||
begin
|
begin
|
||||||
if FUpdating then
|
if FUpdating then
|
||||||
exit;
|
exit;
|
||||||
@ -350,13 +374,21 @@ begin
|
|||||||
begin
|
begin
|
||||||
SScript := TSimbaScript.Create;
|
SScript := TSimbaScript.Create;
|
||||||
SScript.LoadFromNode(Script);
|
SScript.LoadFromNode(Script);
|
||||||
FScripts.Add(SScript);
|
|
||||||
SScript.Dbg;
|
SScript.Dbg;
|
||||||
|
i := FindScriptByName(SScript.Name);
|
||||||
|
if (i = -1) then
|
||||||
|
FScripts.Add(SScript)
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
SScript.free;
|
||||||
|
TSimbaScript(FScripts[i]).LoadFromNode(Script);
|
||||||
|
end;
|
||||||
Script := Script.NextSibling;
|
Script := Script.NextSibling;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
XMLDoc.Free;
|
XMLDoc.Free;
|
||||||
FUpdating := false;
|
FUpdating := false;
|
||||||
|
MatchLocalOnline;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TScriptManager.LUpdate;
|
procedure TScriptManager.LUpdate;
|
||||||
@ -366,6 +398,7 @@ var
|
|||||||
Subs : TStringList;
|
Subs : TStringList;
|
||||||
Down : TDownloadThread;
|
Down : TDownloadThread;
|
||||||
SScript : TLSimbaScript;
|
SScript : TLSimbaScript;
|
||||||
|
I : integer;
|
||||||
begin
|
begin
|
||||||
if DirectoryExists(MainDir) = false then
|
if DirectoryExists(MainDir) = false then
|
||||||
exit;
|
exit;
|
||||||
@ -380,29 +413,28 @@ begin
|
|||||||
begin
|
begin
|
||||||
SScript := TLSimbaScript.Create;
|
SScript := TLSimbaScript.Create;
|
||||||
SScript.LoadFromName(Node.TextContent,maindir);
|
SScript.LoadFromName(Node.TextContent,maindir);
|
||||||
FLScripts.Add(SScript);
|
i := FindLScriptByName(SScript.Name);
|
||||||
SScript.Dbg;
|
SScript.Dbg;
|
||||||
|
if (i = -1) then
|
||||||
|
FLScripts.Add(SScript)
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
SScript.free;
|
||||||
|
TLSimbaScript(FLScripts[i]).LoadFromName(Node.TextContent,maindir);
|
||||||
|
end;
|
||||||
Script := Script.NextSibling;
|
Script := Script.NextSibling;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
XMLDoc.Free;
|
XMLDoc.Free;
|
||||||
end;
|
end;
|
||||||
|
MatchLocalOnline;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TScriptManager.NewVersion(Script: integer): boolean;
|
function TScriptManager.NewVersion(Script: integer): boolean;
|
||||||
var
|
|
||||||
Scrpt : TLSimbaScript;
|
|
||||||
I : integer;
|
|
||||||
begin
|
begin
|
||||||
Scrpt := TLSimbaScript(FLScripts[Script]);
|
MatchLocalOnline;
|
||||||
if Scrpt.OnlineScript = nil then
|
with TLSimbaScript(FLScripts[Script]) do
|
||||||
for i := 0 to ScriptCount-1 do
|
result := OnlineScript.Version <> Version;
|
||||||
if TSimbaScript(FScripts[i]).Name = Scrpt.Name then
|
|
||||||
begin
|
|
||||||
Scrpt.OnlineScript := TSimbaScript(FScripts[i]);
|
|
||||||
Break;
|
|
||||||
end;
|
|
||||||
result := Scrpt.OnlineScript.Version <> Scrpt.Version;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TScriptManager.InstallNewScript(Script: integer);
|
procedure TScriptManager.InstallNewScript(Script: integer);
|
||||||
@ -411,6 +443,9 @@ var
|
|||||||
LScrpt: TLSimbaScript;
|
LScrpt: TLSimbaScript;
|
||||||
Dir : string;
|
Dir : string;
|
||||||
begin
|
begin
|
||||||
|
if FUpdating then
|
||||||
|
exit;
|
||||||
|
FUpdating := true;
|
||||||
Scrpt := TSimbaScript(FScripts[Script]);
|
Scrpt := TSimbaScript(FScripts[Script]);
|
||||||
LScrpt := TLSimbaScript.create;
|
LScrpt := TLSimbaScript.create;
|
||||||
FLScripts.Add(LScrpt);
|
FLScripts.Add(LScrpt);
|
||||||
@ -421,17 +456,21 @@ begin
|
|||||||
Writeln('Directory already exists, yet continue?');
|
Writeln('Directory already exists, yet continue?');
|
||||||
if not CreateDir(Dir) then
|
if not CreateDir(Dir) then
|
||||||
Writeln('Failed to create dir..');
|
Writeln('Failed to create dir..');
|
||||||
UpdateScript(FLScripts.Count - 1);
|
UpdateScript(FLScripts.Count - 1,true);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TScriptManager.UpdateScript(Script: integer);
|
procedure TScriptManager.UpdateScript(Script: integer; ignoreupdating : boolean = false);
|
||||||
var
|
var
|
||||||
LScrpt : TLSimbaScript;
|
LScrpt : TLSimbaScript;
|
||||||
Scrpt : TSimbaScript;
|
Scrpt : TSimbaScript;
|
||||||
|
DownloadThread : TDownloadThread;
|
||||||
begin
|
begin
|
||||||
LScrpt := TLSimbaScript(FLScripts[Script]);
|
|
||||||
if not NewVersion(Script) then
|
if not NewVersion(Script) then
|
||||||
Exit;
|
Exit;
|
||||||
|
if FUpdating and not ignoreupdating then
|
||||||
|
exit;
|
||||||
|
FUpdating := true;
|
||||||
|
LScrpt := TLSimbaScript(FLScripts[Script]);
|
||||||
Scrpt := LScrpt.OnlineScript;
|
Scrpt := LScrpt.OnlineScript;
|
||||||
with LScrpt do
|
with LScrpt do
|
||||||
begin
|
begin
|
||||||
@ -444,6 +483,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
LScrpt.Save(MainDir); //Saves the setting file, now we only need to update the files
|
LScrpt.Save(MainDir); //Saves the setting file, now we only need to update the files
|
||||||
//Download files & write to folder
|
//Download files & write to folder
|
||||||
|
|
||||||
|
FUPdating := false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TScriptManager.LSave;
|
procedure TScriptManager.LSave;
|
||||||
@ -497,7 +538,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ TLSimbaScript }
|
{ TLSimbaScript }
|
||||||
|
|
||||||
procedure TLSimbaScript.LoadFromFile(const filename: string);
|
procedure TLSimbaScript.LoadFromFile(const filename: string);
|
||||||
var
|
var
|
||||||
XMLDoc : TXMLDocument;
|
XMLDoc : TXMLDocument;
|
||||||
@ -571,4 +611,3 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -30,8 +30,21 @@ class Color(object):
|
|||||||
"""
|
"""
|
||||||
self._mc = MC
|
self._mc = MC
|
||||||
self._cli = cli
|
self._cli = cli
|
||||||
self._initialiseDLLFuncs()
|
self._initialise_dll_funcs()
|
||||||
|
|
||||||
|
def get(self, pt):
|
||||||
|
"""
|
||||||
|
Gets color at pt[0], pt[1].
|
||||||
|
Yields integer.
|
||||||
|
"""
|
||||||
|
col = c_int(-1)
|
||||||
|
self._mc.dll.get_color(self._cli, pt[0], pt[1], byref(col))
|
||||||
|
if col is RESULT_OK:
|
||||||
|
return col
|
||||||
|
elif ret is RESULT_ERROR:
|
||||||
|
raise ColorException(self._mc.get_last_error())
|
||||||
|
return None
|
||||||
|
|
||||||
def find(self, box, color, tol = 0):
|
def find(self, box, color, tol = 0):
|
||||||
"""
|
"""
|
||||||
find a color in a box, with a specific tolerance.
|
find a color in a box, with a specific tolerance.
|
||||||
@ -53,7 +66,7 @@ class Color(object):
|
|||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def findAll(self, box, color, tol = 0):
|
def find_all(self, box, color, tol = 0):
|
||||||
"""
|
"""
|
||||||
find all colors in a box, with a specific tolerance.
|
find all colors in a box, with a specific tolerance.
|
||||||
returned are all the matching points
|
returned are all the matching points
|
||||||
@ -73,19 +86,173 @@ class Color(object):
|
|||||||
self._mc.free(ptr)
|
self._mc.free(ptr)
|
||||||
|
|
||||||
return l
|
return l
|
||||||
|
|
||||||
def _initialiseDLLFuncs(self):
|
def find_spiral(self, col, box, tol = 0):
|
||||||
|
"""
|
||||||
|
Find a color in a box, searching in the direction of a spiral, with a
|
||||||
|
specific tolerance.
|
||||||
|
Yields a tuple of x, y values of found color.
|
||||||
|
"""
|
||||||
|
x, y = (c_int(-1), c_int(-1))
|
||||||
|
if tol is 0:
|
||||||
|
ret = self._mc.dll.find_color_spiral(self._cli, byref(x), byref(y),
|
||||||
|
col, *box)
|
||||||
|
else:
|
||||||
|
ret = self._mc.dll.find_color_spiral_tolerance(self._cli, byref(x),
|
||||||
|
byref(y), col, *box,
|
||||||
|
tol)
|
||||||
|
if ret is RESULT_OK:
|
||||||
|
return (x, y)
|
||||||
|
elif ret is RESULT_ERROR:
|
||||||
|
raise ColorException(self._mc.get_last_error())
|
||||||
|
return None
|
||||||
|
|
||||||
|
def find_area(self, col, box, min_a, tol = 0):
|
||||||
|
"""
|
||||||
|
Finds a colored area in box with min area min_a with a specific
|
||||||
|
tolerance.
|
||||||
|
Yields a tuple of x, y values of found area.
|
||||||
|
"""
|
||||||
|
x, y = (c_int(-1), c_int(-1))
|
||||||
|
if tol is 0:
|
||||||
|
ret = self._mc.dll.find_colored_area(self._cli, byref(x), byref(y),
|
||||||
|
col, *box, min_a)
|
||||||
|
else:
|
||||||
|
ret = self._mc.dll.find_colored_area_tolerance(self._cli, byref(x),
|
||||||
|
byref(y), col, *box,
|
||||||
|
min_a, tol)
|
||||||
|
if ret is RESULT_OK:
|
||||||
|
return (x, y)
|
||||||
|
elif ret is RESULT_ERROR:
|
||||||
|
raise ColorException(self._mc.get_last_error())
|
||||||
|
return None
|
||||||
|
|
||||||
|
def count_color(self, count, col, box, tol = 0):
|
||||||
|
"""
|
||||||
|
Counts color col in box with tol.
|
||||||
|
Yields integer of count.
|
||||||
|
"""
|
||||||
|
count = 0
|
||||||
|
if tol is 0:
|
||||||
|
ret = self._mc.dll.count_color(self._cli, count, col, *box)
|
||||||
|
else:
|
||||||
|
ret = self._mc.dll.count_color_tolerance(self._cli, count, col,
|
||||||
|
*box, tol)
|
||||||
|
if ret is RESULT_OK:
|
||||||
|
return count
|
||||||
|
elif ret is RESULT_ERROR:
|
||||||
|
raise ColorException(self._mc.get_last_error())
|
||||||
|
return None
|
||||||
|
|
||||||
|
def similar_colors(self, col1, col2, tol = 0):
|
||||||
|
"""
|
||||||
|
Compares col1 and col2 with tol.
|
||||||
|
Yields boolean
|
||||||
|
"""
|
||||||
|
ret = self._mc.dll.similar_colors(col1, col2, tol)
|
||||||
|
if ret is RESULT_OK:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def set_tolerance_speed(self, ncts = 0):
|
||||||
|
"""
|
||||||
|
Sets CTS to ncts.
|
||||||
|
"""
|
||||||
|
self._mc.dll.set_tolerance_speed(self._cli, ncts)
|
||||||
|
|
||||||
|
def get_tolerance_speed(self):
|
||||||
|
"""
|
||||||
|
Gets CTS.
|
||||||
|
Yields CTS.
|
||||||
|
"""
|
||||||
|
self._mc.dll.get_tolerance_speed(self._cli, out_cts)
|
||||||
|
return out_cts
|
||||||
|
|
||||||
|
def set_tolerance_speed_2_modifiers(self, hue = 0, sat = 0):
|
||||||
|
"""
|
||||||
|
Sets CTS2 modifiers with hue, sat.
|
||||||
|
"""
|
||||||
|
self._mc.dll.set_tolerance_speed_2_modifiers(self._cli, hue, sat)
|
||||||
|
|
||||||
|
def get_tolerance_speed_2_modifiers(self):
|
||||||
|
"""
|
||||||
|
Gets CTS2 modifiers.
|
||||||
|
Yields tuple of hue and sat mods.
|
||||||
|
"""
|
||||||
|
self._mc.dll.get_tolerance_speed_2_modifiers(self._cli, h, s)
|
||||||
|
return (h, s)
|
||||||
|
|
||||||
|
def _initialise_dll_funcs(self):
|
||||||
self._mc.dll.find_color.restype = c_int
|
self._mc.dll.find_color.restype = c_int
|
||||||
self._mc.dll.find_color.argtypes = [c_ulong, PINTEGER, PINTEGER, c_int,
|
self._mc.dll.find_color.argtypes = [c_ulong, PINTEGER, PINTEGER, c_int,
|
||||||
c_int, c_int, c_int, c_int]
|
c_int, c_int, c_int, c_int]
|
||||||
|
|
||||||
self._mc.dll.find_color_tolerance.restype = c_int
|
self._mc.dll.find_color_tolerance.restype = c_int
|
||||||
self._mc.dll.find_color_tolerance.argtypes = [c_ulong, PINTEGER,
|
self._mc.dll.find_color_tolerance.argtypes = [c_ulong, PINTEGER,
|
||||||
PINTEGER, c_int, c_int, c_int, c_int, c_int, c_int]
|
PINTEGER, c_int, c_int,
|
||||||
|
c_int, c_int, c_int,
|
||||||
|
c_int]
|
||||||
|
|
||||||
self._mc.dll.find_colors.restype = c_int
|
self._mc.dll.find_colors.restype = c_int
|
||||||
self._mc.dll.find_colors.argtypes = [c_ulong, POINTER(PPOINT),
|
self._mc.dll.find_colors.argtypes = [c_ulong, POINTER(PPOINT),
|
||||||
POINTER(c_int), c_int, c_int, c_int, c_int, c_int]
|
POINTER(c_int), c_int, c_int,
|
||||||
|
c_int, c_int, c_int]
|
||||||
|
|
||||||
self._mc.dll.find_colors_tolerance.restype = c_int
|
self._mc.dll.find_colors_tolerance.restype = c_int
|
||||||
self._mc.dll.find_colors_tolerance.argtypes = [c_ulong,
|
self._mc.dll.find_colors_tolerance.argtypes = [c_ulong,
|
||||||
POINTER(PPOINT), POINTER(c_int), c_int, c_int,
|
POINTER(PPOINT),
|
||||||
c_int, c_int, c_int, c_int]
|
POINTER(c_int), c_int,
|
||||||
|
c_int, c_int, c_int,
|
||||||
|
c_int, c_int]
|
||||||
|
|
||||||
|
self._mc.dll.find_color_spiral.restype = c_int
|
||||||
|
self._mc.dll.find_color_spiral.argtypes = [c_ulong, PINTEGER, PINTEGER,
|
||||||
|
c_int, c_int, c_int, c_int,
|
||||||
|
c_int]
|
||||||
|
|
||||||
|
self._mc.dll.find_color_spiral_tolerance.restype = c_int
|
||||||
|
self._mc.dll.find_color_spiral_tolerance.argtypes = [c_ulong, PINTEGER,
|
||||||
|
PINTEGER, c_int,
|
||||||
|
c_int, c_int,
|
||||||
|
c_int, c_int,
|
||||||
|
c_int]
|
||||||
|
|
||||||
|
self._mc.dll.find_colored_area.restype = c_int
|
||||||
|
self._mc.dll.find_colored_area.argtypes = [c_ulong, PINTEGER, PINTEGER,
|
||||||
|
c_int, c_int, c_int, c_int,
|
||||||
|
c_int, c_int]
|
||||||
|
|
||||||
|
self._mc.dll.find_colored_area_tolerance.restype = c_int
|
||||||
|
self._mc.dll.find_colored_area_tolerance.argtypes = [c_ulong, PINTEGER,
|
||||||
|
PINTEGER, c_int,
|
||||||
|
c_int, c_int,
|
||||||
|
c_int, c_int,
|
||||||
|
c_int, c_int]
|
||||||
|
|
||||||
|
self._mc.dll.count_color.restype = c_int
|
||||||
|
self._mc.dll.count_color.argtypes = [c_ulong, PINTEGER, c_int, c_int,
|
||||||
|
c_int, c_int, c_int]
|
||||||
|
|
||||||
|
self._mc.dll.count_color_tolerance.restype = c_int
|
||||||
|
self._mc.dll.count_color_tolerance.argtypes = [c_ulong, PINTEGER,
|
||||||
|
c_int, c_int, c_int,
|
||||||
|
c_int, c_int, c_int]
|
||||||
|
|
||||||
|
self._mc.dll.similar_colors.restype = c_int
|
||||||
|
self._mc.dll.similar_colors.argtypes = [c_ulong, c_int, c_int, c_int]
|
||||||
|
|
||||||
|
self._mc.dll.set_tolerance_speed.restype = c_int
|
||||||
|
self._mc.dll.set_tolerance_speed.argtypes = [c_ulong, c_int]
|
||||||
|
|
||||||
|
self._mc.dll.get_tolerance_speed.restype = c_int
|
||||||
|
self._mc.dll.get_tolerance_speed.argtypes = [c_ulong, PINTEGER]
|
||||||
|
|
||||||
|
self._mc.dll.set_tolerance_speed_2_modifiers.restype = c_int
|
||||||
|
self._mc.dll.set_tolerance_speed_2_modifiers.argtypes = [c_ulong,
|
||||||
|
c_int, c_int]
|
||||||
|
|
||||||
|
self._mc.dll.get_tolerance_speed_2_modifiers.restype = c_int
|
||||||
|
self._mc.dll.get_tolerance_speed_2_modifiers.argtypes = [c_ulong,
|
||||||
|
PINTEGER,
|
||||||
|
PINTEGER]
|