All known PLC commands in No Time


For more information and documentation see the bottom of this page

No Time exclusive commands

writelines "test.eee", 1, "testing"

Miniscript commands

Numbers

All numbers are stored in full-precision format. Numbers also represent true (1) and false (0). Operators:

Strings

Text is stored in strings of Unicode characters. Write strings by surrounding them with quotes. If you need to include a quotation mark in the string, type it twice.

print "OK, ""Bob""."

Operators:

text = "Hello"
print text[0] //prints H
text = "Hello"
print text[0:2] //prints He

Conditional commands

if condition then
    do something
else if othercondition then // else if
    do something else
else                        // else
    do something else
end if

Conditionals are checks to see if a certain condition is true or false. If the condition is true, the code inside the if statement will run. If the condition is false, the code inside the else statement will run. example:

if 1 == 1 then
    print("1 is equal to 1")
else if 1 == 2 then
    print("1 is equal to 2")
else
    print("1 is not equal to 1 or 2")
end if

you can use and, or and not in if statements loops:

if i == 1 or i == 2 then
    print i     //prints 1 and 2
end if

Function commands

functionname = function
    print "do something"
end function
functionname //will print: do something

Create a function with function(), including parameters with optional default values. Assign the result to a variable. Invoke by using that variable. Use @ to reference a function without invoking.

triple = function(n=1)
 return n*3
end function
print triple // 3
print triple(5) // 15
f = @triple
print f(5) // also 15

Return

return

Return something. This is useful for functions, as it will return a value. Or nothing will be returned if nothing is specified.

test = function
    variable = 2
    return variable // returns 2
end function

Loops

for loop

for numbervariable in range(startnumber, end number, (optional) steps to take)
    print number
end for

A for loop loops through numbers in a range. The first number is the start number, the second number is the end number, and the third number is the steps to take. The steps to take is optional, and if not specified, it will default to 1. example:

for i in range(1, 10)
    print i         //prints numbers 1 through 10
end for

while loop

while condition
    print "do something"
end while

A while loop loops through code while a condition is true. The condition is checked before the code is run, and if the condition is false, the code will not run. example:

canwrite = true
while canwrite
    print "writing"
    canwrite = false // set it back to false so it doesn't loop forever
end while

Break

break

Break out of a loop.

Continue

continue

Continue a loop from another point.


Math commands

Addition

print 1 + 1 //prints 2

Subtraction

print 1 - 1 //prints 0

Multiplication

print 2 * 2 //prints 4

Division

print 4 / 2 //prints 2

Variable commands

Set variable

variable = value
print variable

Add to variable

variable += value

Subtract from variable

variable -= value

Multiply variable

variable *= value

Divide variable

variable /= value

Other commands

Print

print "text"

Prints text to the console.

Wait

wait 1

Waits for a certain amount of seconds.

Random

print random(1, 10)

Prints a random number between 1 and 10.

Yield

yield

Yields the script. This is useful for scripts that take a long time to run, as it will allow other scripts to run. Not useful for scripts in No Time.

Exit

exit

Comment

//comment

A comment is a line of code that is not run. It is useful for explaining what a line of code does.

Sign

sign(-98) //prints -1

Returns the sign of a number. If the number is positive, it will return 1. If the number is negative, it will return -1. If the number is 0, it will return 0.

Clear

clear

Clears the console.


List

list = [1, 2, 3, 4, 5]

A list is a collection of values. The values can be accessed by their index. The first value is index 0, the second value is index 1, and so on. you can access it like this:

list[3] //prints 4 because 1 = index 0, 2 = index 1, 3 = index 2, 4 = index 3

Map

map = {"key": "value", "key2": "value2"}

A map is a collection of key value pairs. The values can be accessed by their key. you can access it like this:

map["key"] //prints value because key is the key for value

Both a list and a map are accessable with forloops:

list = [1, 2, 3, 4, 5]
for i in range(1, 5)
    print list[i] //prints values 1 through 5
end for
map = {"key": "value", "key2": "value2"}
for key in map
    print map[key] //prints value and value2
end for

you can also put functions in a list or a map by doing:

list = [@function, @function2]
for i in range(1, 2)
    list[i]() //runs the function
end for

working example:

day = function
	print getday()
end function
month = function
	print getmonth()
end function
year = function
	print getyear()
end function

functions = [@day, @month, @year]

for i in functions.indexes
	functions[i]() // prints current day, month, year
	breakline
end for

Go to another directory

cd "Item_HoloDisk(Clone)" // the directory of the HVD chips when they are inside the PLC
cd "FPSController" // the directory of the PLC

For more info check out: