Skip to content

Instantly share code, notes, and snippets.

@joshhunt
Created July 31, 2024 14:01
Show Gist options
  • Save joshhunt/222b1f847e7a57844a097ed6b6a05b69 to your computer and use it in GitHub Desktop.
Save joshhunt/222b1f847e7a57844a097ed6b6a05b69 to your computer and use it in GitHub Desktop.
SetWorkingDir, %A_ScriptDir%
#SingleInstance, force
CoordMode, Pixel, Screen
CoordMode, Mouse, Screen
#include Gdip_All.ahk
pToken := Gdip_Startup()
; Originally from https://github.com/SwankyT1ger/Verity-Fireteam-Image-Maker
if (!FileExist(A_ScriptDir "\Bin"))
FileCreateDir, % A_ScriptDir "\Bin"
return
F3::
{
CentreWidth := A_ScreenWidth / 2
CentreHeight := A_ScreenHeight / 2
RosterX := (CentreWidth - 888)
RosterWidth := 550
RosterHeight := 64
GuardianX := CentreWidth - 360
GuardianY := CentreHeight - 595
GuardianWidth := 360 * 2
GuardianHeight := 595
InputBox, delay_time, Fireteam Image Maker, Input the amount of time to wait after inspecting a player.`nDefault: 2000`nIncrease this number if loading slowly.
Send u
Sleep 1000
if (delay_time = "")
{
delay_time := "2000"
}
file := FileOpen("MyTextFile.txt", "w")
file.write()
file.close()
FileAppend, ScreenWidth: %A_ScreenWidth%`n, MyTextFile.txt
FileAppend, ScreenHeight: %A_ScreenHeight%`n, MyTextFile.txt
WidthOffset := (A_ScreenWidth - 2560) / 2
CentreWidth := A_ScreenWidth / 2
FileAppend, WidthOffset: %WidthOffset%`n, MyTextFile.txt
loop, 6
{
coords := RosterX "|" ((341 + 75*(A_Index-1)) / 1440 * A_ScreenHeight) "|" RosterWidth "|" RosterHeight
FileAppend, %coords%`n, MyTextFile.txt
snap := Gdip_BitmapFromScreen(coords)
image_name := "Bin\member " A_Index ".bmp"
Gdip_SaveBitmapToFile(snap, image_name)
}
Sleep 1000
selfie_taken := false
num_guardians := 0
loop, 6
{
Click, % (890 / 2560 * A_ScreenWidth) " " ((379 + 75*(A_Index-1)) / 1440 * A_ScreenHeight) " " 0
Sleep 500
PixelGetColor, color, % (1000 / 2560 * A_ScreenWidth), % ((379 + 75*(A_Index-1)) / 1440 * A_ScreenHeight)
sleep 100
Send, {RButton}
Sleep 500
PixelGetColor, color2, % (1000 / 2560 * A_ScreenWidth), % ((379 + 75*(A_Index-1)) / 1440 * A_ScreenHeight)
coords := GuardianX "|" GuardianY "|" GuardianWidth "|" GuardianHeight
if(color != color2){
num_guardians++
Send s
Sleep, % delay_time
snap := Gdip_BitmapFromScreen(coords)
image_name := "Bin\ghost " A_Index ".bmp"
Gdip_SaveBitmapToFile(snap, image_name)
Sleep 100
Send {Esc}
Sleep 1500
}
else if (!selfie_taken) {
num_guardians++
Send {F1}
Sleep 500
Send s
Sleep, % delay_time
snap := Gdip_BitmapFromScreen(coords)
image_name := "Bin\ghost " A_Index ".bmp"
Gdip_SaveBitmapToFile(snap, image_name)
Send u
Sleep 1500
selfie_taken := true
}
else
break
}
;create bitmap and background
FileDelete, FinalImage.png
pBitmap := Gdip_CreateBitmap(GuardianWidth * 3, GuardianHeight * 2)
G := Gdip_GraphicsFromImage(pBitmap)
pBrush := Gdip_BrushCreateSolid(0xff212121)
Gdip_FillRectangle(G, pBrush, 0, 0, GuardianWidth * 3, GuardianHeight * 2)
Gdip_DeleteBrush(pBrush)
;bitmap files
pBitmapGhost1 := Gdip_CreateBitmapFromFile("Bin\Ghost 1.bmp")
pBitmapGhost2 := Gdip_CreateBitmapFromFile("Bin\Ghost 2.bmp")
pBitmapGhost3 := Gdip_CreateBitmapFromFile("Bin\Ghost 3.bmp")
pBitmapGhost4 := Gdip_CreateBitmapFromFile("Bin\Ghost 4.bmp")
pBitmapGhost5 := Gdip_CreateBitmapFromFile("Bin\Ghost 5.bmp")
pBitmapGhost6 := Gdip_CreateBitmapFromFile("Bin\Ghost 6.bmp")
pBitmapMember1 := Gdip_CreateBitmapFromFile("Bin\Member 1.bmp")
pBitmapMember2 := Gdip_CreateBitmapFromFile("Bin\Member 2.bmp")
pBitmapMember3 := Gdip_CreateBitmapFromFile("Bin\Member 3.bmp")
pBitmapMember4 := Gdip_CreateBitmapFromFile("Bin\Member 4.bmp")
pBitmapMember5 := Gdip_CreateBitmapFromFile("Bin\Member 5.bmp")
pBitmapMember6 := Gdip_CreateBitmapFromFile("Bin\Member 6.bmp")
loop, % num_guardians
{
ghost_name := "pBitmapGhost" A_Index
ghost_dx := Mod(A_Index-1, 3) * GuardianWidth
ghost_dy := Floor((A_Index-1)/3)*GuardianHeight
ghost_dw := GuardianWidth ; 470
ghost_dh := GuardianHeight ; 64
ghost_sx := 0
ghost_sy := 0
ghost_sw := GuardianWidth
ghost_sh := GuardianHeight
Gdip_DrawImage(G, %ghost_name%, ghost_dx, ghost_dy, ghost_dw, ghost_dh, ghost_sx, ghost_sy, ghost_sw, ghost_sh)
member_name := "pBitmapMember" A_Index
member_dx := ghost_dx
member_dy := ghost_dy
member_dw := RosterWidth * .85 ; 470
member_dh := RosterHeight * .85 ; 64
member_sx := 0
member_sy := 0
member_sw := RosterWidth
member_sh := RosterHeight
Gdip_DrawImage(G, %member_name%, member_dx, member_dy, member_dw, member_dh, member_sx, member_sy, member_sw, member_sh)
}
;save bitmap to file
Gdip_SaveBitmapToFile(pBitmap, "FinalImage.png")
Gdip_SetBitmapToClipboard(pBitmap)
Gdip_DisposeImage(snap)
MsgBox, Image Made
}
Return
F4::reload
F5::ExitApp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment