Advertisement
SariaFace

VRChat SDK Test Build No-VR Multiclient

Dec 10th, 2019
808
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'sasachan was here to look for headpat. find her and give, please. -^,..,^-
  2.  
  3. askMultiClient = true   'set to true will always force new test client to join instance of already running vrchat.
  4. closePrevInstance = true    'set to true to close all open instances of VRChat before launching (ignored if forceMultiClient true)
  5. disableVR = true            'set to true to  ALWAYS launch tests in desktop mode
  6. askNoVR = false             'set to false to bypass asking for no-vr mode (ignored if disableVR is true)
  7. numClients = 1              'default number of clients to start'
  8. maxClients = 5              'maximum number of clients to start. keep small unless you hate computer'
  9.  
  10. 'On some systems, current working directory points to wrong location. This uses script locale
  11. launchPath =  left(WScript.ScriptFullName,(Len(WScript.ScriptFullName))-(len(WScript.ScriptName))) & "VRChat.exe"
  12.  
  13. Set WMISvc = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
  14. Set processList = WMISvc.ExecQuery( "Select * from Win32_Process Where Name = 'VRChat.exe'")
  15. Dim args
  16. 'Search for and close all open instances of VRChat.exe. Manually closing would be better, but you are busy person, yes?
  17. 'auto close ignored if forceMultiClient is enabled.
  18. if closePrevInstance then
  19.     for each process in processList
  20.         if InStr(process.CommandLine, "BuildAndRun") then
  21.             process.Terminate()
  22.         end if
  23.     next
  24. end if
  25. 'prompt to choose number of clients to open'   
  26. if askMultiClient then
  27.     inputVal =  InputBox( "How many VRChat windows to open?" & vbCrLf & "Number of 1 to " & maxClients & " please.")
  28.     if IsNumeric( inputVal ) then
  29.         inputVal = CInt( inputVal ) 'type adherence? what is?'
  30.         if inputVal >= 1 and inputStr <= maxClients then
  31.             numClients = inputVal
  32.         elseif inputVal = 0 then
  33.             WScript.Quit 0
  34.         end if
  35.     end if
  36. end if
  37.  
  38.  
  39. 'Prompt to or automatically prepend the launch parameters from the SDK with --no-vr if specified in options
  40. if IsEmpty(args) then
  41.     args = WScript.Arguments(0)
  42. end if
  43.  
  44. if disableVR then
  45.     args = " --no-vr " & args
  46. elseif askNoVR then
  47.     result = MsgBox("Launch in no-VR (desktop) mode?" & vbCrLf & "Yes (desktop)  No (vr)", vbYesNoCancel)
  48.     Select Case result
  49.     Case vbYes
  50.         args = "--no-vr " & args
  51.     Case vbCancel
  52.         WScript.Quit 0
  53.     end Select
  54. end if
  55.  
  56. 'Test with shell app command, may cause issue with auto task kill
  57. 'Call CreateObject("Shell.Application").ShellExecute (launchPath, args, "", "open", 1)
  58. 'Original method, may have issue with permission denied on some system'
  59.  
  60. 'script handle open multiple client. sdk managed cause separate script instance which and timing or parent task may be issue or desync'
  61. for i = 1 to numClients
  62.     'WScript.Shell limit 1 instance at any moment. shell.application allow multiple'
  63.     Call CreateObject("Shell.Application").ShellExecute (launchPath, args, "", "open", 1)
  64. Next
  65. 'Test with exec and not run. may still trigger permission denied'
  66. 'Call CreateObject("WScript.Shell").Exec ( Chr(34) & launchPath & Chr(34) + args)'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement