1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-28 03:52:23 -05:00

Merge branch 'master' of git://villavu.com/simba

This commit is contained in:
Raymond 2010-12-12 11:51:11 +01:00
commit 7a4537aa45
27 changed files with 306 additions and 88 deletions

View File

@ -1,8 +1,9 @@
Updater in Simba
================
A notice should appear in the Simba GUI, or you can alternatively
use Tools -> Update.
Don't forget to restart Simba when it has been updated!
As soon as there is an update for Simba, an extra icon will appear in the icon
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
version.
Alternatively you can use Tools -> Update to update.

View File

@ -1,10 +1,13 @@
Not Well Known Features
=======================
Simba has several features that are relatively unknown.
A few will be listed here.
Timestamped Writeln
-------------------
Simba can timestamp all your *writeln* calls.
Simba can timestamp all your debug.
.. code-block:: pascal

View File

@ -2,4 +2,4 @@ Simba Script Manager
====================
Community-created scripts will be available for download from the
Script Manager.
Script Manager. The script manager will appear in release 1.0.

View File

@ -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
yourself as well.
Setting up SRL 5 with Simba
---------------------------
This will follow later, upon SRL 5 release. (Which will be quite soon)
Installing scripts
------------------

View 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.

View File

@ -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
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.
.. note::
@ -20,3 +24,4 @@ The MML is split up in "Core" classes and "Addon" classes.
mmlref/finder.rst
mmlref/bitmap.rst
mmlref/ocr.rst
mmlref/libmml

View File

@ -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
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?

View File

@ -2,3 +2,5 @@ Tutorial
=================
Complete tutorial.
.. What should be in here in the first place?

View File

@ -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
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
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
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
tersely in one line, and the exact changes can be viewed with "commitdiff".
A list of new features since 750 will show up here eventually.

View File

@ -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
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
~~~~
@ -91,5 +95,5 @@ Well Documented
~~~~~~~~~~~~~~~
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.

BIN
Fonts/XPChars/32.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 B

BIN
Fonts/XPChars/44.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 B

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 B

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 B

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 B

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 B

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 B

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 B

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 B

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 B

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 B

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 B

After

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 342 B

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 390 B

After

Width:  |  Height:  |  Size: 314 B

View File

