Skip to content

Instantly share code, notes, and snippets.

@notwa
Last active September 2, 2021 17:07
Show Gist options
  • Save notwa/e7bff589d97fa6826bd9c0566c314358 to your computer and use it in GitHub Desktop.
Save notwa/e7bff589d97fa6826bd9c0566c314358 to your computer and use it in GitHub Desktop.
phasmophobia macro script for adding and removing items
#SingleInstance Force
#IfWinActive ahk_exe Phasmophobia.exe
Return
; 1 = D.O.T.S Projector
; 2 = EMF Reader
; 3 = Flashlight
; 4 = Ghost Writing Book
; 5 = Spirit Box
; 6 = UV Light
; 7 = Video Camera
; 8 = Candle
; 9 = Crucifix
; 10 = Glowstick
; 11 = Head Mounted Camera
; 12 = Lighter
; 13 = Motion Sensor
; 14 = Parabolic Microphone
; 15 = Photo Camera
; 16 = Salt
; 17 = Sanity Pills
; 18 = Smudge Sticks
; 19 = Sound Sensor
; 20 = Strong Flashlight
; 21 = Thermometer
; 22 = Tripod
*,::
; add just the stuff you need.
Prologue("ahk_class UnityWndClass", mouseX, mouseY)
PhasmoAdd(1) ; D.O.T.S Projector
PhasmoAdd(3) ; Flashlight
PhasmoAdd(7) ; Video Camera
PhasmoAdd(9) ; Crucifix
PhasmoAdd(10) ; Glowstick
PhasmoAdd(11) ; Head Mounted Camera
PhasmoAdd(12) ; Lighter
PhasmoAdd(13) ; Motion Sensor
PhasmoAdd(15) ; Photo Camera
PhasmoAdd(16) ; Salt
PhasmoAdd(17,4) ; Sanity Pills (x4)
PhasmoAdd(18) ; Smudge Sticks
PhasmoAdd(20,2) ; Strong Flashlight (x2)
PhasmoAdd(21) ; Thermometer
PhasmoAdd(22,2) ; Tripod (x2)
Epilogue(mouseX, mouseY)
Return
*/::
; add "All" of everything.
Prologue("ahk_class UnityWndClass", mouseX, mouseY)
Loop 22
PhasmoAll(A_Index)
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
}
PhasmoClick(relX, relY, n:=1)
{
global winW, winH
fakeW := 1.6 * winH
off := (winW - fakeW) / 2
MouseMove % off + fakeW * relX, winH * relY
Sleep 10
Click
Loop % n - 1
{
Sleep 170
Click
}
Sleep 10
}
PhasmoAll(id, n:=1)
{
If id between 1 and 7
PhasmoClick(0.395, (id + 9.7) / 33.1, n)
If id between 8 and 22
PhasmoClick(0.795, (id + 3.7) / 36.4, n)
}
PhasmoAdd(id, n:=1)
{
If id between 1 and 7
PhasmoClick(0.340, (id + 9.7) / 33.1, n)
If id between 8 and 22
PhasmoClick(0.740, (id + 3.7) / 36.4, n)
}
PhasmoRemove(id, n:=1)
{
If id between 1 and 7
PhasmoClick(0.360, (id + 9.7) / 33.1, n)
If id between 8 and 22
PhasmoClick(0.760, (id + 3.7) / 36.4, n)
}
@notwa
Copy link
Author

notwa commented Nov 9, 2020

public domain

@notwa
Copy link
Author

notwa commented Sep 2, 2021

updated for 0.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment