RiftWorks
Найти
Персональное меню
Вы не представились системе
user-interface-preferences
Персональные инструменты
Обсуждение
Вклад
Создать учётную запись
Войти
Параметры
notifications
Редактирование:
NT Script
(раздел)
associated-pages
Статья
Обсуждение
Просмотры
Читать
Править
Править код
История
Внимание:
Вы не вошли в систему. Ваш IP-адрес будет общедоступен, если вы запишете какие-либо изменения. Если вы
войдёте
или
создадите учётную запись
, её имя будет использоваться вместо IP-адреса, наряду с другими преимуществами.
Анти-спам проверка.
Не
заполняйте это!
== NT Deluxe Namespaces == Nanotrasen will constantly add new universal functions and features to NTSL, here are a few of them: === Number === :{|style="background:#999999" !align="left" width="200"| Syntax !align="left" width="100"| Returns !align="left" width="800"| Description |- | bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | |- | prob(number) || number || Returns nonzero is the probability succeeded. Returns zero if the probability failed. |- | bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | |- | sqrt(number) || number || Returns the square root of Arg.1. |- | abs(number) || number || Returns the magnitude of Arg.1. |- | bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | |- | floor(number) || number || Returns the Arg.1 rounded down to nearest integer. |- | ceil(number) || number || Returns the Arg.1 rounded up to nearest integer. |- | round(number) || number || Returns the Arg.1 rounded to nearest integer. 1.5 becomes 2, 1.49 becomes 1. |- | bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | |- | clamp(number, number, number) || number || Clamps Arg.1 between min(Arg.2) and max(Arg.3). clamp(30, -30, 25) = 25 |- | inrange(number, number, number) || number || Returns 1 if Arg.1 is inbetween min(Arg.2) and max(Arg.3). |- | min(...) || number || Returns the smallest value of all arguments. |- | max(...) || number || Returns the largest value of all arguments. |- | bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | |- | tostring(number) || string || Returns a sting value of the number. |- | bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | |- | rand(number, number) || number || Returns a random integer that is inbetween min(Arg.1) and max(Arg.2). |- | rand(number) || number || Returns a random integer that is inbetween 0 and max(Arg.1). |- | rand() || number || Returns a random float that is inbetween 0 and 1. |- | randseed(number) || || Resets the RNG with this value. |- | sin(value) || number || Returns the sine of the value. |- |cos(value) || number || Returns the cosine of the value. |- |asin(value) || number || Returns the arcsine of the value. |- |acos(value) || number || Returns the arcossine of the value. |- |log(value) || number || Returns the logarithm of the value. |} === String === A string is a sequence of characters. A string is defined by two quote marks.<br> "Hello world!" is a string. <br> A strings length is the amount of letters and blankspaces it contains.<br> :{|style="background:#999999" !align="left" width="200"| Syntax !align="left" width="100"| Returns !align="left" width="800"| Description |- | bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | |- | find(string, string) || number || Returns the position of the first occurrence of Arg.2 in Arg.1 or 0 if no matches were found. |- | bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | |- | length(string) || number || Returns the length of the string. |- | bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | |- | substr(string, number, number) || string || Returns a substring from Arg.1 based on start (Arg.2) to end (Arg.3). |- | bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | |- | replace(string, string, string) || string || Returns a instance of the string (Arg.1) where all occurences of Arg.2 are replaced by Arg.3. |- | bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | |- | lower(string) || string || Converts the string to lowercase. |- | upper(string) || string || Converts the string to uppercase. |- | proper(string) || string || Converts the first character to uppercase, rest to lowercase. |- | bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | |- | explode(string, string) || vector || This will split the string(Arg.1) at every place that matches the separator(Arg.2) in to a vector. explode("Hello there young friend", " "), will produce a vector with 4 indices, "Hello", "there", "young", "friend". This is very useful for chat commands: if(at(explode($content, " "),1)=="/bot"){dostuff} will make dostuff only run if the first word was /bot. |- | bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | |- | repeat(string, number) || string || Repeats the string n(Arg.2) amount of times. |- | reverse(string) || string || Reverses the string. |- | bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | |- | tonum(string) || number || Converts the string in to a number. |- |} === Vector === Vectors are resizeable data containers for storing any form of entities inside. They are very useful for serving as lists; their members can be instantly accessed provided you have an appropriate position. People call them arrays in other languages. Vector indexes in NTSL start at 1, unlike in other languages where arrays are usually zero-indexed. :{|style="background:#999999" !align="left" width="200"| Syntax !align="left" width="100"| Returns !align="left" width="800"| Description |- | bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | |- | vector(...) || vector || Returns a vector with a given number of entities. You can add an infinite number of entries, or no entries at all. |- | bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | |- | at(vector, number, var) || var || Sets the cell at Arg.2 index in the Arg.1 vector to Arg.3 if Arg.3 is supplied, otherwise, returns the value located at Arg.2. |- | bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | |- | copy(vector, number, number) || vector || Returns a new vector based on Arg.1, ranging from minimum index Arg.2 to Arg.3. |- | bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | |- | push_back(vector, ...) || || Adds Arg.2 (and every item after) to the end of the vector. Deprecated by the += operator. |- | bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | |- | remove(vector, ...) || || Loops through the vector and deletes the items matching the Args. |- | cut(vector, number, number) || || Cuts out entries from Arg.2 to Arg.3 in the Arg.1 vector. |- | bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | |- | swap(vector, number, number) || || Swaps the entries's position at Arg.2 and Arg.3 in the Arg.1 vector. |- | bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | |- | insert(vector, number, var) || || Inserts Arg.3 into Arg.1 at index Arg.2. |- | bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | |- | find(vector, var) || var || Searches the Arg.1 vector for Arg.2, returns 0 if not found. |- | bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | |- | length(vector) || number || Returns the length of the vector. (amount of indices) |- | bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | |- | implode(vector, string) || string || This will join the vector(Arg.1) in a string separating the indices with the separator(Arg.2) and returns that string. |- |} === Miscellaneous Definitions === :{|style="background:#999999" !align="left" width="200"| Syntax !align="left" width="100"| Returns !align="left" width="800"| Description |- | bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | |- | pick(...) || var || Returns a randomly-selected entry from the parameters. Note: vector parameters will add their entries into the "raffle". The function will never return a vector. |- | bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | |- | time() || number || Returns the real time of the server in a number. You can then use this to see how much time has passed since the code has last been run via mem(). |- | bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | || bgcolor="#AAAAAA" | |- | timestamp(format) || string || Returns a string of the time, formatted by the parameter. E.g: "DDD MMM DD hh:mm:ss YYYY" or "hh:mm:ss" or "DD MM YY". |} === Prefab Variables === '''PI''' = 3.141592653; '''E''' = 2.718281828; '''SQURT2''' = 1.414213562; '''FALSE''' = 0; // true/false are just Boolean shortcuts to 0 and 1 '''TRUE''' = 1; '''NORTH''' = 1; '''SOUTH''' = 2; '''EAST''' = 4; '''WEST''' = 8; '''$common''' = 1459 '''$science''' = 1351 '''$command''' = 1353 '''$medical''' = 1355 '''$engineering''' = 1357 '''$security''' = 1359 '''$supply''' = 1347 '''HUMAN''' = 1 '''MONKEY''' = 2 '''ALIEN''' = 4 '''ROBOT''' = 8 '''SLIME''' = 16 '''DRONE''' = 32 '''$robot''' = "robot" '''$loud''' = "yell" '''$emphasis''' = "italics" '''$wacky''' = "sans"
Описание изменений:
Обратите внимание, что все изменения в RiftWorks рассматриваются как выпущенные на условиях лицензии Creative Commons Attribution-NonCommercial-ShareAlike (см.
RiftWorks:Авторские права
). Если вы не хотите, чтобы ваши тексты свободно распространялись и редактировались любым желающим, не помещайте их сюда.
Вы также подтверждаете, что являетесь автором вносимых дополнений или скопировали их из источника в общественном достоянии или под совместимой лицензией.
Не размещайте без разрешения материалы, защищённые авторским правом!
Отменить
Справка по редактированию
(в новом окне)