Guide to NTSL2++

From Aurora Information Uplink
Revision as of 20:52, 14 November 2020 by Karolis2011 (talk | contribs) (Added width and heigth)
Jump to navigation Jump to search

Sample scripts

Runtime reference

NTSL2++ is based on ancient language called javascript, reference to all it's functionalities can be obtained from here

Term library

Function Description
Term.setForeground(r, g, b) Sets the text color to (r, g, b). Scaled from 0 - 1.
Term.getForeground() Returns the text color.
Term.setBackground(r, g, b) Sets the background color to (r, g, b). Scaled from 0 - 1.
Term.getBackground() Returns the background color.
Term.cursorX Property representing current X position. Left is 0.
Term.cursorY Property representing current Y position. Top is 0.
Term.setCursor(x, y) Sets the cursor to the position x, y. The top left is 0, 0. This is same as setting Term.cursorX and Term.cursorY directly.
Term.getCursor() Returns the cursor's position. This is same as reading Term.cursorX and Term.cursorY directly.
Term.getSize() Gets the size of the terminal.
Term.width Gets width of the terminal. Read only property.
Term.height Gets height of the terminal. Read only property.
Term.clear() Clears the screen with the preset background color.
Term.print(value) Writes contents of value to terminal and appends new line.
Term.write(value) Writes contents of value to terminal.
Term.write(value, callback) Writes contents of value to terminal and makes it clickable, when click is invoked callback is called.
Term.write(value, prompt, callback) Writes contents of value to terminal and makes it clickable, when click is invoked user is prompted to input data if prompt is true. Callback is called with inputted data as first argument.
Term.setTopic(x, y, width, height, callback) Makes specified region clickable, when click is invoked callback is called.
Term.setTopic(x, y, width, height, prompt, callback) Makes specified region clickable, when click is invoked callback is called. User is prompted to input data if prompt is true.
Term.clearTopic(x, y, width, height) Makes specified region no longer clickable clickable.