From 6d3f938489891d8169881fff78d0f1307fcf3313 Mon Sep 17 00:00:00 2001 From: Merlijn Wajer Date: Sun, 27 Jun 2010 17:19:56 +0200 Subject: [PATCH 1/6] Change handbook URL --- Projects/Simba/simbaunit.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projects/Simba/simbaunit.pas b/Projects/Simba/simbaunit.pas index 249f236..9dd8af3 100644 --- a/Projects/Simba/simbaunit.pas +++ b/Projects/Simba/simbaunit.pas @@ -1964,7 +1964,7 @@ end; procedure TSimbaForm.MenuItemHandbookClick(Sender: TObject); begin - OpenURL('http://wizzup.org/static/simba/doc/ps_handbook/'); + OpenURL('http://wizzup.org/static/simbadoc/'); end; procedure TSimbaForm.MenuItemColourHistoryClick(Sender: TObject); From 868d2c0486ad6a9fb943f4b8bcd287e2018a4b1a Mon Sep 17 00:00:00 2001 From: Merlijn Wajer Date: Sun, 27 Jun 2010 17:25:45 +0200 Subject: [PATCH 2/6] Doc From phone in train. :) --- Doc/sphinx/referencescript.rst | 7 ++++++- Doc/sphinx/todo.rst | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Doc/sphinx/referencescript.rst b/Doc/sphinx/referencescript.rst index 6150f4b..0346f14 100644 --- a/Doc/sphinx/referencescript.rst +++ b/Doc/sphinx/referencescript.rst @@ -1,7 +1,12 @@ Scripting Reference =================== -Scripting Reference hoi +Covered in this section are the functions available when using Simba with the +default (Pascal) engine. + +.. note:: + + More chapters need to be written, see :ref:`todo` .. toctree:: diff --git a/Doc/sphinx/todo.rst b/Doc/sphinx/todo.rst index a6f6170..d8f84fe 100644 --- a/Doc/sphinx/todo.rst +++ b/Doc/sphinx/todo.rst @@ -13,7 +13,11 @@ Documentation TODO * write working with files for scriptreference (or any other chapter) It may be useful to check http://wizzup.org/simba/article/4 * Features -> Perhaps (interactive) images? - +* Scripting reference: + - Files + - Bitmaps + - DTM + - Internet * Expand "Troubleshooting" - And its subsection. From ce60d6239214d58a530da9f18932c95fd5921ca0 Mon Sep 17 00:00:00 2001 From: Merlijn Wajer Date: Sun, 27 Jun 2010 17:47:41 +0200 Subject: [PATCH 3/6] Colourfinding initial doc --- Doc/sphinx/referencescript.rst | 1 + Doc/sphinx/scriptref/colourfinding.rst | 56 ++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 Doc/sphinx/scriptref/colourfinding.rst diff --git a/Doc/sphinx/referencescript.rst b/Doc/sphinx/referencescript.rst index 0346f14..006bb49 100644 --- a/Doc/sphinx/referencescript.rst +++ b/Doc/sphinx/referencescript.rst @@ -11,4 +11,5 @@ default (Pascal) engine. .. toctree:: scriptref/mouseandkeyboard.rst + scriptref/colourfinding.rst scriptref/files.rst diff --git a/Doc/sphinx/scriptref/colourfinding.rst b/Doc/sphinx/scriptref/colourfinding.rst new file mode 100644 index 0000000..ad9484b --- /dev/null +++ b/Doc/sphinx/scriptref/colourfinding.rst @@ -0,0 +1,56 @@ +Colour Finding +============== + +Finding colours on the screen is quite simple. Simba offers methods like +``FindColor`` to locate colours on the screen. + +.. note:: + + Although the documentation uses follows the ``English`` spelling of + ``colour``; the code for compatibility sake uses ``color``, without the u. + +Colour Finding Methods +---------------------- + +A list of (not yet all) colour finding methods in Simba. + +FindColor +~~~~~~~~~ + +.. code-block:: pascal + + function FindColor(var x, y: Integer; col, x1, y1, x2, y2: Integer): + Boolean; + + +FindColor returns true if the exact colour given (col) is found in the box defined by x1, y1, x2, y2. +The point is returned in x and y. It searches from the top left to the bottom right and will stop +after matching a point. + +FindColorTolerance +~~~~~~~~~~~~~~~~~~ + +.. code-block:: pascal + + function FindColorTolerance(var x, y: Integer; col, x1, y1, x2, y2, tol: + Integer): Boolean; + +FindColorTolerance returns true if a colour within the given tolerance range +(tol) of the given colour (col) is found in the box defined by x1, y1, x2, y2. +Only the first point is returned in x and y. +Whether or not a colour is within the tolerance range is determined by the :ref:`CTS` mode. +It searches from the top left to the bottom right and will stop after matching a point. + + +FindColorsTolerance +~~~~~~~~~~~~~~~~~~~ + +.. code-block:: pascal + + function FindColorsTolerance( out pts: TPointArray; col, x1, y1, x2, y2, + tol: Integer): Boolean; + +FindColorsTolerance returns true if at least one point was found. A point is found if it is within the +given tolerance range (tol) of the given color (col) and inside the box defined by x1, y1, x2, y2. +Whether or not a color is within the tolerance range is determined by the CTS mode. +It searches from the top left to the bottom right and will find all matching points in the area. From b69097789f6921d43975ecdafe058cec8f8dd830 Mon Sep 17 00:00:00 2001 From: Merlijn Wajer Date: Sun, 27 Jun 2010 17:54:23 +0200 Subject: [PATCH 4/6] Fix spelling --- Doc/sphinx/scriptref/colourfinding.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/sphinx/scriptref/colourfinding.rst b/Doc/sphinx/scriptref/colourfinding.rst index ad9484b..3522e9d 100644 --- a/Doc/sphinx/scriptref/colourfinding.rst +++ b/Doc/sphinx/scriptref/colourfinding.rst @@ -6,7 +6,7 @@ Finding colours on the screen is quite simple. Simba offers methods like .. note:: - Although the documentation uses follows the ``English`` spelling of + Although the documentation uses the ``English`` spelling of ``colour``; the code for compatibility sake uses ``color``, without the u. Colour Finding Methods @@ -47,7 +47,7 @@ FindColorsTolerance .. code-block:: pascal - function FindColorsTolerance( out pts: TPointArray; col, x1, y1, x2, y2, + function FindColorsTolerance(var pts: TPointArray; col, x1, y1, x2, y2, tol: Integer): Boolean; FindColorsTolerance returns true if at least one point was found. A point is found if it is within the From 66d07009ef7da9303a055d549916756bcee72b83 Mon Sep 17 00:00:00 2001 From: Merlijn Wajer Date: Mon, 28 Jun 2010 00:20:35 +0200 Subject: [PATCH 5/6] Fix exporting --- Projects/MMLLib/libmml.lpr | 2 ++ Projects/MMLLib/pymml/mml.py | 62 +++++++++++++++++++----------------- 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/Projects/MMLLib/libmml.lpr b/Projects/MMLLib/libmml.lpr index e64938c..36fb1e3 100644 --- a/Projects/MMLLib/libmml.lpr +++ b/Projects/MMLLib/libmml.lpr @@ -193,6 +193,8 @@ exports { Finder } findColor, findColors, + findColorTolerance, + findColorsTolerance, { Mem Management } fpc_freemem_, diff --git a/Projects/MMLLib/pymml/mml.py b/Projects/MMLLib/pymml/mml.py index 238f258..7931cd9 100755 --- a/Projects/MMLLib/pymml/mml.py +++ b/Projects/MMLLib/pymml/mml.py @@ -26,34 +26,36 @@ class MMLCore(object): def __del__(self): del self.dll -DLL = MMLCore('../libmml.so') -c = Color(DLL) -ret = c.find((0, 0, 100, 100), 0) -print ret - -ret = c.findAll((0, 0, 100, 100), 0) -print ret - - -m = Mouse(DLL) - - -print m[(Mouse.Pos, Mouse.Left, Mouse.Right)] -m[(Mouse.Pos, Mouse.Right)] = ((300,300), True) -print m.getButtonStates() -sleep(0.5) -m.setPos((200,200)) - -sleep(2) - -# Reset all buttons.. -m[(Mouse.Left, Mouse.Right, Mouse.Middle)] = [False for x in range(3)] -for v in zip((Mouse.Left, Mouse.Right), m[(Mouse.Left, Mouse.Right)]): - print v -print m.getPos() - -if hasattr(ret,'__iter__'): - m.setPos(ret) - -del DLL +if __name__ == '__main__': + DLL = MMLCore('../libmml.so') + + c = Color(DLL) + ret = c.find((0, 0, 100, 100), 0) + print ret + + ret = c.findAll((0, 0, 100, 100), 0) + print ret + + + m = Mouse(DLL) + + + print m[(Mouse.Pos, Mouse.Left, Mouse.Right)] + m[(Mouse.Pos, Mouse.Right)] = ((300,300), True) + print m.getButtonStates() + sleep(0.5) + m.setPos((200,200)) + + sleep(2) + + # Reset all buttons.. + m[(Mouse.Left, Mouse.Right, Mouse.Middle)] = [False for x in range(3)] + for v in zip((Mouse.Left, Mouse.Right), m[(Mouse.Left, Mouse.Right)]): + print v + print m.getPos() + + if hasattr(ret,'__iter__'): + m.setPos(ret) + + del DLL From 594fa6a163664a27972361a62ae090f48a1a0c6a Mon Sep 17 00:00:00 2001 From: Merlijn Wajer Date: Mon, 28 Jun 2010 00:20:56 +0200 Subject: [PATCH 6/6] pymml example program used to control presentatins --- Projects/MMLLib/pymml/pres.py | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 Projects/MMLLib/pymml/pres.py diff --git a/Projects/MMLLib/pymml/pres.py b/Projects/MMLLib/pymml/pres.py new file mode 100755 index 0000000..99b2285 --- /dev/null +++ b/Projects/MMLLib/pymml/pres.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +from mml import MMLCore +from mmlmouse import Mouse +import sys +import time + +DLL = MMLCore('../libmml.so') + +m = Mouse(DLL) + +while True: + print 'Readline again' + cmd = sys.stdin.readline()[:-1].lower() + if cmd is '': + print 'Stopping...' + m[(Mouse.Left, Mouse.Right, Mouse.Middle)] = [False for x in range(3)] + for v in zip((Mouse.Left, Mouse.Right), m[(Mouse.Left, Mouse.Right)]): + print v + break + + print 'Doing:', cmd + + if cmd in ['left', 'l']: + m[Mouse.Left] = True + time.sleep(0.1) + m[Mouse.Left] = False + time.sleep(0.1) + elif cmd in ['right','r']: + m[Mouse.Right] = True + time.sleep(0.1) + m[Mouse.Right] = False + time.sleep(0.1) + + for v in zip((Mouse.Left, Mouse.Right), m[(Mouse.Left, Mouse.Right)]): + print v + + +del DLL