Skip to content

Module Sys

Jeroen P. Broks edited this page Jan 13, 2026 · 2 revisions

Sys is a module that contains SCI's core feature ("Sys" being short for "System"). Likely the most required module in all of SCI.

Overview of the functions that come with "Libs/SCI/Sys"

Const String StateName

Contains the name of the state from which this is called

Void Sys.Exit(Int ExitCode=0)

Continues the current MainFlow call, but won't start a new frame/cycle but exit SCI. Contrary to Lua's os.exit it does close all processes and unloads all loaded assets before quitting.

Void Sys.Quit(Int ExitCode=0)

Alias for Sys.Exit

Void Sys.GoToFlow(String FlowName)

Once the current frame is complete it will start the new frame in the different flow.

Void Sys.LoadFlow(String FlowName,String ScriptFile)

Loads a script into a new flow. Script files can be either lua source scripts or byte code.

Void Sys.LoadNewFlow(String FlowName,String ScriptFile)

Loads a script into a new flow, but only when no flow already exists in the FlowName.

Void Sys.LoadState(String StateName,String ScriptFile)

Loads a script into a new state. Script files can be either lua source scripts or byte code.

Void Sys.LoadNewState(String StateName,String ScriptFile)

Loads a script into a new state, but only when no flow already exists in the FlowName.

Void Sys.LoadStateNew(String StateName,String ScriptFile)

Alias for Sys.LoadNewState

Void Sys.OpenURL(String URL)

Open the requested URL into the default browser.

Bool Sys.HaseState(String StateName)

True if statename has been loaded, otherwise False.

Void Sys.Call(String StateName, String GlobalFunction, ...)

Calls function in a different state. Please note, parameters can only be strings or integers.

Bool Sys.Yes(String Question)

Shows Yes/No dialog box and returns True if the user clicked "yes".

Void Sys.Annoy(String Message)

Shows a dialog box showing the requested message

Void Sys.Sleep(Number time)

Delays execution for 'time' milliseconds.

Void Sys.Delay(Number time)

Alias for Sys.Sleep

Void Sys.PlanToKillState(String StateName)

Waits until the end of the current frame and will then remove the requested state from memory.

Void Sys.KillState(String StateName)

Kills requested state immediately

WARNING!

Use with care! If any processes are still running the the requested state, a crash (Segmentation Fault or similar errors) can be inevitable!

Void Sys.WaitMinTicks()

Wait until the minimum number of ticks were started since the start of this frame

Global Void CSay(String message)

Puts a message on the CLI console but only in debug builds.

Global Void CSayF(String fmt,...)

Same as CSay, but allowing C string formatting

Number ATAN2(Number a,Number b)

Typical ATAN2 function, but since it was removed from the math library of Lua, this one will have to do.

Get Bool DebugBuild

Will return true when in debug build and false in release mode

Void Sys.TraceBack()

Dumps traceback data on CLI console

get int Sys.Ticks

Returns the number of ticks since the start of thegame

get string Sys.CurrentFlow

Returns the current Flow

Global Void GoToFlow(String FlowName)

Start next frame in flow 'flowname'

Set String Sys.CurrentFlow

You can define the flow name to this property.

GotoFlow("MyFlow")
Sys.CurrentFlow  = "MyFlow" 
// Both lines have same effect

Get String Sys.Platform

Contains name of current platform ("Windows","MacOS" or "Linux")

Get String Sys.ExtPlatform

Similar to Sys.Platform, but with more detailed data about the platform. For Linux that will just be "Linux", but for Windows and MacOS more specific data can be returned