+ - * / % & | ^ ~ = += -= *= /= %= ++ -- << <<= >> >>= &= ^= |= || && () < > <= >= == ! != if while break continue elseif else work as in any general purpose programming language
Examples a = 3 * (5 - 1);
a++;
a <<= 3;
label on_error error handling for snuvi scripts
Info if the label on_error exists, the parser will continue at this label
Variablen error_stacktrace
error_message
error_name
error_function
for executes the start instruction once, and repeats the block and the per loop function until the loop check is false
Format for(start_instruction; loop_check; per_loop) { }
Examples for(i = 0; i < 5; i++) { print("hi"); }
functions functions can be written and have their own scope, global variables can be accessed by using a $
Format function function_name(vars, ...) { }
Examples c = 6;
function printStuff(a, b)
{
print(a, b, $c);
}
printStuff(4, "Hallo");
print prints all arguments connected to the default console
Format print(arg, ...)
getVar returns the value of a variable
Format getVar(variable_name_string)
setVar sets the value of a variable
Format setVar(variable_name_string, value)
swap swaps the values of two variables
Format swap(var1, var2)
nothing does nothing
Format nothing()
error sets if full stack exceptions are printed to the logger
Format error(boolean)
array.new initializes an array with the given size and returns the array
Format array.new(size, ...)
Examples a = array.new(3);
a[0] = 2;
b = array.new(3, 2)
b[0, 0] = 3;
array.getSize returns the size of an array
Format array.getSize(array)
Examples array.new(a[3, 2])
array.getSize(a)
array.getSize(a[0])
read.number returns a double parsed from a string or null if not possible
Format read.number(double_string)
wait stops a script until an event is received
Format wait()
term terminates a script
Format term()
goto jumps to a label
Format goto(label)
Arguments the label can either be a string or @label_name, labels can be made by writing @label_name
sgoto jumps to a label after a specific amount of scheduler ticks
Format sgoto(ticks, label)
Info don't use sgoto with 1 ticks
all scheduled tasks are instantly executed on server stop
auto scheduler slows down execution of sgoto
ignoreGoto jumps to a label if it exists
Format ignoreGoto(label)
Alias iGoto(label)
gosub jumps to a label and remembers the old position
Format gosub(label)
return returns to the previous execution position returning nothing or a value
Format return
return 5
waitfor waits a specific amount of scheduler ticks, no events are received while waiting, sgotos until now won´t be received anymore
Format waitfor(ticks)
assert throws an exception of the given bool is false
Format assert(boolean)
isBool returns true if a value is a boolean
Format isBool(value)
isDouble returns true if a value is a double
Format isDouble(value)
isLong returns true if a value is a long
Format isLong(value)
class returns the class of any object
Format class(object)
usedMemory returns used memory in mega bytes
Format usedmemory()
allocatedMemory returns allocated memory in mega bytes
Format allocatedmemory()
iterator returns an iterator
Format iterator(collection / list / set)
hasNext returns true if the iterator has a next entry
Format hasNext(iterator)
next returns the next entry of an iterator
Format next(iterator)
remove removes the actual entry of an iterator
Format remove(iterator)
modTimer modifies the timer for the auto scheduler
Format modTimer(milliseconds)
Arguments milliseconds as long
event.load loads an event, a script does not receive non loaded events
Format event.load(event_name_string)
event.unload unloads an event
Format event.unload(event_name_string)
event.isloaded returns true if the given event is loaded
Format event.isloaded(event_name_string)
script.get returns a script
Format script.get()
script.get(script_name)
script.getId returns the id of a script
Format script.getId(script)
script.getFromId returns the script with this id
Format script.getFromId(script_id)
script.getAll returns a list with all active scripts with this name
Format script.getAll(script_name)
script.term terminates a script
Format script.term(script)
script.getVar returns the value from a var from script
Format script.getVar(script, var_name)
script.setVar sets the value from a var from script
Format script.setVar(script, var_name, value)
getScriptVar returns the value from a scriptvar (scriptvars are script-across)
Format getScriptVar(String varname)
setScriptVar sets the value from a scriptvar (scriptvars are script-across)
Format setScriptVar(String varname, value)
delScriptVar deletes a scriptvar
Format delScriptVar(String varname)
clearScriptVars clears all scriptvars
Format clearScriptVars()
bit.set returns a value, where a single bit is set to 1
Format bit.set(value, bit_index)
Arguments bit_index should be from 0 to 31
bit.unset returns a value, where a single bit is set to 0
Format bit.unset(value, bit_index)
Arguments bit_index should be from 0 to 31
bit.get returns a single bit as boolean
Format bit.get(value, bit_index)
Arguments bit_index should be from 0 to 31
Returns true or false depending on the bit
math.min returns the lower value
Format math.min(value1, value2)
math.max returns the higher value
Format math.max(value1, value2)
math.abs returns the absolute value of a value
Format math.abs(value)
math.pow returns a value to the power of another
Format math.pow(value, power)
math.root returns the given root of a value
Format math.root(value, root)
math.sqrt returns the square root a value
Format math.sqrt(value)
math.hypot returns sqrt(x² + y²)
Format math.hypot(x, y)
math.sin returns the sine of a value
Format math.sin(value)
math.cos returns the cosine of a value
Format math.cos(value)
math.tan returns the tangent of a value
Format math.tan(value)
math.asin returns the arcsine of a value
Format math.asin(value)
math.acos returns the arccosine of a value
Format math.acos(value)
math.atan returns the arctangent of a value
Format math.atan(value)
math.e returns Euler's number
Format math.e()
math.pi returns pi
Format math.pi()
math.ln returns the natural logarithm of a value
Format math.ln(value)
math.log returns the decadic logarithm of a value
Format math.log(value)
math.random returns a random natural number between both values including both borders
Format math.random(from, to)
math.round returns a value rounded
Format math.round(value)
math.roundUp returns a value rounded up
Format math.roundUp(value)
math.roundDown returns a value rounded down
Format math.roundDown(value)
math.roundComma returns a value rounded to a specific number of decimals
Format math.roundComma(value, number_of_dezimals)
list.new returns a new list
Format list.new()
list.exists returns true if the given value is a list
Format list.exists(value)
list.add adds an element to a list
Format list.add(list, element)
list.addAll adds all given elements to the list
Format list.addAll(List, element, ...)
list.remove removes an element from a list and returns true on success
Format list.remove(list, element)
list.removeIndex removes an element from a list at the given index and returns true on success
Format list.removeIndex(list, index)
list.contains returns true if a list contains a given element
Format list.contains(list, element)
list.getSize returns the size of a list
Format list.getSize(list)
list.getIndex returns the element at a given index of a list
Format list.getIndex(list, index)
Alias list.get(list, index)
list.setIndex sets the element at a given index of a list and returns the old element
Format list.setIndex(list, index, element)
list.getIndexOf returns the index of a given element in a list or -1 if the list does not contain the element
Format list.getIndexOf(list, element)
list.clear removes all elements of a list
Format list.clear(list)
list.sort sorts a list
Format list.sort(list)
list.reverse reverses the order of a list
Format list.reverse(list)
list.shuffle shuffles a list
Format list.shuffle(list)
list.iterator (deprecated) returns the iterator of a list
Format list.iterator(list)
map.new returns a new map
Format map.new()
map.exists returns true if the given value is a map
Format map.exists(value)
map.add adds a key value pair to a map and returns the old value
Format map.add(map, key, value)
map.remove removes a key from a map and returns the old value
Format map.remove(map, key)
map.contains returns true if a map contains a given key
Format map.contains(map, key)
map.getSize returns the size of a map
Format map.getSize(map)
map.get returns the value associated with a key in a map
Format map.get(map, key)
map.getOrDefault returns the value associated with a key in a map or the default value if the key is not present
Format map.getOrDefault(map, key, default)
map.iterator returns the iterator of a map
Format map.iterator(map)
map.getKey returns the key
Format map.getKey(iterator_element)
map.getValue returns the value
Format map.getValue(iterator_element)
map.setValue sets the newValue and returns the oldValue
Format map.setValue(iterator_element, newValue)
map.clear removes all key value pairs from a map
Format map.clear(map)
set.new returns a new set
Format set.new()
set.exists returns true if the given value is a set
Format set.exists(value)
set.add adds a key to a set and returns true if the key was added
Format set.add(set, key)
set.addAll adds all given keys to a set
Format set.addAll(set, key, ...)
set.remove removes a key from a set and returns true if the key was removed
Format set.remove(set, key)
set.contains returns true if a set contains a given key
Format set.contains(set, key)
set.getSize returns the size of a set
Format set.getSize(set)
set.clear removes all keys from a map
Format set.clear(set)
set.toList returns all keys of a set as list
Format set.toList(set)
set.iterator (deprecated) returns the iterator of a set
Format set.iterator(set)
time.new returns a calendar of a given time in milliseconds
Format time.new(time_millis)
Arguments time_millis are milliseconds passed since 01.01.1970
time.getMillis returns the current millisecond time
Format time.getMillis()
time.getNanos returns the current nanosecond time of the whole engine
Format time.getNanos()
time.from returns the millisecond time of a calendar
Format time.from(calendar)
time.nextDay sets the time of a calendar to the beginning of the next day
Format time.nextDay(calendar)
time.getYear returns the year of a calendar
Format time.getYear(calendar)
time.getMonth returns the month of a calendar
Format time.getMonth(calendar)
time.getDay returns the day of a calendar
Format time.getDay(calendar)
time.getHour returns the hours of a calendar
Format time.getHour(calendar)
time.getMinute returns the minutes of a calendar
Format time.getMinute(calendar)
time.getSecond returns the seconds of a calendar
Format time.getSecond(calendar)
string returns any object as string
Format string(object)
string.number returns a number as string without unnecessary .0
Format string.number(number)
string.class returns the class of any object
Format string.class(objekt)
string.toUpperCase returns a string capitalized
Format string.toUpperCase(string)
string.toLowerCase returns a string decapitalized
Format string.toLowerCase(string)
string.split returns a string splitted by a given separator as array
Format string.split(separator, string)
string.concat returns one string which connects all given arguments
Format string.concat(arg, ...)
string.startsWith returns true if a string starts with another starting from a given index
Format string.startsWith(string, search_text, start_index)
string.endsWith returns true if a string ends with another
Format string.endsWith(string, search_text)
string.contains returns true if a string is in another
Format string.contains(string, search_text)
string.indexOf returns the index of string in another starting from a given index or -1 if not found
Format string.indexOf(string, search_text, start_index)
string.lastIndexOf returns the last index of a string in another starting from a given index or -1 if not found
Format string.lastIndexOf(string, search_text, start_index)
string.replace replaces all occurrences of a given string in another with a given string
Format string.replace(string, search_text, swap_text)
string.trim returns a string without leading and trailing whitespaces
Format string.trim(string)
string.matches returns true if a string matches a regex
Format string.matches(string, regex)
string.charcode returns the character code of an index in a string
Format string.charcode(string, index)
string.fromCode returns a string from a character code
Format string.fromCode(character_code)
string.length returns the length of a string
Format string.length(string)
string.subString returns a sub string starting at one index and ending at another exclusively
Format string.subString(string, from_index, to_index)
file.new returns a new file
Format file.new(path)
file.exists returns true if a file exists
Format file.exists(file)
file.delete removes a file and returns true on success
Format file.delete(file)
file.getName returns the name of a file
Format file.getName(file)
file.getList returns all files in a folder as list
Format file.getList(file)
file.read returns all lines in a file as list
Format file.read(file)
file.write writes all entries of a list to a file
Format file.write(file, list)
file.isFile returns true if a file is a file
Format file.isFile(file)
file.isDirectory returns true if a file is a directory
Format file.isDirectory(file)
config.new returns a new config
Format config.new(path, name)
config.exists returns true if the config exists
Format config.exists(config)
config.save saves a config and returns true on success
Format config.save(config)
config.load loads a config
Format config.load(config)
config.delete removes a config
Format config.delete(config)
config.set sets a key value pair in a config
Format config.set(config, key, value)
config.getBool returns a boolean or a default value from a config key
Format config.getBool(config, key, default)
config.getDouble returns a double or a default value from a config key
Format config.getDouble(config, key, default)
config.getString returns a string or a default value from a config key
Format config.getString(config, key, default)