Command Types
Our ducky friends have two different kinds of commands: Simple Commands, and Block Commands.
Simple Commands
Our webbed walkers refer to any command that doesn't require a trailing code block to work (regardless of whether it has arguments) as a "Simple Command", among these are every command from Rubber Ducky 1.0 and the Flipper Commands.
With that said, however, our drifting-down keepers have added a bit of extended syntax to help you.
Command Grouping
To help cut down on repeating yourself we've taught the ducks to recognize indentation after a command, all you have to do is write the arguments like so:
- STRING
- STRINGLN
- VAR
DucklingScript
STRING
Hello World!
I enjoy DucklingScript!
Compiles into:
STRING Hello World!
STRING I enjoy DucklingScript!
DucklingScript
STRINGLN
Hello,
pond,
I am a duck!
Compiles into:
STRINGLN Hello,
STRINGLN pond,
STRINGLN I am a duck!
DucklingScript
VAR
a 10
b 30
c "quack"
Compiles into:
VAR a 10
VAR b 30
VAR c "quack"
With this new feature though, adding indents to indents might scare the feathers off our floating friends, which may be a problem for use cases like having our ducks write code for you. No worries though because our water warriors thought of this and so if you want to use indents just throw in some triple quotation like this:
STRINGLN
"""
print("Starting Hacking Software...")
for i in range(10):
print(f"Hacking your pc in {i} second(s)")
if i < 4:
print("This is your final warning!")
"""
Dollar Sign Operator
To save time our ducks don't evaluate many commands by default which is usually not a problem, but if you need them to take a closer look for you preceeding the command with a dollar sign ($
) will turn the whole thing into an expression which will be evaluated.
This means our ducks can recognize mathematical expressions, concatenation, variables, and more in your commands; if you're still not sure what that means for you feel free to check it out!
Our ducks encourage using the dollar sign operator, but would like to note that since it evaluates everything, string
(s) should be encased in quatations like so: "Hello Pond".
Examples
- Math
- String Concatenation
- Variable
DucklingScript
$CTRL 1+1
Compiled
CTRL 2
DucklingScript
$STRING "Hello " + "world!"
Compiled
STRING Hello world!
DucklingScript
VAR duck_food "birdseed"
VAR human_food "bread"
$STRINGLN "Feed ducks " + duck_food + ", not " + human_food + "!"
Compiled
STRINGLN Feed ducks birdseed, not bread!
Block Commands
Along with these our wiggly waddlers have also added a brand new type of command! These are commands that have arguments and are followed by a code block, we call them "Block Commands" and as of writing, they are exclusive to DucklingScript!
Example
- Repeat
DucklingScript:
REM This is the Block Command!
REPEAT 3
REM And this is the code block!
STRING waddle
STRING quack
Compiled
STRING waddle
STRING quack
STRING waddle
STRING quack
STRING waddle
STRING quack
*More quacking on REPEAT
here.