-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvrchat_world_loader.uws
98 lines (85 loc) · 3.92 KB
/
vrchat_world_loader.uws
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
//vrchat_world_loader
//VRChatのワールドを順次ロードするuwscスクリプト
//License: CC0
PUBLIC instance_id, check_interval, user_id, region
//使い方
// 1. VR機器をPCから外してデスクトップモードでVRChatが起動できるようにする。
// 2. VRChatメニューの「SETTINGS」の「SKIP GO BUTTON IN LOAD」にチェックを入れる。
// 3. 下記の「user_id = 」から始まる行の「usr_xxx...」の部分に、自分のユーザIDを設定して保存する。
// 4. 開きたいワールドのIDが記入されたスクリプトを、UWSC.exeにドラッグ&ドロップして放置する。
// 数分おきにVRCウィンドウがアクティブになり、ワールドが自動でロードされる。
user_id = "usr_00000000-0000-4000-8000-000000000000"
// 自分のユーザIDは、
// vrchat.comにログインして、左上の自分のアイコンをクリックすると
// ブラウザのアドレスバーに出る「usr_」から始まる文字列。
// 「このvrchatを開くには新しいアプリが必要です」とメッセージが出た場合は、
// "C:\Program Files (x86)\Steam\steamapps\common\VRChat" にある install.exe を実行して、
// チェックを入れて「Proceed」を押す。
// 「vrchat://」形式のリンクをVRChatで開けるようになる。
//インスタンスIDをランダム生成
instance_id=int(random(100000))
//ワールドロード完了をチェックする間隔(単位:秒)
check_interval = 300
//リージョン(jp|eu|us)
region = "jp"
//ワールドをロードする
//World_Open("wrld_...") の wrld_... の部分にワールドIDを入れて、行頭の「//」を消すと、
//そのワールドをロードする。ロードが終わるとVRChatを一旦閉じて、次のワールドをロードする。
//ロード不要のワールドは、World_Openの前に「//」を入れるとスキップされる。
// World_Open("wrld_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")
// World_Open("wrld_yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy")
//ワールドを開いて、ロード完了を待つ
function World_Open(str)
nonce = RandomUUID()
world_url = "vrchat://launch?" + "id=" + str + ":" + instance_id + "~private(" + user_id + ")~region(" + region + ")~nonce(" + nonce + ")"
while True
if World_Load_End()
// アクティブウィンドウのID取得
a_id = getid( GET_ACTIVE_WIN )
exec("cmd /c start=" + world_url )
sleep(15)
// 元のアクティブウィンドウをアクティブにする
acw(a_id)
sleep(check_interval)
Result = true
break
else
sleep(check_interval)
endif
wend
fend
//ランダムUUID生成
function RandomUUID()
with createoleobj("Scriptlet.TypeLib")
result = strconv(betweenstr(.Guid(), "{", "}"),SC_LOWERCASE)
endwith
fend
// ワールドロード中はfalse、それ以外はtrue、ロード中の画面の色(青緑)で判定
function World_Load_End()
// アクティブウィンドウのID取得
a_id = getid( GET_ACTIVE_WIN )
// VRCウィンドウのID取得
w_id = getid( "VRChat","UnityWndClass" )
ifb !(w_id = -1) // ID取得失敗時はスキップする
mouseorg( w_id ,2 ,MORG_FORE )
// VRCウィンドウをアクティブにする
acw(w_id)
c_r = PeekColor(100,100,COL_R) //x:100,y:100の位置の赤色成分を取得
c_g = PeekColor(100,100,COL_G) //x:100,y:100の位置の緑色成分を取得
c_b = PeekColor(100,100,COL_B) //x:100,y:100の位置の青色成分を取得
// 元のアクティブウィンドウをアクティブにする
acw(a_id)
//ロード中の緑色が表示されているか判定
if (c_r < 5) and (c_g > 52) and (c_g < 72) and (c_b > 55) and (c_b < 75)
Result = false // 緑色(ロード中)
else
Result = true // 緑色でない(ロード完了)
sleep(60)
//VRChatウィンドウを閉じる
ctrlwin(w_id, CLOSE)
sleep(20)
endif
else
Result = true // VRChatが起動していない
endif
fend