Skip to content
Abbin44 edited this page Oct 28, 2021 · 1 revision

Rails Scripting Language

At the bottom of the page you can find an image of a simple script that utilizes most of the functions available at the moment, it may come in handy as a reference!

Basic structure of the code

The file extension must be .rls and the first line of the file must be [SCRIPT], otherwise it will not execute. If a line contains [END] the script will exit at that line. All lines are scanned for keywords, variable names, and more and if nothing is matched, it is assumed the line contains a command from CMD++.

The character # is used as a comment and cannot be used anywhere else. The interpreter will remove any text after it.

Variables

At the moment there is only one variable type which is NUM. It is a floating-point variable that can be used as an integer or a float without any extra work. Simply use a . when you need decimal numbers.

NUM number = 1
NUM decimal = 1.5

Variables can change values in a few different ways shown below:

number = 5
number = 5 * 5 / 2
number = number + 5
number++
number--

Misc Statements

Currently, the only misc statement is print, it will print all the text after it to the terminal. You can also use it to print the value of a NUM variable by typing print number.value.

print Printing Debug!

Labels and Goto:s

The label a is defined on the first line of this code block, and the goto is defined on the last, very simple. The scenario here would create an infinite loop.

 label a:
   #Do stuff here
   #Do even more stuff here
 goto a:

If Statements

If statements are written as follows:

In the first line of the code, there may be two parts that are unfamiliar, CheckInput and ?. CheckInput is basically a variable name for the if statement, it is used to pair the correct if statement to the correct endif statement. The ? char is only a separator, everything on the right side of it is the actual statement to be checked. Finally, the endif statement consists of two parts, the endif, and the variable name.

if CheckInput ? input < 6
   ls
   cd ..

endif CheckInput

alt text

Clone this wiki locally