@ -1,6 +1,6 @@
{
This file is part of the Simba Project
Copyright (c) 2009 by Raymond van Venetië and Merlijn Wajer
This file is part of the Simba Project
Copyright (c) 2009 by Raymond van Venetië and Merlijn Wajer
Simba is free software: you can redistribute it and/or modify
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
along with MML. If not, see <http://www.gnu.org/licenses/>.
See the file COPYING, included in this distribution,
for details about the copyright.
See the file COPYING, included in this distribution,
for details about the copyright.
Script Manager for the Simba project.
}
@ -45,10 +45,13 @@ type
TSimbaScript = class(TObject)
private
function IsInstalled: boolean;
procedure LoadFromNode( Script : TDOMNode);
public
Name, Version, Author, Description: String;
Tags, Files: TStringList;
LocalScript : TSimbaScript;
property Installed : boolean read IsInstalled;
procedure Dbg;
constructor Create;
destructor Destroy; override;
@ -76,10 +79,13 @@ type
FLScripts: TList; //Array of the local scripts
FVersion : String;
FUpdating : boolean;
function FindScriptByName(name : string) : Integer;
function FindLScriptByName(name : string) : Integer;
function GetLScriptCount: integer;
function GetMainDir: string;
function GetScript(index : integer): TSimbaScript;
function GetScriptCount: integer;
procedure MatchLocalOnline;
public
property MainDir : string read GetMainDir write FMaindir;
property SimbaScript[index : integer] : TSimbaScript read GetScript;
@ -87,7 +93,7 @@ type
procedure LUpdate; //Loads the local scripts, uses MainDir
function NewVersion(Script : integer) : boolean; //Checks for updates for Script
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
property LScriptCount : integer read GetLScriptCount; //LScript = Local Script = Installed Script
property ScriptCount : integer read GetScriptCount; //Online script
@ -128,34 +134,6 @@ uses
{$R *.lfm}
{ 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);
begin
Mng := TScriptManager.Create;
@ -171,10 +149,11 @@ begin
begin
Memo1.Clear;
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('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;
@ -221,6 +200,11 @@ end;
{ TSimbaScript }
function TSimbaScript.IsInstalled: boolean;
begin
Result := (LocalScript <> nil);
end;
procedure TSimbaScript.LoadFromNode(Script: TDOMNode);
function NodeContents(ItemStr : string; node : TDOMNode) : string;
var
@ -268,6 +252,7 @@ begin
Writeln(' Author: ' + Author);
Writeln(' Version: ' + Version);
Writeln(' Description: ' + Description);
Writeln(' Installed: '+ BoolToStr(Installed,true));
Writeln(' Tags:');
for i := 0 to Tags.Count - 1 do
Writeln(' ' + Tags[i]);
@ -279,7 +264,6 @@ end;
constructor TSimbaScript.Create;
begin
inherited;
{stuff here}
end;
@ -296,6 +280,26 @@ end;
{ 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;
begin
result := FLScripts.Count;
@ -316,6 +320,25 @@ begin
result := FScripts.Count;
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;
var
XMLFile : string;
@ -325,6 +348,7 @@ var
Subs : TStringList;
Down : TDownloadThread;
SScript : TSimbaScript;
I : integer;
begin
if FUpdating then
exit;
@ -350,13 +374,21 @@ begin
begin
SScript := TSimbaScript.Create;
SScript.LoadFromNode(Script);
FScripts.Add(SScript);
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;
end;
end;
XMLDoc.Free;
FUpdating := false;
MatchLocalOnline;
end;
procedure TScriptManager.LUpdate;
@ -366,6 +398,7 @@ var
Subs : TStringList;
Down : TDownloadThread;
SScript : TLSimbaScript;
I : integer;
begin
if DirectoryExists(MainDir) = false then
exit;
@ -380,29 +413,28 @@ begin
begin
SScript := TLSimbaScript.Create;
SScript.LoadFromName(Node.TextContent,maindir);
FLScripts.Add(SScript);
i := FindLScriptByName(SScript.Name);
SScript.Dbg;
if (i = -1) then
FLScripts.Add(SScript)
else
begin
SScript.free;
TLSimbaScript(FLScripts[i]).LoadFromName(Node.TextContent,maindir);
end;
Script := Script.NextSibling;
end;
end;
XMLDoc.Free;
end;
MatchLocalOnline;
end;
function TScriptManager.NewVersion(Script: integer): boolean;
var
Scrpt : TLSimbaScript;
I : integer;
begin
Scrpt := TLSimbaScript(FLScripts[Script]);
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;
result := Scrpt.OnlineScript.Version <> Scrpt.Version;
MatchLocalOnline;
with TLSimbaScript(FLScripts[Script]) do
result := OnlineScript.Version <> Version;
end;
procedure TScriptManager.InstallNewScript(Script: integer);
@ -411,6 +443,9 @@ var
LScrpt: TLSimbaScript;
Dir : string;
begin
if FUpdating then
exit;
FUpdating := true;
Scrpt := TSimbaScript(FScripts[Script]);
LScrpt := TLSimbaScript.create;
FLScripts.Add(LScrpt);
@ -421,17 +456,21 @@ begin
Writeln('Directory already exists, yet continue?');
if not CreateDir(Dir) then
Writeln('Failed to create dir..');
UpdateScript(FLScripts.Count - 1);
UpdateScript(FLScripts.Count - 1,true);
end;
procedure TScriptManager.UpdateScript(Script: integer);
procedure TScriptManager.UpdateScript(Script: integer; ignoreupdating : boolean = false);
var
LScrpt : TLSimbaScript;
Scrpt : TSimbaScript;
DownloadThread : TDownloadThread;
begin
LScrpt := TLSimbaScript(FLScripts[Script]);
if not NewVersion(Script) then
Exit;
if FUpdating and not ignoreupdating then
exit;
FUpdating := true;
LScrpt := TLSimbaScript(FLScripts[Script]);
Scrpt := LScrpt.OnlineScript;
with LScrpt do
begin
@ -444,6 +483,8 @@ begin
end;
LScrpt.Save(MainDir); //Saves the setting file, now we only need to update the files
//Download files & write to folder
FUPdating := false;
end;
procedure TScriptManager.LSave;
@ -497,7 +538,6 @@ begin
end;
{ TLSimbaScript }
procedure TLSimbaScript.LoadFromFile(const filename: string);
var
XMLDoc : TXMLDocument;
@ -571,4 +611,3 @@ begin
end;
end.

View File

@ -30,7 +30,20 @@ class Color(object):
"""
self._mc = MC
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):
"""
@ -53,7 +66,7 @@ class Color(object):
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.
returned are all the matching points
@ -74,18 +87,172 @@ class Color(object):
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.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.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.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.argtypes = [c_ulong,
POINTER(PPOINT), POINTER(c_int), c_int, c_int,
c_int, c_int, c_int, c_int]
POINTER(PPOINT),
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]