The format in which the CoyoteScript commands and events are documented include a lot of information about the nature of the parameters of the command or event. Various characters are used in and around parameters to indicate their properties.
These characters should not be included in your script and are only used in the documentation.
[ ] | Square Brackets: the parameter is required |
( ) | Parentheses: the parameter is optional
NOTE: for multiple optional parameters: if you want to use a parameter that comes after an optional parameter, that optional parameter and any other optional parameters before it will have to be included. In commands, it is possible to specify literal ‘default’ to use the default value for a parameter |
< > | Angled Brackets: the text indicating the parameter is non-literal. In other words, this parameter should be replaced with your input rather than using what is provided |
/ | Slash: used to indicate that the options provided in the documentation are interchangeable and that only one should be picked |
IMPORTANT: Text provided without brackets around it are literal options that can be used as written.
- TIP: If you are new to scripting languages, think of the syntax like it’s a recipe, but you need to provide the ingredients!
To demonstrate, let’s create a command using the following syntax for a click command:
click (left/right/middle) (<x>,<y>) (up/down/stroke) (<duration>)
“click” is the name of the command, and has to be written at the start of the command line to indicate which command we are using.
click
“(left/right/middle)” is surrounded by parentheses “( )” which means that this parameter is optional and can be left out, but let’s use it anyway. left, right, and middle
are 3 literal options (indicated by the slash “/”), so we must choose one of these command options exactly as written. Now our command will look like:
click right
“(<x>,<y>)” is made up of two syntax elements. On the outside, there are parentheses, indicating the parameter is optional. The angled brackets “< >” indicate a non-literal option, meaning the contents must be replaced with our input.
click right 512,814
“(up/down/stroke)” is another group of literal options to choose from. Let’s choose “stroke” for our command:
click right 512,814 stroke
“(<duration>)” The <duration> must be replaced with your own input. Let’s choose “0.025”:
click right 512,814 stroke 0.025
Our command is now complete! Executing this command will right-click at screen coordinates 512*814
In Summary:
The syntax: click (left/right/middle) (<x>,<y>) (up/down/stroke) (<duration>)
resulted in our command: click right 512,814 stroke 0.025