Guide to NTSL2++: различия между версиями
Перейти к навигации
Перейти к поиску
>Karolis2011 (Created page with " == Runtime refrence == NTSL2++ is based on ancient language called javascript, refrence to all it's functionalities can be obtained from [https://developer.mozilla.org/en-US/...") |
>Karolis2011 (Added width and heigth) |
||
Строка 1: | Строка 1: | ||
== Sample scripts == | |||
* [https://gist.github.com/Karolis2011/8eb557386a75778af823b1180e71984c Very basic calculator] | |||
== Runtime | == Runtime reference == | ||
NTSL2++ is based on ancient language called javascript, | NTSL2++ is based on ancient language called javascript, reference to all it's functionalities can be obtained from [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects here] | ||
' | === Term library === | ||
{| class="wikitable sortable" | |||
|- | |||
! 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 <code>Term.cursorX</code> and <code>Term.cursorY</code> directly. | |||
|- | |||
| Term.getCursor() || Returns the cursor's position. This is same as reading <code>Term.cursorX</code> and <code>Term.cursorY</code> 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. | |||
|- | |||
|} |
Версия от 21:52, 14 ноября 2020
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. |