AQUA Script


  • Intro

    Hello all!

    With the AQUA 1.3, a huge feature was introduced. A programming language (AQUA Script) and a text editor. On this page, I will be teaching you to make your very own programs in AQUA Script!

    DISCLAIMER: AQUA Script is not yet a full programming language, and thus is very limited. Same with the editor. They are both in early versions and have not much been tested or at all for that matter.

 

  • Structure

    The AQUA Script has a simple structure. You only need to know a few components. The rest is just knowing tricks and memorizing commands.

    Each line can start with as many tabs / spaces / newlines as you want. All lines are composed of arguments and are terminated by a semicolon. Arguments are separated by as many spaces as you want.

    The first argument is the command, and the others give a “description” of the command (example: sleep 5; “sleep” is the command, and “5” is the amount of seconds the computer will wait).

    If you want to include spaces in your argument, then you have to specify the beginning and the end of it with quotes (example: print “Hello world!”; “Hello” and “world!” are stuck together when written in the log. If I didn’t put any quotes, it would only write “Hello” and ignore the “world!”). These are called groups. If you want to insert a newline, do \n. For a tab, \t, for a semicolon, \c, for a quote, \” and for a backslash, \\.

    Arguments can also be stored. To store an argument, do “new $name is argument;”. They can be called in a command with the “$name“. This will replace the”$argument_name” with what is inside (example: new $arg is “Hello world”; print $arg; ). The argument can be a number, in which case you can do maths on it. These are called variables.

    That’s all you need to know for the structure.

  • Commands

    Here is a list of all the commands and what they do. When explaining the syntax, [] means optional stuff, <> is the variable argument and () is a comment. If you are searching for a specific command, type Ctrl+F.

  • new (or var)

    Makes a new variable. The syntax is “new (or var) $<variable_name> is (can also be =) [information on the variable];

  • if (or ?)

    Compares two values. The syntax is “if (or ?) <a> <comparator> <b> <another command that is executed if the comparing of a and b is successful>;“. Here are the different comparators = (or ==) means a is equal to b, ! (or !=) means a is not equal to b, <= means a is less or equal to b, >= means a is greater or equal to b, < means a is less than b and > means a is greater than b.

  • if-string (or ?-string or if-str or ?-str)

    Same as if, just that is compares strings (groups) instead of numbers. Also only has the = (or ==) and ! (or !=) comparators.

  • graphics

    All the graphical commands syntax.

    • graphics init → initialize the graphics
    • graphics wash (or fill) <red> <green> <blue>; → fill the entire screen with a certain colour (defined by the RGB values).
    • graphics rect <x> <y> <width> <height> <red> <green> <blue>; → draw a rectangle on the screen.
    • graphics line <x1> <y1> <x2> <y2> <red> <green> <blue> → draw a line from position (x1; y1) to position (x2; y2).
    • graphics text (or locate or print) <text> <x> <y> <red> <green> <blue> → draws text on the screen.
    • graphics width $<variable name> → set the value of the given variable to the width of the screen.
    • graphics height $<variable name> → does the same as with “graphics width” but with the height instead.
  • event

    All the event (user inputs) commands, like hitting a key on the keyboard or the position of the mouse.

    • event key (or key-down or key-press) $<variable name> → polls the keyboard and sets the variable’s value to the id of the last key pressed.
    • event key-up (or key-release) $<variable name> → polls the keyboard and sets the variable’s value to the id of the lased key released.
    • event key-map $<variable name> → converts the id of the key in the variable to a character.
    • event mouse-down (or mouse-press) $<variable name> → sets the variable to the button of the mouse last pressed (0 for none, 1 for left, 2 for middle and 3 for right).
    • event mouse-click (or mouse-up or mouse-released) $<variable name> → sets the variable to the button of the mouse last released (0 for none, 1 for left, 2 for middle and 3 for right).
    • event mouse-x $<variable name> → sets the variable to the x coordinate of the mouse cursor on the screen.
    • event mouse-y $<variable name> → sets the variable to the y coordinate of the mouse cursor on the screen.
  • do

    Does a mathematical operation on two values and puts the result into a variable. The syntax is “do <value 1> <operation> <value 2> is $<result>;“. Here are all the operations. + means plus, – means minus, * means times, / means divided, % (or mod) means modulo, << (or left) means left shift, >> (or right) means right shift, or (or |) means or, and (or &) means and, xor (or ^) means exclusive or.

  • || (or abs)

    Replaces the variable with it’s absolute value. The syntax is “|| (or abs) $<variable>;”.

  • ++

    Adds one to the variable. The syntax is “++ $<variable>;”.

  • Subtracts one to the variable. The syntax is “– $<variable>;”.

  • put (or =)

    Sets the value of a variable. The syntax is “put (or =) <value> to (or ->) $<variable>;”.

  • type (or trans)

    Transforms the variable from integer to string or from string to integer. The syntax is “type (or trans) $<variable> to (or ->) integer (or int or string or str);”.

  • print (or log)

    Writes string or variable to log. The syntax is “print (or log) $<variable> (or <argument / argument group>) [as] [int] (or integer or str or string);“.

  • sleep

    Waits for a certain amount of seconds. The syntax is “sleep <seconds>;”. Note that this command does not count the seconds starting from when it was called, but from the last second recorded by the CMOS chip.

  • time

    Sets the value of the given variable to the time. The syntax is “time $<variable>;”.

  • rand (or random)

    Sets the value of the given variable to a pseudo random number between two values. The syntax is “rand (or random) <min> <max> [to] (or ->) $<variable>;”.

  • exit (or stop)

    Stops the program. The syntax is “exit (or stop);”.

  • run (or exec or goto)

    Go to a command and continue running the program from there. The syntax is “run (or exec or goto) <command number>;“. Note that this is the command number and NOT the line number. Start from zero.

  • open

    Opens any application currently on the system. The syntax is “open <application name>;”.

  • read

    Pauses the program and reads what the user types in. The program resumes once the user has hit the enter key. The syntax is “read $<variable name>;”.

Hello world!


Welcome to WordPress.com. After you read this, you should delete and write your own post, with a new title above. Or hit Add New on the left (of the admin dashboard) to start a fresh post.

Here are some suggestions for your first post.

  1. You can find new ideas for what to blog about by reading the Daily Post.
  2. Add PressThis to your browser. It creates a new blog post for you about any interesting  page you read on the web.
  3. Make some changes to this page, and then hit preview on the right. You can always preview any post or edit it before you share it to the world.