Last active
April 30, 2024 19:33
-
-
Save nightcycle/d688f712f7cacd9fce29438c43de0e77 to your computer and use it in GitHub Desktop.
Base CreatorLab AutoHotkey Script
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
; General Constants | |
SCREEN_CENTER_X_OFFSET := 950 ; x screen px coordinate for center of screen | |
SCREEN_CENTER_Y_OFFSET := 550 ; y screen px coordinate for center of screen | |
MIN_INPUT_DELAY_MS := 80 ; the number of milliseconds to wait after pressing enter to input a value into the menu | |
MIN_COMMAND_DELAY_MS := 250 ; the number of milliseconds to wait after copying / pasting / deleting / changing an in-world item | |
MENU_OPEN_DELAY_MS := 400 ; how long to wait for the menu to finish opening | |
MENU_CLOSE_DELAY_MS := 400 ; how long to wait for the menu to finish opening | |
; Camera | |
MoveCamera(duration_ms, horizontal_movement, vertical_movement, forward_movement){ | |
if horizontal_movement == 1 { | |
Send("{a Down}") | |
} | |
if horizontal_movement == -1 { | |
Send("{d Down}") | |
} | |
if vertical_movement == 1 { | |
Send("{e Down}") | |
} | |
if vertical_movement == -1 { | |
Send("{q Down}") | |
} | |
if forward_movement == 1 { | |
Send("{w Down}") | |
} | |
if forward_movement == -1 { | |
Send("{s Down}") | |
} | |
Sleep(duration_ms) | |
if horizontal_movement == 1 { | |
Send("{a Up}") | |
} | |
if horizontal_movement == -1 { | |
Send("{d Up}") | |
} | |
if vertical_movement == 1 { | |
Send("{e Up}") | |
} | |
if vertical_movement == -1 { | |
Send("{q Up}") | |
} | |
if forward_movement == 1 { | |
Send("{w Up}") | |
} | |
if forward_movement == -1 { | |
Send("{s Up}") | |
} | |
} | |
; Menu | |
SetField(offset_x, offset_y, value) { | |
MouseClick("L", offset_x, offset_y) | |
Send("" value) | |
} | |
; Menu -> Vector3 Fields | |
VEC_3_WRITE_DELAY_MS := 450 ; the number of milliseconds to wait exclusively for writing to V3 fields | |
VEC_X_SCREEN_X_OFFSET := 1600 ; x screen px coordinate for the X field of a vector input (like rotation and position) | |
VEC_Y_SCREEN_X_OFFSET := 1700 ; x screen px coordinate for the Y field of a vector input (like rotation and position) | |
VEC_Z_SCREEN_X_OFFSET := 1770 ; x screen px coordinate for the Z field of a vector input (like rotation and position) | |
POS_SCREEN_Y_OFFSET := 655 ; y screen px coordinate for position field in menu (assuming scrolled up) | |
SetPosition(x, y, z) { | |
SetField(VEC_X_SCREEN_X_OFFSET, POS_SCREEN_Y_OFFSET, x) | |
SetField(VEC_Y_SCREEN_X_OFFSET, POS_SCREEN_Y_OFFSET, y) | |
SetField(VEC_Z_SCREEN_X_OFFSET, POS_SCREEN_Y_OFFSET, z) | |
Sleep(VEC_3_WRITE_DELAY_MS) | |
} | |
ROT_SCREEN_Y_OFFSET := 700 ; y screen px coordinate for rotation field in menu (assuming scrolled up) | |
SetRotation(x, y, z) { | |
SetField(VEC_X_SCREEN_X_OFFSET, ROT_SCREEN_Y_OFFSET, x) | |
SetField(VEC_Y_SCREEN_X_OFFSET, ROT_SCREEN_Y_OFFSET, y) | |
SetField(VEC_Z_SCREEN_X_OFFSET, ROT_SCREEN_Y_OFFSET, z) | |
Sleep(VEC_3_WRITE_DELAY_MS) | |
} | |
; Menu -> Scrolling | |
MAX_MENU_SCROLLS := 8 ; the number of times you need to call "ScrollMenu" to consistently reach the end of the menu | |
SCROLL_SLEEP_MS := 5 ; the number of milliseconds per scroll it yields for the input to be recorded | |
ScrollMenu(is_down) { | |
MouseMove(VEC_Y_SCREEN_X_OFFSET, SCREEN_CENTER_Y_OFFSET) | |
Loop (MAX_MENU_SCROLLS) { | |
if is_down | |
Send("{WheelDown}") | |
else | |
Send("{WheelUp}") | |
Sleep(SCROLL_SLEEP_MS) | |
} | |
} | |
; Menu -> Tag Menu | |
TAGS_MENU_OPEN_BUTTON_X_OFFSET := 1725 ; x screen px coordinate for tags button in menu (assuming scrolled down) | |
TAGS_MENU_OPEN_BUTTON_Y_OFFSET := 676 ; y screen px coordinate for tags button in menu (assuming scrolled down) | |
TagMenuOpen(){ | |
ScrollMenu(true) | |
MouseClick("L", TAGS_MENU_OPEN_BUTTON_X_OFFSET, TAGS_MENU_OPEN_BUTTON_Y_OFFSET) | |
Sleep(MENU_OPEN_DELAY_MS) | |
} | |
TAG_MENU_BACK_BUTTON_X_OFFSET := 1460 ; x screen px coordinate for the back button from the tag menu | |
TAG_MENU_BACK_BUTTON_Y_OFFSET := 95 ; y screen px coordinate for the back button from the tag menu | |
TagMenuClose(){ | |
MouseClick("L", TAG_MENU_BACK_BUTTON_X_OFFSET, TAG_MENU_BACK_BUTTON_Y_OFFSET) | |
Sleep(MENU_CLOSE_DELAY_MS) | |
ScrollMenu(false) | |
} | |
TAG_CARD_1_OFFSET_Y_START := 123 ; y screen px coordinate for the beginning of the first tag card | |
TAG_CARD_2_OFFSET_Y_START := 246 ; y screen px coordinate for the beginning of the second tag card | |
TAG_CARD_1_FIELD_OFFSET_Y := 196 ; y screen px coordinate for the center of the tag field in the first tag card | |
TAG_CARD_FIELD_OFFSET_X := 1730 ; x screen px coordinate for the center of the tag field | |
TAG_CARD_HEIGHT := TAG_CARD_2_OFFSET_Y_START - TAG_CARD_1_OFFSET_Y_START | |
TAG_CARD_LOCAL_FIELD_OFFSET_Y := TAG_CARD_1_FIELD_OFFSET_Y - TAG_CARD_1_OFFSET_Y_START | |
GetTagCardStartHeight(card_index){ | |
return TAG_CARD_1_OFFSET_Y_START + (TAG_CARD_HEIGHT * card_index) | |
} | |
SetTag(card_index, new_tag_value){ | |
SetField(TAG_CARD_FIELD_OFFSET_X, GetTagCardStartHeight(card_index)+TAG_CARD_LOCAL_FIELD_OFFSET_Y, new_tag_value) | |
Sleep(MIN_INPUT_DELAY_MS) | |
Send("{Enter}") | |
Sleep(MIN_INPUT_DELAY_MS) | |
} | |
TAG_CARD_BUTTON_OFFSET_Y := 915 ; y screen px coordinate for the center of the bottom button row | |
TAG_CARD_BUTTON_ADD_NEW_OFFSET_X := 1615 ; x screen px coordinate for the center of the add new button | |
CreateNewTag(){ | |
MouseClick("L", TAG_CARD_BUTTON_ADD_NEW_OFFSET_X, TAG_CARD_BUTTON_OFFSET_Y) | |
Sleep(MIN_INPUT_DELAY_MS) | |
} | |
TAG_CARD_BUTTON_DELETE_OFFSET_X := 1845 ; x screen px coordinate for the center of the delete button | |
DeleteTag(card_index){ | |
MouseClick("L", TAG_MENU_BACK_BUTTON_X_OFFSET, GetTagCardStartHeight(card_index)+TAG_CARD_LOCAL_FIELD_OFFSET_Y) | |
Sleep(MIN_INPUT_DELAY_MS) | |
MouseClick("L", TAG_CARD_BUTTON_DELETE_OFFSET_X, TAG_CARD_BUTTON_OFFSET_Y) | |
Sleep(MIN_INPUT_DELAY_MS) | |
} | |
; Commands | |
Copy() { | |
Send("{Ctrl Down}{c Down}") | |
Sleep(MIN_INPUT_DELAY_MS) | |
Send("{c Up}{Ctrl Up}") | |
Sleep(MIN_COMMAND_DELAY_MS) | |
} | |
Paste() { | |
Send("{Ctrl Down}{v Down}") | |
Sleep(MIN_INPUT_DELAY_MS) | |
Send("{v Up}{Ctrl Up}") | |
Sleep(MIN_COMMAND_DELAY_MS) | |
} | |
MassPaste(count){ | |
index := 0 | |
while index <= count-1{ | |
Paste() | |
index += 1 | |
} | |
} | |
Delete() { | |
Send("{Delete Down}") | |
Sleep(MIN_COMMAND_DELAY_MS) | |
} | |
; Mass Placement | |
SetLine(count, origin_x, origin_y, origin_z, offset_x, offset_y, offset_z){ | |
index := 0 | |
while index <= count-1{ | |
SetPosition(origin_x+offset_x*index, origin_y+offset_y*index, origin_z+offset_z*index) | |
index += 1 | |
} | |
} | |
SetGridXY(count_x, count_y, origin_x, origin_y, origin_z, offset_x, offset_y){ | |
SetPosition(origin_x, origin_y, origin_z) | |
index_x := 0 | |
while index_x <= count_x-1{ | |
index_y := 0 | |
while index_y <= count_y-1{ | |
x := origin_x+offset_x*index_x | |
y := origin_y+offset_y*index_y | |
SetPosition(x, y, origin_z) | |
index_y += 1 | |
} | |
index_x += 1 | |
} | |
} | |
; pressing "esc" will stop this app | |
Esc::ExitApp | |
if WinExist("Muse"){ | |
WinActivate("Muse") | |
; do stuff here | |
}else{ | |
throw(Error("Muse not found")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment