Skip to content

Standard Functions

Michał edited this page Mar 11, 2023 · 43 revisions

Standard Functions in IterkoczeScript are functions that are defined and known at runtime. You don't need to provide any additional files or libraries in order for this functions to work.

? - Optional argument.
* - Can raise an error.

Basic

Write(arg1, arg2?):
NOTE: The Write function ignores null
arg1 - Element to write
arg2 - Colour for text
returns: null

Read(arg1?):
arg1 - Prompt
returns: User input -> string

*ReadAsInt(arg1?):
arg1 - Prompt
returns: User input -> int

Negative(number):
returns: int

File I/O

FileWrite(arg1, arg2):
arg1 - Path to file
arg2 - Element to write
returns: written text -> string

*FileRead(arg1):
arg1 - Path to file
returns: Text from file -> string

FileExists(arg1):
arg1 - Path to file
returns: bool

DirectoryCreate(path):
returns: null

AllFilesIn(path):
returns: array of all files in a path

FileGetExtention(string):
returns: string -> string

FileGetName(file):
returns: string -> string

GetConfigDirectory():
returns: string

Strings

GetChar(arg1, arg2):
arg1 - String
arg2 - Index of character
returns: Character at index from string -> string

ToLower(string):
string - String
returns: string but all lowercase -> string

ToUpper(string):
string - String
returns: string but all uppercase -> string

StringRemove(string, char):
returns: processed string -> string

StringEndsWith(string, string):
returns: bool

StringRemoveFirst(string):
Removes first character from string returns: string -> string

Conversion

*ConvertToInt(value):
returns: Converted value -> int

*ConvertToDouble(value):
returns: Converted value -> int

ConvertToString(arg1):
arg1 - element
returns: Converted value -> string

Utility

OK(function):
function - asserts if the function returned an error
returns: boolean

Exit(arg1):
arg1 - Exit code
returns: null

Sleep(time):
time - Sleep time in ms
returns: null

Argument(arg1):
arg1 - Argument index
returns: argument -> string

ArgumentCount():
returns: argument count -> int

StartRuntimeTimer():
Spins up the timer that can be used to measure the time that the script took to execute. returns null

ClearRuntimeTimer():
returns null

StopRuntimeTimer():
returns null

GetRuntime():
Returns the runtime up to this point. Does not stop the timer.
returns int

Execute(arg1, arg2?):
arg1 - Name of the command to execute
arg2 - arguments
returns: null

Linux():
True if running on Linux, false if not returns: bool

Network

*Fetch(URL)
returns: A JSON data variable

*IsServerUp(IP, timeout?)
returns: null

*Download(URL, pathToFile)
returns: null

Security

SHA1(string)
returns: SHA1 string

IterkoczeUUID()
returns: An UUID string. Very secure. I promise

Json

Json(filePath)
returns: A JSON data variable

JsonRead(jsonDataVar, keyToRead)
returns: Read value

JsonArrayToArray(jsonData)
returns: An array

Debug

DebugDump():
returns: null

Clone this wiki locally