From 655355f34af0c1a59e9d46f2ddfe6d0fb4042a33 Mon Sep 17 00:00:00 2001 From: Connor Date: Sun, 8 Nov 2020 17:00:37 -0800 Subject: [PATCH 1/4] --- phasmo.ahk | 133 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 phasmo.ahk diff --git a/phasmo.ahk b/phasmo.ahk new file mode 100644 index 0000000..a71cd93 --- /dev/null +++ b/phasmo.ahk @@ -0,0 +1,133 @@ +#SingleInstance Force +#IfWinActive ahk_exe Phasmophobia.exe +Return + +; 1 = EMF Reader +; 2 = Flashlight +; 3 = Photo Camera +; 4 = Lighter +; 5 = Candle +; 6 = UV Light +; 7 = Crucifix +; 8 = Video Camera +; 9 = Spirit Box +; 10 = Salt +; 11 = Smudge Sticks +; 12 = Tripod +; 13 = Strong Flashlight +; 14 = Motion Sensor +; 15 = Sound Sensor +; 16 = Thermometer +; 17 = Sanity Pills +; 18 = Ghost Writing Book +; 19 = Infrared Light Sensor +; 20 = Parabolic Microphone +; 21 = Glowstick +; 22 = Head Mounted Camera + +*,:: +; add just the stuff you need. +Prologue("ahk_class UnityWndClass", mouseX, mouseY) +PhasmoAdd(2) ; Flashlight +PhasmoAdd(3) ; Photo Camera +PhasmoAdd(4) ; Lighter +PhasmoAdd(7) ; Crucifix +PhasmoAdd(8) ; Video Camera +PhasmoAdd(10) ; Salt +PhasmoAdd(11) ; Smudge Sticks +PhasmoAdd(12) ; Tripod +PhasmoAdd(13,2) ; Strong Flashlight (x2) +PhasmoAdd(14) ; Motion Sensor +PhasmoAdd(16) ; Thermometer +PhasmoAdd(17,4) ; Sanity Pills (x4) +PhasmoAdd(21) ; Glowstick +PhasmoAdd(22) ; Head Mounted Camera +Epilogue(mouseX, mouseY) +Return + +*;:: +; add one of everything. +Prologue("ahk_class UnityWndClass", mouseX, mouseY) +Loop 22 { + PhasmoAdd(A_Index) +} +Epilogue(mouseX, mouseY) +Return + +*':: +; remove one of everything. +Prologue("ahk_class UnityWndClass", mouseX, mouseY) +Loop 22 { + PhasmoRemove(A_Index) +} +Epilogue(mouseX, mouseY) +Return + +; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; +; internal stuff from hereon ; +; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; + +GetClientSize(hwnd, ByRef w, ByRef h) +{ + VarSetCapacity(rc, 16) + DllCall("GetClientRect", "uint", hwnd, "uint", &rc) + w := NumGet(rc, 8, "int") + h := NumGet(rc, 12, "int") +} + +Prologue(hint, ByRef mouseX, ByRef mouseY) +{ + global winW, winH + hwnd := WinExist(hint) + GetClientSize(hwnd, winW, winH) + SetDefaultMouseSpeed 0 + SetMouseDelay 0 + CoordMode Mouse, Screen + MouseGetPos mouseX, mouseY ; store mouse position to restore later + CoordMode Mouse, Client +} + +Epilogue(mouseX, mouseY) +{ + CoordMode Mouse, Screen + MouseMove mouseX, mouseY ; restore original mouse position + Sleep 100 ; prevent accidental repetition of macro +} + +PhasmoAdd(id, n:=1) +{ + global winW, winH + fakeW := 1.6 * winH + off := (winW - fakeW) / 2 + If id between 1 and 15 + MouseMove % off + fakeW * 0.41, winH * (id + 11.5) / 37.1 + If id between 16 and 22 + MouseMove % off + fakeW * 0.72, winH * (id - 3.5) / 37.1 + Sleep 10 + Click + Loop % n - 1 + { + Sleep 60 + Click + } + Sleep 10 +} + +PhasmoRemove(id, n:=1) +{ + global winW, winH + fakeW := 1.6 * winH + off := (winW - fakeW) / 2 + If id between 1 and 15 + MouseMove % off + fakeW * 0.435, winH * (id + 11.5) / 37.1 + If id between 16 and 22 + MouseMove % off + fakeW * 0.745, winH * (id - 3.5) / 37.1 + Sleep 10 + Click + Loop % n - 1 + { + Sleep 50 + Click + } + Sleep 10 +} From a4dd7f6ee93f905d2451be74fba383af80a69d0c Mon Sep 17 00:00:00 2001 From: Connor Date: Sun, 8 Nov 2020 17:03:11 -0800 Subject: [PATCH 2/4] --- phasmo.ahk | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/phasmo.ahk b/phasmo.ahk index a71cd93..7d1b66b 100644 --- a/phasmo.ahk +++ b/phasmo.ahk @@ -48,23 +48,21 @@ Return *;:: ; add one of everything. Prologue("ahk_class UnityWndClass", mouseX, mouseY) -Loop 22 { +Loop 22 PhasmoAdd(A_Index) -} Epilogue(mouseX, mouseY) Return *':: ; remove one of everything. Prologue("ahk_class UnityWndClass", mouseX, mouseY) -Loop 22 { +Loop 22 PhasmoRemove(A_Index) -} Epilogue(mouseX, mouseY) Return ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; -; internal stuff from hereon ; +; internal stuff from hereon! ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; GetClientSize(hwnd, ByRef w, ByRef h) @@ -130,4 +128,4 @@ PhasmoRemove(id, n:=1) Click } Sleep 10 -} +} \ No newline at end of file From 733bd0fbd6f42d32976ce2e00efcf40f939d85e2 Mon Sep 17 00:00:00 2001 From: Connor Date: Sun, 8 Nov 2020 17:08:18 -0800 Subject: [PATCH 3/4] --- phasmo.ahk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phasmo.ahk b/phasmo.ahk index 7d1b66b..ad9e3d9 100644 --- a/phasmo.ahk +++ b/phasmo.ahk @@ -35,7 +35,7 @@ PhasmoAdd(7) ; Crucifix PhasmoAdd(8) ; Video Camera PhasmoAdd(10) ; Salt PhasmoAdd(11) ; Smudge Sticks -PhasmoAdd(12) ; Tripod +PhasmoAdd(12,2) ; Tripod (x2) PhasmoAdd(13,2) ; Strong Flashlight (x2) PhasmoAdd(14) ; Motion Sensor PhasmoAdd(16) ; Thermometer @@ -128,4 +128,4 @@ PhasmoRemove(id, n:=1) Click } Sleep 10 -} \ No newline at end of file +} From a3f1adadc2e00385dfd9902a14726bfd62198304 Mon Sep 17 00:00:00 2001 From: Connor Date: Tue, 10 Nov 2020 18:16:02 -0800 Subject: [PATCH 4/4] --- phasmo.ahk | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/phasmo.ahk b/phasmo.ahk index ad9e3d9..d50eaf5 100644 --- a/phasmo.ahk +++ b/phasmo.ahk @@ -92,15 +92,12 @@ Epilogue(mouseX, mouseY) Sleep 100 ; prevent accidental repetition of macro } -PhasmoAdd(id, n:=1) +PhasmoClick(relX, relY, n:=1) { global winW, winH fakeW := 1.6 * winH off := (winW - fakeW) / 2 - If id between 1 and 15 - MouseMove % off + fakeW * 0.41, winH * (id + 11.5) / 37.1 - If id between 16 and 22 - MouseMove % off + fakeW * 0.72, winH * (id - 3.5) / 37.1 + MouseMove % off + fakeW * relX, winH * relY Sleep 10 Click Loop % n - 1 @@ -111,21 +108,18 @@ PhasmoAdd(id, n:=1) Sleep 10 } +PhasmoAdd(id, n:=1) +{ + If id between 1 and 15 + PhasmoClick(0.41, (id + 11.5) / 37.1, n) + If id between 16 and 22 + PhasmoClick(0.72, (id - 3.5) / 37.1, n) +} + PhasmoRemove(id, n:=1) { - global winW, winH - fakeW := 1.6 * winH - off := (winW - fakeW) / 2 If id between 1 and 15 - MouseMove % off + fakeW * 0.435, winH * (id + 11.5) / 37.1 + PhasmoClick(0.435, (id + 11.5) / 37.1, n) If id between 16 and 22 - MouseMove % off + fakeW * 0.745, winH * (id - 3.5) / 37.1 - Sleep 10 - Click - Loop % n - 1 - { - Sleep 50 - Click - } - Sleep 10 + PhasmoClick(0.745, (id - 3.5) / 37.1, n) }