-
Notifications
You must be signed in to change notification settings - Fork 89
ScriptBase Class
ScriptBase class provides functionalities for scripting and an entry-point for PS4 Macro
public abstract class ScriptBase
These are the frequently used basic methods that will help you get started with scripting quickly. They can be chained together for convenience.
public ScriptBase Press(DualShockState state, int delay = DEFAULT_PRESS_BUTTONS_DELAY)
Press/hold button combinations for the specified amount of time.
public ScriptBase SetButtons(DualShockState state)
Set buttons manually.
public ScriptBase ClearButtons()
Reset buttons manually.
public ScriptBase Sleep(int timeout, int checkInterval = DEFAULT_SLEEP_CHECK_INTERVAL)
Wait and block execution for an amount of time.
public ScriptBase Suspend(int delay)
Disable Update() for an amount of time.
public ScriptBase PlayMacro(List<DualShockState> sequence, int suspendDelay = 0)
public ScriptBase PlayMacro(string path, int suspendDelay = 0)
Play a macro.
public ScriptBase StopMacro()
Stop the playing macro.
These are methods for advanced scripting.
public Bitmap CaptureFrame()
Take a screenshot of PS4 Remote Play as Bitmap.
public Bitmap CropFrame(Bitmap frame, Rectangle rect)
public Bitmap CropFrame(Rectangle rect)
Crop a Bitmap image.
public int GetPixel(Bitmap frame, int x, int y)
public int GetPixel(int x, int y)
Get a pixel color from an image. Returns color as int (eg. WHITE = 0xFFFFFF = 16777215).
public bool MatchTemplate(Bitmap frame, int x, int y, int color, int tolerance = DEFAULT_PIXEL_TOLERANCE)
public bool MatchTemplate(int x, int y, int color, int tolerance = DEFAULT_PIXEL_TOLERANCE)
public bool MatchTemplate(Bitmap frame, PixelMap pixel, int tolerance = DEFAULT_PIXEL_TOLERANCE)
public bool MatchTemplate(PixelMap pixel, int tolerance = DEFAULT_PIXEL_TOLERANCE)
Match a pixel template within an image. Tolerance is how much difference in the RGB space are allowed between the source and the template. For example, 0xFFFFFF (R: 255, G: 255, B: 255) vs 0xFEFFFE (R: 254, G: 255, B: 254) has a difference of 2, so a tolerance of 2 or more will pass the match test.
public bool MatchTemplate(Bitmap frame, Rectangle rect, ulong targetHash, double similarity = DEFAULT_RECT_TOLERANCE)
public bool MatchTemplate(Rectangle rect, ulong targetHash, double similarity = DEFAULT_RECT_TOLERANCE)
public bool MatchTemplate(Bitmap frame, RectMap rect, double similarity = DEFAULT_RECT_TOLERANCE)
public bool MatchTemplate(RectMap rect, double similarity = DEFAULT_RECT_TOLERANCE)
Match a rectangle template within an image using Perceptual Hash. Similarity is a scale from 0.00% to 100.00%.