System

Function System(cmd$)

Runs an operating system command.


Function OS$()

Returns the runtimes native operating system.

Possible Return Values:

  • WINDOWS
  • LINUX
  • MAC
  • ANDROID
  • IOS
  • WEB

Note: This specifically returns the OS$ the runtime was built for so if you have a windows executable running under wine this function will return “WINDOWS”


Function Command$(arg)

Returns command line arguments passed to a program.

Note: Command$(0) will always be the program being executed ( your_program.cbc ).

See also

NumCommands()


Function NumCommands()

Returns the number of command line arguments passed to the program on start.


Function Env$(v$)

Returns the value of the environment variable passed to it.

See also

SetEnv()


Sub SetEnv(var$, value$)

Sets the value of an environment variable.

See also

Env$()


Function PrefPath$(org_name$, app_name$)

Returns the preferred path for storing files.


Function Android_GetExternalStoragePath$()

Returns the designated external storage path.

See also

Android_GetExternalStorageState(), Android_GetInternalStoragePath$()


Function Android_GetExternalStorageState()

Returns a bitmask of these values:

  • ANDROID_EXTERNAL_STORAGE_READ
  • ANDROID_EXTERNAL_STORAGE_WRITE
If AndBit( Android_GetExternalStorageState(), ANDROID_EXTERNAL_STORAGE_READ ) Then 
Print "Can read from external storage"
End If

See also

Android_GetExternalStoragePath$(), Android_GetInternalStoragePath$()


Function Android_GetInternalStoragePath$()

Returns the internal storage path.

See also

Android_GetExternalStorageState(), Android_GetExternalStoragePath$()


Function Android_JNI_Message$(arg$)

Passes arg$ to the rcbasic_android_interface() method in the java code for your android app. The java method returns a string.

See also

Runtime_Utility_Message$()


Function Runtime_Utility_Message$(arg$)

Passes arg$ to the rc_intern_runtime_utility() function in the rc_media.h file. The function returns a string.

Note: On IOS there a file in the project called rcbasic_ios_native.h which is already setup for you to add your C++ code.


Sub GetDesktopDisplayMode(index, ByRef w, ByRef h, ByRef freq)

Gets the resolution and refresh rate of a display.

  • index - The display index (ie. if you have 3 displays then index could be 0, 1, or 2).
  • w, h - The width and height of the display will be stored in these variables.
  • freq - The refresh rate will be stored in this variable.

Sub GetPowerInfo(ByRef status, ByRef secs, ByRef pct)

Gets the charging status of the device the program is running on.

status - the charging status of the battery. Look below for the different statuses that can be returned. secs - the approximate time in seconds until the battery looses its charge. pct - the percentage of the battery charged.

Possible Statuses:

  • POWERSTATE_UNKNOWN
  • POWERSTATE_ON_BATTERY
  • POWERSTATE_NO_BATTERY
  • POWERSTATE_CHARGING
  • POWERSTATE_CHARGED

Function EvalJS$(js_code$)

‘Only useable in Emscripten. Runs javascript code.

Returns the return value of the javascript code.

NOTE: ONLY WORKS IN WEB PORT.


Function SystemReturnStdOut$(cmd$)

Runs an operating system command and returns the output.

See also

System()


Function OpenURL(url$)

Opens a URL in the internet browser.


Function MessageBox(title$, msg$)

Displays a message box.


Function Runtime$()

Returns the path to the RCBasic runtime that launched the current program.


Function NumCPUs()

Returns the number of CPUs(ie. cores) available.


Function SystemRam()

Returns the amount of RAM available.


Function GetGPUInfo$()

Returns the GPU Vendor info.


Sub Steam_AddAchievement(ach_id$, ach_name$)

Add a steam achievement to the current program.

NOTE: This only works for desktop applications


Sub Steam_ClearAchievements()

Clear all steam achievements from the application.


Sub Steam_FinalizeAchievements()

This function must be called once all steam achievements have been added.


Function Steam_TriggerAchievement(ach_name$)

Unlocks a steam achievement in the current application.

Returns True if the achievement was triggered and false if not.


Function Steam_GetID$()

Returns the steam ID of the application which is needed to use the Steamworks API.