Last active
May 3, 2019 02:41
-
-
Save sunasaji/52ebb5495598c60e0f116c75cd8ccdfb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//vrchat_world_loader | |
//VRChatのワールドを順次キャッシュにロードするuwscスクリプト | |
//License: CC0 | |
PUBLIC instance_id, check_interval, user_id | |
//使い方 | |
// 下記のuser_idの「usr_xxx...」の部分に、自分のユーザIDを設定して保存し、 | |
// 保存したスクリプトをUWSC.exeにドラッグ&ドロップして放置する。 | |
// 数分おきにVRCウィンドウがアクティブになり、ワールドが自動でロードされる。 | |
// 自分のユーザID | |
// vrchat.netにログインして、右上の自分のアイコンをクリックすると | |
// ブラウザのアドレスバーに出る「usr_」から始まる文字列。 | |
user_id = "usr_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | |
//インスタンスIDをランダム生成 | |
instance_id=int(random(100000)) | |
//ワールドロード完了をチェックする間隔 | |
check_interval = 300 | |
//自動でロードしたいワールドのIDをWorld_Open()で列挙する | |
//MOVIE THEATER 3D 16X9 | |
World_Open("wrld_35168249-b033-45fc-997c-c7b9699f756e") | |
//MOVIE THEATER 3D 360 STEREO | |
World_Open("wrld_a24410c3-e1ba-463e-9ab6-ba161cf47b4a") | |
//ワールドを開いて、ロード完了を待つ | |
function World_Open(str) | |
world_url = "vrchat://launch/?id=" + str + ":" + instance_id + "~private" | |
while True | |
if World_Load_End() | |
exec("cmd /c start=" + world_url ) | |
sleep(check_interval) | |
Result = true | |
break | |
else | |
sleep(check_interval) | |
endif | |
wend | |
fend | |
// ワールドロード中はfalse、それ以外はtrue、ロード中の画面の色(青緑)で判定 | |
function World_Load_End() | |
// VRCウィンドウのID取得 | |
w_id = getid( "VRChat" ) | |
mouseorg( w_id ,2 ,MORG_FORE ) | |
// VRCウィンドウをアクティブにする | |
acw(w_id) | |
c = PeekColor(100, 100) | |
c_r = Color_Red(c) | |
c_g = Color_Green(c) | |
c_b = Color_Blue(c) | |
//ロード中の緑色が表示されているか判定 | |
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 | |
fend | |
// 色取得 | |
function Color_Red(c) | |
Result = c and $FF | |
fend | |
function Color_Green(c) | |
Result = (c and $FF00) / $100 | |
fend | |
function Color_Blue(c) | |
Result = (c and $FF0000) / $10000 | |
fend |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment