en:vci:script:reference:exportme

vci.me(ExportMe)(Local machine information)

You can access the local information of the user who spawned the VCI.

List of member variables and functions

For the complete list, refer to “types.lua” file in “EmbeddedScriptWorkspace” folder.

--- Local machine information
---@class ExportMe
---@field GetAxisInput fun(): Vector3
---@field GetButtonInput fun(id: number): bool
---@field GetSystemVersion fun(): string
---@field CompareSystemVersion fun(version: string): number
---@field GetHeadMountedDisplayType fun(): string
---@field GetHeadMountedDisplayName fun(): string
---@field GetLanguageCode fun(): string
---@field FrameCount number
---@field Time TimeSpan
---@field UnscaledTime TimeSpan
Method Description VC version
GetAxisInput fun() Receives key input for VCI
GetButtonInput fun() Receives key input for VCI
FrameCount Number of frames elapsed since the client launch
Time The time elapsed from the client launch
UnscaledTime Its the same as Time, but this value is not affected by timeScale.
GetHeadMountedDisplayType fun() Get the type of the HMD being used 1.9.2a and later
GetHeadMountedDisplayName fun() Get the name of the HMD being used 1.9.2a and later
GetLanguageCode fun() Get the selected language 1.9.2a and later
GetSystemVersion fun() Get the version of VirtualCast 1.9.2d and later
CompareSystemVersion fun(version: string) Compare versions 1.9.2d and later

Acquire the time of Virtual Cast

サンプル

main.lua
function update()
    print(vci.me.Time)
    print("H : "..vci.me.Time.Hours)
    print("M : "..vci.me.Time.Minutes)
    print("S : "..vci.me.Time.Seconds)
end

The result

00:00:03.6820000
H : 0
M : 0
S : 3

By adding the methods after the “Time,” you can get the detailed information separately.
This time displays the time defined by the VCI script.

Acquire the current time of the OS

Example

main.lua
print(os.date("%Y-%m-%d %H:%M:%S"))
print(os.date("%m%d"))
print(os.date("%H"))
print(os.date("%M"))
print(os.date("%S"))

The result

2/26/2019 5:14:25 PM
0226
17
14
25

By using “os.date”, which is a function of Lua itself, you can acquire the current time of the OS.
For details, refer to os.date ().

Example

main.lua
today = os.date("%m%d")
 
function onGrab()
    -- today is a string type
    if today == "1225" then
        print("Merry Christmas!")
    end
end

By storing a date in a variable, you can use a specific date as a condition.
The example above is only run on the day of Christmas.
The return value of os.date() is a string type, not a number type, so make sure to specify the condition with a string.

Conversion from string type to number type

Example

main.lua
day = tonumber(os.date("%d"))
 
function onGrab()
    if (day % 2) == 0 then
        print("Today is an even number date")
    end
end

By using tonumber() you can convert from string type to number type.
The example above determines if the date is an even number by judging if the reminder of the day divided by 2 is 0.

Get the information on HMD and language

VC version: 1.9.2a and later

You can get the information on HMD and the language selected.

Example

main.lua
print("HMD Type: "..vci.me.GetHeadMountedDisplayType())
print("HMD Name: "..vci.me.GetHeadMountedDisplayName())
print("Language Code: "..vci.me.GetLanguageCode())

Values you can get with GetHeadMountedDisplayType

  • Vive
  • Index (1.9.3a and later)
  • Oculus
  • WindowsMR
  • ViveCosmos
  • Unknown: Others

Values you can get with GetLanguageCode

  • ja: Japanese
  • en: English
  • zh: Simplified Chinese
  • zhtw: Traditional Chinese

About GetHeadMountedDisplayName

The result is acquired from hmd_ModelNumber property in SteamVR.
This value conforms to SteamVR specifications and may change in future updates.

Version information

VC version: 1.9.2d and later

You can get the version information of VirtualCast with GetSystemVersion. CompareSystemVersion returns 0 when the version string specified in the arguments is the same as the current version. It returns a positive value if the version is older and it returns a negative value when the version is newer.

Example

main.lua
print(vci.me.GetSystemVersion()) -- 1.9.2d
 
local result = vci.me.CompareSystemVersion("1.9.2d")
print("Result: "..result) -- Result: 0
 
result = vci.me.CompareSystemVersion("1.9.2c")
print("Result: "..result) -- Result: 1
 
result = vci.me.CompareSystemVersion("1.9.3")
print("Result: "..result) -- Result: -1
en/vci/script/reference/exportme.txt · Last modified: 2021/06/29 19:57 by t-daihisa

Page Tools