Skip to content

Instantly share code, notes, and snippets.

@Skrity
Last active February 5, 2021 05:20
Show Gist options
  • Save Skrity/2ea093aaa0d3d9b02ef9dcc7131688d7 to your computer and use it in GitHub Desktop.
Save Skrity/2ea093aaa0d3d9b02ef9dcc7131688d7 to your computer and use it in GitHub Desktop.
Simple(Advanced) flask overlay for PoE.
; Created by Skrit
; License: The Unlicense
;
; Dependencies: ffplay(ffmpeg)
;
; Description: Script allows to create an overlay of various elements from PoE window.
; Using advanced filtergraph syntax and many of ffmpeg filters you can make virtually any element appear
; as an overlay anywhere on the screen: https://ffmpeg.org/ffmpeg-filters.html#Filtergraph-description
; Example code creates a simple energy shield bar and shows flasks above the character head.
; Example config assumes 1920x1080 and ES bar works best for CI characters,
; on life and half-and-halves it can show non-sense due to how the bar is captured and processed.
;
; Known issues:
; -Currently cursor may flicker during capture, potential fix can be tracked here:
; https://patchwork.ffmpeg.org/project/ffmpeg/patch/HK2PR03MB4596AB273414D034C0F0D34EC63B0@HK2PR03MB4596.apcprd03.prod.outlook.com/
OnExit("ExitFunc")
ExitFunc(ExitReason, ExitCode)
{ ;Crude shutdown handling, can't get WinExist to work here(no need really since name is hashed)
If %title%
WinClose, %title%
}
#IfWinActive, ahk_class POEWindowClass
F2::
global title
If %title% {
WinClose, %title%
title := false
} else {
WinGet, poe,, A
random, hash, 1000, 9999 ;tracking windows is a mess in ahk, doing it by name
title := "flask_overlay_" . hash
Run, ;Split for readablity: https://www.autohotkey.com/docs/Scripts.htm#continuation
(LTrim Join`s
ffplay
-window_title %title%
-noborder -alwaysontop -left 850 -top 220
-f gdigrab -i title="Path of Exile" -framerate 30 -vf
"
split[s0][s1];
[s0]crop=1:200:135:875,rotate=PI/2:ow=ih:oh=iw,scale=220:14,gblur=4,hue=s=10[o0];
[s1]crop=220:76:311:998[o1];
[o0][o1]vstack
"
),, Hide ;hiding console
WinWait, %title%,, 3 ; timeout 3 for script not to get stuck if ffplay fails to start
WinActivate, ahk_id %poe%
;make clickthrough(0x20), remove taskbar icon(0x80) and make layered 0x80000
WinSet, ExStyle, +0x800A0, %title%
WinSet, Transparent, 180, %title%
}
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment