Client
Client
This class is only available on client
Methods
integer GetID()
nil OpenScriptFile(string fileName, integer? lineNumber)
nil OpenMontageScriptFile(string fileName, integer? lineNumber)
string GetMontageURL()
boolean NeedsRestartToOpen(string url)
nil SetMontageURL(string url)
nil LoadMontageByURL()
nil CancelLoadMontageByURL()
string GetMontageURLBase()
table GetMontageURLParameters()
string GetMontageURLParametersRaw()
string GetMontageURLWithParameters(table params)
nil ConnectToMontage(string url)
string GetConnectionStatus()
Unknown, Connecting, FailedToConnect, StatusMessage, ReadyToAcknowledge, Connected, Disconnected
string GetConnectionStatusDetailed()
string GetEngineMismatchUrl()
nil Disconnect(string? reason)
integer GetPing()
Time for a network message to travel from client to server and back
integer GetSceneMsgsInQueue()
boolean IsInitialAssetSyncDone()
table GetMainDispatcherStats()
table GetRenderStats()
table TranslateShaders(boolean? writeFiles)
WebGPU shader translation check (native only): runs every loaded effect's vertex + fragment pair through the GLSL -> WGSL translator (glslang SPIR-V + Tint). Translations complete over frames (a worker thread, or the server for a browser client), so poll until pending is 0. Returns { available, translator, translatesLocally, effects, ready, pending, failed, skipped, failures = { {effect, error} ... }, folder }; with writeFiles the ready WGSL lands under UserData/ShaderTranslation/<effect>.vs.wgsl / .fs.wgsl.
table GetRenderProfile()
Immutable completed renderer snapshot: publication, frame, enabled, summary, commands, passes, resources, buffers, textures. Rows contain name/value/unit or named counts. Upload lists capped at 60 plus an aggregate; passes at 128 plus an aggregate. CPU replay timing is not GPU time.
table GetRenderStatsWrites()
boolean GetRenderStatsEnabled()
nil SetRenderStatsEnabled(boolean enable)
nil SetRenderErrorChecksEnabled(boolean enable)
Debug OpenGL: enable diagnostic glGetError polling on the graphics owner at the next frame boundary. Explicit result checks remain active.
boolean GetRenderErrorChecksEnabled()
Returns the requested GL diagnostic error-check setting.
nil SetStrictRenderValidation(boolean enable)
Debug OpenGL: check errors per call and framebuffers per draw. Applied at the owner frame boundary.
boolean GetStrictRenderValidation()
Returns the requested strict rendering validation mode.
nil SetGpuFinishTiming(boolean enable)
Profiling: with render stats on and no GPU timer queries (e.g. Mali GL ES), time each pass with glFinish at run boundaries. Serializes the GPU, so frame times are inflated while on; GetRenderProfile().gpuTiming then holds this frame's real per-pass GPU costs.
boolean GetGpuFinishTiming()
Returns the requested GPU finish-timing mode.
nil SignIn()
nil SignOut()
string GetAuthStatus()
string GetAuthPrompt()
string GetAuthError()
string StartAISession()
boolean opened OpenFolder(string path)
nil SetSky(Asset|AssetLink sky)
nil ClearSky()
nil ResetSkyToDefault()
Goes back to the built-in default sky (ClearSky leaves no sky at all).
nil SetSkyEnabled(boolean enabled)
boolean GetSkyEnabled()
nil SetSkyLook(table look)
Sets VM Sky's clouds and atmosphere for this client: any of coverNear, coverFar, towers, cirrus, veil, haze, exposure, seed (mostly 0-1; fields left out keep their value). A change rebakes the sky and crossfades to it, so easing a value over seconds changes the sky smoothly (cover 0.1/0.6 is the default fair-weather sky, 0.9/1 overcast). Kept across sky changes until ResetSkyLook.
table GetSkyLook(boolean? assetOnly)
Returns the look the sky bakes with (coverNear, coverFar, towers, cirrus, veil, haze, exposure, seed); with assetOnly, the sky's own, ignoring SetSkyLook.
nil ResetSkyLook()
Goes back to the sky's own look (undoes SetSkyLook).
nil SetSunDirection(number azimuth, number altitude)
Places the scene's sun, in degrees (azimuth 0 = +Z, 90 = +X; altitude above the horizon, negative below): the sky, shadows, sea and lighting follow, and below the horizon the moon takes over. Sky.lua's day and night set it every frame while they run.
number azimuth, number altitude GetSunDirection()
Returns the scene's sun, in degrees.
table GetSkyInfo()
boolean GetNetworkThrottlingNow()
nil SetIntersectionTint(Color color)
nil SetIntersectionBox(Vec3 centerWC, Quat rot, Vec3 sizeWC)
nil SetIntersectionSphere(Vec3 posWC, number radius)
nil WriteToScreen(string text, Vec2 pos, Vec2 anchor, Color color, integer? size, Color? outlineColor, number? time, number? outlineWidth)
nil CloseApp()
string GetEULA()
Vec2 GetWindowSize()
Vec2 GetViewportSize()
Vec2 GetRenderSize()
Vec2 GetViewportPos()
boolean IsAppVisible()
string CaptureObjectThumbnail(Object target, table? opts)
Color GetBGColor()
nil SetBGColor(Color|Vec4 color)
boolean GetVREnabled()
nil SetVREnabled(boolean enable, string vrDevice)
nil ToggleVREnabled(string vrDevice)
Vec3 pos, Quat rot GetVREyeTransform(integer side, Space space)
Vec3 pos, Quat rot GetVRHeadsetTransform(Space space)
nil ApplyVRHapticFeedback(Side hand, number duration, number frequency, number amplitude)
boolean GetVREyeTrackingSupported()
number scale SetVRUserScale(number scale)
number GetVRUserScale()
number GetVRUserScaleMin()
number GetVRUserScaleMax()
nil StartVRPassthrough()
nil StopVRPassthrough()
boolean IsVRPassthroughEnabled()
boolean IsVRPassthroughSupported()
boolean IsUploadingFiles()
boolean IsDownloadingFiles()
string GetDragDropBlockedReason()
nil Restart()
nil ChooseImage()
Opens the device's own picker to take a photo or choose an image (iOS, Android, and browsers, where phones offer the camera). The image arrives like a dropped file: it is copied into .dropped-assets and events.assetsDropped fires on this client and, once it has synced, on the server. Returns at once; nothing arrives if the player cancels. Desktop apps have no picker and log an error.
nil ToggleChannelRendering()
integer GetRenderChannelsCount()
number GetRenderChannelOpacity(integer which)
nil SetRenderChannelOpacity(integer which, number value)
boolean IsMobile()
integer GetMemoryUsage()
integer? GetMemoryLimit()
string GetCredits()
table GetErrors()
table GetShaderErrors()
nil SetVPuzzleShaderDefines(string defines)
nil RequestReloadShaders()
nil CopyToClipboard(string text)
string GetClipboardText()
may not work on all platforms
nil OpenBrowserWithURL(string url)
nil HttpGet(string url, fun(success:boolean, response:string, statusCode:integer) onResponse)
nil HttpGetAuthed(string url, fun(success:boolean, response:string, statusCode:integer) onResponse)
Client:HttpGet as the signed-in maker: the client's own sign-in token is sent as the bearer (script never sees it), refreshed first if it expired. Same platform-hosts-only rule as HttpGet. Signed out: onResponse gets (false, 'signed out', 401) without a request. Throws in the web client.
nil HttpDownload(string url, string fileName, fun(success:boolean, response:string, statusCode:integer, asset:Asset?) onResponse)
nil HttpDownloadToClientCache(string url, string fileName, fun(success:boolean, response:string, statusCode:integer, asset:Asset?) onResponse)
nil ReleaseClientCacheResources()
nil ReloadPage(boolean fromCache)
nil ResetPlayerLODPriorityBubble()
nil AddPlayerLODPriorityBubbleShape(Vec3 capsulePointA, Vec3 capsulePointB, number capsuleRadius, Vec3 velocity, number size)
LODs in this bubble are prioritized, should be placed around the player or camera params: capsuleStart, capsuleEnd, capsuleRadius, velocity, size
nil SetScreenColor(Color color, boolean? permanent)
Tint the view for this frame or permanently
nil EnableRenderingWithFadeEffect(integer type, number duration)
nil DisableRenderingWithFadeEffect(integer type, number duration)
nil ToggleRenderingWithFadeEffect(integer type, number duration)
nil SetOutlineColor(Vec4 color)
nil SetHighlightColor(Vec4 color)
nil DrawPointSpriteSphere(Vec3 pos, number radius, Vec4 color, boolean shade)
nil DrawBillboardSphere(Vec3 pos, number radius, Vec4 color, boolean shade)
Draw a sphere sprite at a world position, optionally shaded. Client-side, call every frame.
nil DrawBillboard(integer texture, Vec3 pos, number size, Vec4 color, number angleDeg)
Draw a camera-facing textured quad in world space. Client-side, call every frame.
nil DrawBillboards(table billboards)
Batch-draw multiple billboards from a table of descriptors.