Function reference

Discussion in 'SytheLib' started by Sythe, Apr 30, 2017.

Function reference
  1. Unread #1 - Apr 30, 2017 at 12:25 AM
  2. Sythe
    Joined:
    Apr 21, 2005
    Posts:
    7,568
    Referrals:
    369
    Sythe Gold:
    3,867
    Dolan Duck Dolan Trump Supporting Business ???
    Poképedia
    Clefairy Jigglypuff
    Who did this to my freakin' car!
    Hell yeah boooi
    Rust Player Tier 3 Prizebox Toast Wallet User I'm LAAAAAAAME
    Mewtwo Mew Live Free or Die Poké Prizebox (42) Dat Boi

    Sythe Join our discord

    test

    Administrator Village Drunk

    Function reference

    (Saving this here for now, still working on it.)

    SytheLib functions:

    Assert(bool x, string line)
    Aborts the script if x is false and provides line as an error message.​
    BitmapToBackbuffer(int x1, int y1, int bmpID, int op)
    Probably a function you will never use. This dumps a bitmap into the backbuffer at the x,y coordinates specified. It can be used for removing noise from the backbuffer by dumping a mask over the noise if you have a sensitive algorithm. op is one of four values: 0 - copy, 1 - bitwise and, 2 - bitwise or, 3 - xor​
    BitmapToString(int bmpID)
    Dumps a bitmap to a sythelib bitmap string.​
    CalculateMinimapAlignment(int& alignmentscore, int mapcenterx, int mapcentery, int radius, int wallcolour, int coltolerance, int deftolerance)
    As with CalculateMinimapMovement() this function analyses a game minimap. Provide the wallcolour and colour tolerance (10-20 usually) and deformation tolerance (0 or 1 usually) and this function will populate alignmentscore with a number indicating how 'aligned' the minimap map is based on right-angle structures in the minimap. The return value is s direction score which tries to guess which way you should rotate the map to align it better. -1 counter clockwise +1 closewise. Call this function in a loop attempting to maximize alignment score to align your minimap.​
    CalculateMinimapMovement(int& dx, int& dy, int& dr, int mapcenterx, int mapcentery, int radius, const int pointcount, int rottolerance, int coltolerance, int deformtolerance, int maxdistance)
    One of the most complicated but most useful functions for game scripting. This function is re-entrant, expecting to be called in a loop. This function tracks a set of pixels on a minimap (and therefore expects to be called many times a second) and returns the relative movement of the map through dx,dy and the relative rotation of the map through dr. mapcenterx, mapcentery should specify the center of your target application/game's minimap. radius should specify the number of pixels wide the map is. pointcount specifies how many points around the radius the function should watch. The larger this number is the slower the function is but the more accurate it is generally speaking. 32 is a good first guess. rottolerance, coltolerance refer to the amount of rotation of the minimap the function will ignore (set this to 0 or 1 usually), and the amount of colour variance the function will ignore (10-20 is a good bet). deformationtolerance is as defined in other functions, 0 or 1 is a good bet. maxdistance refers to the maximum number of pixels away to look for the pixels that the function is tracking. this number will be larger if you call it less frequently. 1 to 3 is fine for frequent calling.​
    CharAt(unsigned int num, string haystack)
    Returns the character at the specified zero indexed position in the haystack​
    ClickMouse(int x, int y, int button)
    If virtual inputs are on then a series of window message is sent to the target window simulating first the movement of the cursor from its pervious location to the location specified by x,y, then a mouse click. button 1 = left, 2 right, 3 middle.​
    ClickMouseRandomArea(int x1, int y1, int x2, int y2, int button)
    Moves the mouse to a random location within the specified region. Clicks randomly within the region. See ClickMouse.​
    Contains(string needle, string haystack)
    String helper function that finds a string in another string. True is returned iff the string is found.​
    Contains(int& loc, string needle, string haystack)
    String helper function that finds a string in another string. The zero-indexed location is populated into loc. True is returned iff the string is found.​
    CreateRotatedBitmap(int bmpID, float angle)
    Creates a new bitmap from an existing bitmap, except rotated by angle degrees. CAUTION this creates a new bitmap. There is no way to remove bitmaps from a running sythelib script at time of writing. This will produce a memory leak if run in an infinite loop.​
    DestroyBitmap(int bmpid)
    If you have allocated a temporary bitmap that you don't want to reside in memory anymore you can deallocate it with this function.​
    Die(string message)
    Identical to PHP's die() function. Exits with a non-zero return code and the error message specified.​
    Distance(int x1, int y1, int x2, int y2)
    Returns the Pythagorean distance between the two specified pixel locations.​
    DoubleClickMouse(int x, int y, int button)
    Sends a double click window message if virtual inputs are enabled. Otherwise sends two single clicks using the mouse hardware buffer. You'll probably only use this for native windows applications.​
    DumpBackBuffer()
    For debugging. Dumps the entire backbuffer onto your monitor at 0,0. This function will be removed after alpha testing.
    DumpBackBuffer(int x1, int y1, int x2, int y2)
    For debugging. Dumps the region specified of the backbuffer onto your monitor at 0,0. This function will be removed after alpha testing.
    DumpBackBufferToBitmapString(RECT* region)
    Dumps the region of the back buffer specified by the RECT to a sythelib string which is returned.​
    DumpBackBufferToBitmapString()
    Dumps the entire back buffer to a sythelib string which is returned.​
    DumpWindowStructure()
    Dump the inner window structure to stdout.​
    Exit(int x)
    End the script with a return value x.​
    ForceOversizedBackBuffer(int width, int height)
    This function is for advanced users seeking to manipulate bitmaps in a scratch space. This function will force sythelib to unallocate its current backbuffer and allocate a new one of the specified size. Note that the newly allocated buffer is not zeroed by default, you may wish to use EraseBackBuffer() to zero it. Running Scrape() will cause the oversized buffer to be deallocated and replaced with a correctly sized buffer.​
    FindBitmap(int &ox, int &oy, int bmpID, int colorTolerance, int deformationTolerance)
    Same as FindColor but for a bitmap. deformationTolerance is the number of pixels away from the expected location any given pixel can be. 0 or 1 are the typical values.​
    FindBitmap(int &ox, int &oy, int bmpID, int colorTolerance, int deformationTolerance, bool after)
    Re-entrant overload of FindBitmap. after specifies that the search should continue at ox,oy in the region of the window.​
    FindBitmap(int &ox, int &oy, int bmpID, int colorTolerance, int deformationTolerance, int percentmatch, bool after)
    Variant of FindBitmap. percentmatch allows you to specify a number between 0 and 100 indicating the percentage of pixels that must match for the function to return. after allows re-entrant behaviour.​
    FindBitmap(int &ox, int &oy, int bmpID, int colorTolerance, int deformationTolerance, int percentmatch, bool after, bool closest)
    Variant of FindBitmap. See above. closest flag indicates that in addition to meeting the minimum percentage specified you also would like the closest match available in the target window. This function is reasonably slow for obvious reasons.​
    FindBitmap(int &ox, int &oy, int bmpID, int x1, int y1, int x2, int y2, int colorTolerance, int deformationTolerance)
    Variant of FindBitmap. See other definitions of FindBitmap. Specify a region to search.​
    FindBitmap(int &ox, int &oy, int bmpID, int x1, int y1, int x2, int y2, int colorTolerance, int deformationTolerance, bool after)
    Variant of FindBitmap. See other definitions of FindBitmap for parameters/details.​
    FindBitmap(int &ox, int &oy, int bmpID, int x1, int y1, int x2, int y2, int colorTolerance, int deformationTolerance, int percentmatch, bool after)
    Variant of FindBitmap. See other definitions of FindBitmap for parameters/details.​
    FindBitmap(int &ox, int &oy, int bmpID, int x1, int y1, int x2, int y2, int colorTolerance, int deformationTolerance, int percentmatchint, bool after, bool closest)
    Variant of FindBitmap. See other definitions of FindBitmap for parameters/details.​
    FindBitmapSpiral(int &x, int &y, int bmpID, int colorTolerance, int deformationTolerance)
    Same as FindColorSpiral but for a bitmap. deformationTolerance is the number of pixels away from the expected location any given pixel can be. 0 or 1 are the typical values.​
    FindBitmapSpiral(int &ox, int &oy, int bmpID, int x1, int y1, int x2, int y2, int colorTolerance, int deformationTolerance)
    Overload of FindBitmapSpiral with region specification.​
    FindColor(int &rx, int &ry, int colour, int colorTolerance)
    Find a colour searching left to right top to bottom. colorTolerance is the Pythagorean distance between colour channels. Returns true if it finds a pixel. Populates rx,ry with the pixel's location relative to top left of the target window.​
    FindColor(int &rx, int &ry, int colour, int x1, int y1, int x2, int y2, int colorTolerance)
    Overload for FindColor with region setting.​
    FindColorSpiral(int &x, int &y, int colour, int colorTolerance, bool after, int excluderadius)
    Similar to FindColor except searches in a square spiral pattern starting in the center of the window. excluderadius is an exclusion zone around the center point that is not searched. (This can be zero.) The after flag will resume a search at the point in the spiral specified by rx,ry. (This is a stateless re-entrant property which lets you effectively check a pixel is the one you want then move on to the next one if its not.)​
    FindColorSpiral(int &rx, int &ry, int colour, int x1, int y1, int x2, int y2, int colorTolerance, bool after, int excluderadius)
    Overload for FindColorSpiral but you set a region inside the target window. The search will begin from the center of that region.​
    FindTextUsingFont(int&ox, int&oy, int fontID, string text, int x1, int y1, int x2, int y2, int minSpace, int maxSpace, int colorTolerance, int deformationTolerance)
    Overloaded function to provide a search region relative to top left of target window. See the other FindTextUsingFont().​
    FindTextUsingFont(int&ox, int&oy, int fontID, string text, int minSpace, int maxSpace, int colorTolerance, int deformationTolerance)
    Searches the entire target window for a specified string constructed using the font specified by fontID. See OCRUsingFont() for most parameters.​
    FocusGameWindow()
    Issues the appropriate windows messages to call the target window to the foreground. WM_SETFOCUS, WM_ACTIVATE, WM_NCACTIVATE.​
    GetAncestorWindowHWND()
    Returns the window handle to the top level parent window of the target window. For example if you are working with a Java application and you have selected an inner window, this will still return the handle to the top level window.​
    GetBitmapHeight(int bitmapID)
    Returns the height in pixels of a bitmap that was loaded previously.​
    GetBitmapWidth(int bitmapID)
    Returns the width in pixels of a bitmap that was loaded previously.​
    GetColor(int x, int y)
    Returns the pixel colour at the specified location on the target window. Remember this is still reading from the back buffer so if you don't Scrape() it first you won't get anything.​
    GetFontHeight(int fontID)
    Returns the number of pixels high the font is. Useful for finding the next line of text.​
    GetGameDims(int& width, int& height)
    Easier version of GetWidth() GetHeight(). Populates the provided parameters with the target window's width and height.​
    GetGameRect(RECT&)
    Populates the provided RECT struct with the target window's location on the logical desktop.​
    GetGameTitle()
    Returns the title of the target window.​
    GetHeight()
    Returns the height of the target window's drawing surface as an int.​
    GetInnerWindowClassNameByHWND(unsigned long hwnd)
    Returns the classname of an inner window specified by window handle. You may want to use this in conjunction with NextInnerWindowsIterator/ResetInnerWindowsIterator when automating native windows applications. If the window does not exist returns empty string.​
    GetInnerWindowDims(unsigned long hwnd, int& x, int& y, int& width, int& height)
    Retrieves dimensions of an inner window relative to the x,y of your currently selected (inner) window. If the window exists returns true and populates the supplied variables.​
    GetInnerWindowFromPoint(int x, int y)
    Returns the HWND of the inner window at the point x,y relative to top left of currently selected inner window, or ancestor window if no inner window selected.​
    GetInnerWindowFromAncestorPoint(int x, int y)
    Returns the HWND of the inner window at the point x,y relative to top left of ancestor window.​
    GetInnerWindowTextByHWND(unsigned long hwnd)
    Same as GetInnerWindowClassNameByHWND but if the inner window is a simple native control containing text, like a button or a static text field then it will return that text. If no inner window is found for the specified hwnd it returns the empty string.​
    GetLastMouseX()
    Returns the last mouse x coordinate (that was set by sythelib).​
    GetLastMouseY()
    Returns the last mouse y coordinate (that was set by sythelib).​
    GetPolyPoint(int &rx, int &ry, int color, int x1, int y1, int x2, int y2, int colorTolerance, int gapTolerance, int margin)
    Finds a closed loop of pixels such as the outline of an object according to a specific color within a defined region and returns a random x,y coordinate inside that closed loop. gapTolerance allows the loop to be broken in places by as many pixels as gapTolerance is set to. Warning setting this higher than 2 will be quite slow. margin is the closest to the border of the loop that a returned value is allowed to be. If you always want the exact center of the loop set margin high e.g. 200. For colorTolerance it's recommended to use a high but not too high value for example 50.​

    GetWidth()
    Returns the width of the target window's drawing surface as an int.​
    GetWindowHWND()
    Returns the currently selected target window handle as an unsigned long.​
    IsColor(int c1, int c2, int tolerance)
    Given two colours c1, c2, and a maximum Pythagorean colour channel distance between them (tolerance) are they closer than that maximum distance?​
    IsInnerWindow(unsigned long hwnd)
    Returns true if the specified hwnd is an inner window of the currently selected inner window, or ancestor window if no inner window is currently selected.​
    Join(string glue, vector haystack)
    Joins all strings in haystack together with glue between and returns the new string.​
    KeyDown(int scancode)
    See KeyUp()​
    KeyUp(int scancode)
    If virtual inputs is on this will send a window message to the target window that the specified scancode has been held down. If virtual inputs is off then this will populate the keyboard buffer with the scancode.​
    Length(string)
    Returns the length of the string.​
    Length(vector)
    Returns the length of the array/vector.​
    LoadBitmapFromFile(string filename, int transparentColor, bool ismask)
    See LoadBitmapFromString() but loads from a file in the current working directory.​
    LoadBitmapFromString(string bitmapString, int transparentColor, bool ismask)
    Bitmaps can be compressed into strings using BitmapToString and other functions. These can then be included in scripts using LoadBitmapFromString. Provide the bitmap string and the transparent colour if there is one. isMask sets a property that says you're more interested in the shape of the bitmap than the colours in it. This is used in some routines. If you don't know what this means leave it as false.​
    LoadFontFromBitmap(int bmpID, string characters, int transparentColor)
    Given a bitmapid and a set of characters in that bitmap starting from left to right and a transparent background colour of that bitmap this will load a font that has been stored as a long single line bitmap.​
    MouseButtonDown(int x, int y, int button)
    Simulates a mouse button being pushed down at the target coordinates in the target window. Use MouseButtonUp(...) to release the button. Button 1 = left, button 2 = right, button 3 = middle.​
    MouseButtonUp(int x, int y, int button)
    See MouseButtonDown()​
    MoveMouse(int x, int y)
    If virtual inputs are on, this will send a window message to the target window informing it that the mouse has moved. This is done in a window standard way unless SetJavaVirtualInputsOn() has been executed... in which case it will do it in a way that Oracle Java expects.​
    NextInnerWindowsIterator()
    Used in conjunction with ResetInnerWindowsIterator() this function will return a window handle (HWND/unsigned long) to an inner window below the currently selected inner window (or ancestor window if no inner window is currently selected.) Each time this function is called it will return the next inner window in the list. Note that this does not search grand children only direct children of the currently selected inner window. This function will return the empty string when there are no remaining children to return. ResetInnerWindowsIterator() resets the iterator to the start of the inner window list.​
    OCR(int x1, int y1, int x2, int y2)
    WARNING THIS IS SLOW. Search the specified region of the target window for any text that tesseract OCR would be able to read and return it. There dozens of parameters that can be tweaked with tesseract OCR but those will be exposed in a future version of SytheLib.​
    OCRUsingFont(int&ox, int&oy, int fontID, int x1, int y1, int x2, int y2, int minSpace, int maxSpace, int colorTolerance, int deformationTolerance)
    Performs a raster based OCR using a specified font ID (see LoadFontFromBitmap()). ox,oy are where the OCR'd text was located. x1,y1,x2,y2 are search region information. These are relative to top left of the target window. minSpace is the minimum number of pixels between characters the OCR algorithm will tolerate. maxSpace is the maximum. I suggest setting the min to 0 and the max to 10 for most uses. colorTolerance defines how much the text can vary in colour from pixel to pixel. This is a Pythagorean colour channel distance as normal. deformationTolerance is a count of how far out of position a pixel can be. This should be 0 or 1 most of the time. Returns the OCR'd text as a string. Warning: the text will not contain spaces even if the screen text did.​
    PopBack(vector haystack)
    Pops the last element from a vector and returns it.​
    PushBack(string needle, vector haystack)
    Pushes needle onto the end of haystack​
    PromptForDouble(string x)
    Prompts the script user. Prints the string x to them then returns anything they enter in the console window, converted to a double. Loops with an error until the user provides a valid double.​
    PromptForInt(string x)
    Prompts the script user. Prints the string x to them then returns anything they enter in the console window, converted to an int. Loops with an error until the user provides a valid int.​
    PromptForString(string x)
    Prompts the script user. Prints the string x to them then returns anything they enter in the console window.​
    RandomFloat()
    Returns a random float between 0 and 1. ​
    RandomFloat(double rmin, double rmax)
    Returns a random float between rmin and rmax inclusive. ​
    RandomInt(int rmin, int rmax)
    Returns an integer between rmin and rmax. For historical compatibility this function is [rmin, rmax) i.e. inclusive at the rmin end and exclusive of rmax.​
    Ready()
    Returns true if the target window is set and hasn't been closed.​
    RegexReplaceAll(string needle, string replacement, string haystack)
    Same as ReplaceAll, except needle is a regular expression. Replacement can use $1,$2 etc. backreference.​
    RegexMatchAll(string needle, string haystack)
    Return a vector/array of matches of regex needle in haystack.​
    RegexMatchFirst(string needle, string haystack)
    Return the first regular expression match of needle in haystack.​
    RegexMatchLast(string needle, string haystack)
    Return the last regular expression match of needle in haystack.​
    RegexMatchNth(int nth, string needle, string haystack)
    Return the nth regular expression match of needle in haystack.​
    RegexSplit(string needle, string haystack)
    Splits the given haystack using needle as a delimiter into a vector of strings.​
    RemoveSpace(string str)
    Returns a string with no space characters in it. Can be useful for OCR purposes.​
    Replace(string needle, string replacement, string haystack)
    Alias of ReplaceAll.​
    ReplaceAll(string needle, string replacement, string haystack)
    Returns a string that has all the needles replaced with replacement from the haystack.​
    ReplaceFirst(string needle, string replacement, string haystack)
    Returns a string that has the first needle replaced with replacement from the haystack.​
    ReplaceLast(string needle, string replacement, string haystack)
    Returns a string that has the last needle replaced with replacement from the haystack.​
    ReplaceNth(int number, string needle, string replacement, string haystack)
    Returns a string that has the nth needle replaced with replacement from the haystack.​
    ResetInnerWindowsIterator()
    See NextInnerWindowsIterator()​
    SaveBitmapToFile(int bitmapid, string filename)
    Save a bitmap from a bitmap id into a filename. Filenames are always in the working directory of the script. Only filenames conforming to [a-zA-Z0-9\.\-\_]+ are accepted. This function is useful if you want to take a screenshot. However keep in mind in the early versions of SytheLib there is no way to remove a bitmap once it is given a bitmap id. This can lead to memory leaks if you are using this for screenshots for example.​
    Scrape()
    Screen scrape the entire target window and record the pixels into the back buffer.​
    Scrape(int x1, int y1, int x2, int y2)
    Screen scrape the specified region of the target window. x,y are relative to the top left of the target window.​
    ScrapeRect(int x, int y, int w, int h)
    Screen scrapes the target window specified region. x,y are relative to top left of the target window.​
    SelectInnerWindow(string classname)
    Some applications may have layered windowing. If you want to programmatically drill down into an inner window you can use this. For example in Java it is generally a good idea to do the following: while(SelectInnerWindow("SunAwtCanvas")){}​
    SelectInnerWindowByHWND(HWND h)
    Set the inner window if you already know its HWND. You might want to use this in conjunction with SetWindowByHWND() if you are working with multiple windows. GetWindowByHWND() retrieves the currently selected inner window's HWND. GetAncestorWindowByHWND() retrieves the currently selected ancestor window.​
    SelectInnerWindowExact(string classname)
    This version of the SelectInnerWindow function matches an exact class name exactly one layer below the currently selected inner window (or ancestor window if no inner window is currently selected.)​
    SelectInnerWindowFromAncestorPoint(int x, int y)
    Drills down through the inner windows until it finds the inner-most window at the specified point relative to the top-left of the ancestor window.​
    SelectInnerWindowFromPoint(int x, int y)
    Drills down through the inner windows until it finds the inner-most window at the specified point relative to the top-left of the currently selected inner window.​
    SelectInnerWindowRegex(string classnameregex)
    Same as SelectInnerWindow() except you can use a regular expression.​
    SendAltKey(char c)
    Used to send a WM_COMMAND message to the window. Useful for some native menu shortcuts.​
    SendKeys(string s)
    If you have virtual inputs on (which is by default) this function will send window messages that imitate key strokes into the target window. If you have virtual inputs off then this will fill the actual keyboard buffer. (Be careful.)​
    SetColor(int x, int y, int color)
    (Not recommended for production scripts, slow) Obtains a device handle for the monitor and paints a pixel relative to the top left of the target window. This needs to be done in a loop to prevent other refresh routines from drawing over the painted pixel. This function is usually used for debugging.​
    SetGDICaptureOff()
    See SetGDICaptureOn()​
    SetGDICaptureOn()
    The default screen scraper for SytheLib uses the Windows Desktop Duplication API. This API is generally preferred for modern applications because it supports all rendering modes including Direct X and Open GL. However if you are looking to screen scrape when the target window is hidden you will likely need to change the scrape mode to GDI. This function does that.​
    SetHumanMouseModeOff()
    Turns off human-like curves in mouse move and click routines.​
    SetHumanMouseModeOn()
    Turns on human-like curves in mouse move and click routines.​
    SetVirtualInputsOff()
    Virtual Inputs simulate the windows messages to produce inputs in the target window. This is enabled by default however will not work in all (or perhaps even most) modern applications. Use this function to revert to direct mouse and keyboard capture (warning: this will control your actual cursor and write to your keyboard buffer.) See SetVirtualMouseJavaModeOn() if you are working with java, and try that first before reverting to non-virtual inputs.​
    SetVirtualInputsOn()
    See SetVirtualInputsOff(). You may need to use this if you have to turn virtual inputs off as part of a subroutine for some reason.​
    SetVirtualMouseJavaModeOff()
    See SetVirtualMouseJavaModeOn()​
    SetVirtualMouseJavaModeOn()
    There is (by my account at least) an error in the way the windows implementation of the Oracle Java Virtual Machine reads window messages with respect to mouse movements and clicks. Turn on this function if your target application is a Java application. It modifies the way the parameters of the window messages are passed into a format the JVM likes.​
    SetVirtualMouseWFPModeOff()
    See SetVirtualMouseWFPModeOn()​
    SetVirtualMouseWFPModeOn()
    This stands for window-from-point mode. It is a virtual mouse mode that is incompatible with SetVirtualMouseJavaModeOn(). In this mode SytheLib will attempt to drill down to the bottom most inner window below the target point of a mouse movement or click and attempt to send window messages directly to that inner most window. For some native windows applications such as mspaint this works very well. For other applications it may cause problems. Occasionally you may need to turn it on and off periodically inside your script depending on the task.​
    SetWindow(string title)
    Alias of SetWindowByTitle()​
    SetWindowByHWND(unsigned long hwnd)
    If you already know the window handle you can pass it to this function to avoid doing a window search.​
    SetWindowByTitle(string title)
    See SetWindowByTitleAndClassRegex()​
    SetWindowByTitleAndClassRegex(string titleregex, string classregex)
    Find a window according to title or class. Regexs do not need to match the whole title/class (can be partial matched.)
    e.g. SetWindowByTitleAndClassRegex(".* - Paint", "");​
    SetWindowByTitleRegex(string title)
    See SetWindowByTitleAndClassRegex()​
    SetWmPrintOff()
    See SetWmPrintOn()​
    SetWmPrintOn()
    Can be used in conjunction with SetGDICaptureOn() for applications that will only render in response to a WM_PRINT message. Warning this causes flickering. In most cases you only need to use SetGDICaptureOn().​
    ShowBitmapPicker()
    Opens the bitmap chooser. This is a utility that follows your cursor and allows you to drag-drop over a section of the target application's window. It will return the bitmap as a string.
    ShowBitmapPicker(int scale)
    See ShowBitmapPicker(). Scale parameter allows the user to specify the zoom they would like.​
    ShowBitmapPicker(int& x, int& y)
    See ShowBitmapPicker. x,y parameters collect the location that the bitmap was collected from.​
    ShowBitmapPicker(int& x, int&y, int scale)
    See other ShowBitmapPicker entries.​
    ShowColorPicker()
    Opens the colour chooser. This is a utility that follows the user's cursor around the screen until they pick a single pixel. Returns selected pixel colour as unsigned long.
    ShowColorPicker(int& x, int& y)
    See ShowColorPicker(). x,y collect position information.​
    ShowGameWindow(bool maximized)
    This function calls the ShowWindow API with either SW_SHOW or SW_SHOWMAXIMIZED depending on if maximized is true. In other words this will ensure the target application is on the screen either maximized or at its normal size, and not minimized.​
    ShowInnerWindowPicker()
    Opens the colour chooser however this has been modified now to print to stdout the structure of the inner window hierarchy under the cursor. This can be useful for debugging drill down (SelectInnerWindow) requirements for virtual mouse. Returns the classname of the inner window under the mouse when a button is clicked.​
    Sleep(int milliseconds)
    Halts execution for a specified number of milliseconds.​
    SubString(int offset, int length, string haystack)
    Returns the substring at zero indexed position offset in haystack of length length.​
    Time()
    Returns UNIX timestamp (number of seconds since midnight on 1st Jan 1970)​
    Microtime()
    Returns the number of microseconds since midnight on 1st Jan 1970​
    ToLower(string text)
    Converts and returns text to lower case.​
    ToUpper(string text)
    Converts and returns text to upper case.​
    UnselectInnerWindow()
    Forgets the currently selected inner window and reverts to the ancestor (top level) window.​
    use(script_filename)
    Include and run another sythelib file from the same directory​
    Wait()
    Helper function. Sleeps 200 milliseconds then scrapes the entire target window. Useful for making quick and dirty scripts.​


    Networking functions (warning these are still buggy and haven't been finalized).
    StartTCPImageListen(string ip, int port, string password)
    Warning this feature is still buggy. This will start a thread that listens on the specified port for an incoming http request containing the password. (I.e. GET /password.) It will then dump back as a png a copy of the current backbuffer.​
    StartTCPListen(string ip, int port, string password)
    This will start a thread that listens on the specified IP and port. It will prompt via JSON how to provide the correct password. Once a client is connected to this ip/port no other clients will be able to connect until the client has disconnected. This works much the same as a telephone. If a second connection is attempted while the first is currently engaged the second connectee will receive a message telling them the program is busy.​
    StopTCPListen(int port)
    Removes a listening port.​
    WriteTCPListen(int port, string out)
    Write some data/text/content to a port. This is ideally a port that has already been Listened on and currently has a connected client.​
    ReadTCPListen(int port)
    Reads data/text/content from a port. Ideally one that currently has a client connected which has sent some data. Returns the empty string if no data is available.​
    IsTCPListenClientConnected(int port)
    Checks if a client is currently connected on a port.​
    DisconnectTCPClient(int port)
    Disconnects the client if they are connected to the specified port.​
    GetTCPListenClientID(int port)
    Returns a number representing the client ID. This should be different for each individual connection. The same connectee calling back a second time will receive a different client ID. Returns 0 if no client is connected to the port.​


    Math functions. Look these up in any c++ reference:
    abs(n)
    acos(n)
    acosh(h)
    asin(n)
    asinh(n)
    atan(n)
    atan2(n, p)
    atanh(n)
    cbrt(n)
    cos(n)
    cosh(n)
    exp(n)
    log(n)
    pow(n,p)
    sin(n)
    sinh(n)
    sqrt(n)
    tan(n)
    tanh(n)
     
    ^ Fast Coins, Time To Buy, Shin and 3 others like this.
    Last edited: Oct 27, 2018
  3. Unread #2 - Apr 30, 2017 at 4:18 AM
  4. Syed
    Joined:
    Jan 22, 2009
    Posts:
    9,826
    Referrals:
    1
    Sythe Gold:
    3
    Location:
    USA
    Sythe Awards 2012 Winner Gohan has AIDS (3) ??? Rust Player I'm LAAAAAAAME (2) Shitting Rainbow (2)

    Syed Hero
    Retired Sectional Moderator $50 USD Donor New

    Function reference

    ty
     
  5. Unread #3 - Apr 30, 2017 at 4:21 AM
  6. b1b
    Joined:
    Apr 15, 2007
    Posts:
    1,906
    Referrals:
    1
    Sythe Gold:
    27
    Location:
    vibrating on the...
    M
    Rust Player Christmas 2018 Toast Wallet User I'm LAAAAAAAME ???

    b1b Guru

    Function reference

    can't wait to get my claws on this one
     
    ^ Astro likes this.
  7. Unread #4 - Apr 30, 2017 at 7:56 AM
  8. Sythe
    Joined:
    Apr 21, 2005
    Posts:
    7,568
    Referrals:
    369
    Sythe Gold:
    3,867
    Dolan Duck Dolan Trump Supporting Business ???
    Poképedia
    Clefairy Jigglypuff
    Who did this to my freakin' car!
    Hell yeah boooi
    Rust Player Tier 3 Prizebox Toast Wallet User I'm LAAAAAAAME
    Mewtwo Mew Live Free or Die Poké Prizebox (42) Dat Boi

    Sythe Join our discord

    test

    Administrator Village Drunk

    Function reference

    Ok now you actually have to write something :p
     
    ^ Minted and b1b like this.
  9. Unread #5 - Feb 22, 2018 at 10:27 AM
  10. Bot on my Box
    Joined:
    Apr 27, 2016
    Posts:
    430
    Referrals:
    0
    Sythe Gold:
    486

    Bot on my Box Forum Addict
    $50 USD Donor New

    Function reference

    Could you add a `FindColor()` that returns x/y coords of the first pixel that was truthy?
     
  11. Unread #6 - Feb 22, 2018 at 11:52 AM
  12. Fast Coins
    Joined:
    Mar 22, 2017
    Posts:
    1,046
    Referrals:
    1
    Sythe Gold:
    1,147

    Fast Coins Guru
    $5 USD Donor New

    Function reference

    What is a truthy pixel?
     
  13. Unread #7 - Feb 22, 2018 at 1:26 PM
  14. Program
    Joined:
    Sep 17, 2015
    Posts:
    5,100
    Referrals:
    0
    Sythe Gold:
    631
    Occupation:
    Web Developer

    Program Formerly known as Andy Samberg
    Technical Core Games Moderators Market Moderators Runescape Moderators

    Function reference

    Ah the famed truthy pixel.

    I think he wants a findcolor that gives you the first pixel coordinates that matches the given color, which is what it already does :p
     
  15. Unread #8 - Feb 22, 2018 at 9:41 PM
  16. Bot on my Box
    Joined:
    Apr 27, 2016
    Posts:
    430
    Referrals:
    0
    Sythe Gold:
    486

    Bot on my Box Forum Addict
    $50 USD Donor New

    Function reference

    After looking at the function reference again this morning, I see now that the first two args are vars that will be mutated with the x/y values. Strange pattern, but it'll do.
     
    ^ Program likes this.
  17. Unread #9 - Feb 22, 2018 at 11:02 PM
  18. Program
    Joined:
    Sep 17, 2015
    Posts:
    5,100
    Referrals:
    0
    Sythe Gold:
    631
    Occupation:
    Web Developer

    Program Formerly known as Andy Samberg
    Technical Core Games Moderators Market Moderators Runescape Moderators

    Function reference

    Getting coordinates by returned reference value is the standard throughout the library. Keep an eye out for it if you ever wonder.
     
  19. Unread #10 - Oct 13, 2018 at 9:41 PM
  20. Sythe
    Joined:
    Apr 21, 2005
    Posts:
    7,568
    Referrals:
    369
    Sythe Gold:
    3,867
    Dolan Duck Dolan Trump Supporting Business ???
    Poképedia
    Clefairy Jigglypuff
    Who did this to my freakin' car!
    Hell yeah boooi
    Rust Player Tier 3 Prizebox Toast Wallet User I'm LAAAAAAAME
    Mewtwo Mew Live Free or Die Poké Prizebox (42) Dat Boi

    Sythe Join our discord

    test

    Administrator Village Drunk

    Function reference

    Updated the reference to include:
    use
    Time()
    Microtime()
     
    ^ ExoGold, Fast Coins and Program like this.
  21. Unread #11 - Apr 20, 2019 at 10:13 PM
  22. Root_
    Joined:
    Jun 20, 2017
    Posts:
    185
    Referrals:
    0
    Sythe Gold:
    198

    Root_ Active Member

    Function reference

    Quick Question - Does the FindBitmap support transparency?
     
  23. Unread #12 - Apr 25, 2019 at 12:38 AM
  24. Sythe
    Joined:
    Apr 21, 2005
    Posts:
    7,568
    Referrals:
    369
    Sythe Gold:
    3,867
    Dolan Duck Dolan Trump Supporting Business ???
    Poképedia
    Clefairy Jigglypuff
    Who did this to my freakin' car!
    Hell yeah boooi
    Rust Player Tier 3 Prizebox Toast Wallet User I'm LAAAAAAAME
    Mewtwo Mew Live Free or Die Poké Prizebox (42) Dat Boi

    Sythe Join our discord

    test

    Administrator Village Drunk

    Function reference

    Yes
    Just specify the bitmap's transparent colour when you load it

    LoadBitmapFromFile(string filename, int transparentColor, bool ismask)
    See LoadBitmapFromString() but loads from a file in the current working directory.
    LoadBitmapFromString(string bitmapString, int transparentColor, bool ismask)
     
  25. Unread #13 - Apr 25, 2019 at 11:43 AM
  26. Root_
    Joined:
    Jun 20, 2017
    Posts:
    185
    Referrals:
    0
    Sythe Gold:
    198

    Root_ Active Member

    Function reference

    Awesome, I'm gonna start playing with a little project that could use this - i'll make a thread here in a few days when I got some time.
     
    ^ Sythe likes this.
< WinSiphon - Tool for getting window handles | Run multiple SytheLibs without using your Mouse! >

Users viewing this thread
1 guest