gui on game

Ask gaming related questions (AHK v1.1 and older)
axo
Posts: 32
Joined: 10 May 2022, 10:50

gui on game

Post by axo » 04 Dec 2022, 11:40

Hello i am working on script that scan square on screen for color of enemy in valorant. If it find the color it will place gui on enemy head.
But whenever it place the gui on the head it will place the gui to the fore and then i cant interact with the game i need to click somewhere on the screen to play again. How can i make it so
when the gui will move i can still play the game like before.

Code:

Code: Select all

valx := 200
valy := 200

resw := 1920
resh := 1080

xfov1:= (resw//2 -valx)
yfov1:= (resh//2 -valy)

xfov2:= (resw//2 +valx)
yfov2:= (resh//2 +valy)


gui,  +Owner +AlwaysOnTop -caption
Gui, Show, w25 h25 NoActivate, gui

loop {
sleep, 1000
CoordMode, Pixel, Screen
PixelSearch, FoundX, FoundY, xfov1, yfov1, xfov2, yfov2, 0xFF71FF, 40, Fast RGB
If (ErrorLevel = 0){
gui,  +Owner +AlwaysOnTop -caption
Gui, Show, w25 h25 x%FoundX% y%FoundY% , gui
WinMove, gui,, %FoundX%, %FoundY%
}
Else If (ErrorLevel = 1){
msgbox,no
}
}
return

f7::exitapp
Video:
https://www.youtube.com/watch?v=Bt2VeLppiWE&feature=youtu.be


So how can i do so i will see the gui but it will not interact with the game ?

User avatar
mikeyww
Posts: 26883
Joined: 09 Sep 2014, 18:38

Re: gui on game

Post by mikeyww » 04 Dec 2022, 11:58

Gui, Show:
NoActivate: Unminimizes or unmaximizes the window, if necessary. The window is also shown without activating it.
You can include it in both such lines.

axo
Posts: 32
Joined: 10 May 2022, 10:50

Re: gui on game

Post by axo » 04 Dec 2022, 12:00

Already tried that but then it will stom moving the gui ... it will just stay on one spot

axo
Posts: 32
Joined: 10 May 2022, 10:50

Re: gui on game

Post by axo » 04 Dec 2022, 12:00

Like this

Code: Select all

valx := 200
valy := 200

resw := 1920
resh := 1080

xfov1:= (resw//2 -valx)
yfov1:= (resh//2 -valy)

xfov2:= (resw//2 +valx)
yfov2:= (resh//2 +valy)


gui,  +Owner +AlwaysOnTop -caption
Gui, Show, w25 h25 NoActivate, gui

loop {
sleep, 2500
CoordMode, Pixel, Screen
PixelSearch, FoundX, FoundY, xfov1, yfov1, xfov2, yfov2, 0xFF71FF, 40, Fast RGB
If (ErrorLevel = 0){
gui,  +Owner +AlwaysOnTop -caption
Gui, Show, w25 h25 x%FoundX% y%FoundY% NoActivate , gui
WinMove, gui,, %FoundX%, %FoundY%
}
Else If (ErrorLevel = 1){
msgbox,no
}
}
return

f7::exitapp

axo
Posts: 32
Joined: 10 May 2022, 10:50

Re: gui on game

Post by axo » 04 Dec 2022, 12:02

nvm got it
i added "WinActivate, VALORANT"
after the gui,show and it work

axo
Posts: 32
Joined: 10 May 2022, 10:50

Re: gui on game

Post by axo » 04 Dec 2022, 12:06

one more thing ...
how can i make it faster ?
because this scan it but its kinda slow amma upload video

Code: Select all

valx := 700
valy := 700

resw := 1920
resh := 1080

xfov1:= (resw//2 -valx)
yfov1:= (resh//2 -valy)

xfov2:= (resw//2 +valx)
yfov2:= (resh//2 +valy)


gui,  +Owner +AlwaysOnTop -caption
Gui, Show, w25 h25 NoActivate, gui

loop {
CoordMode, Pixel, Screen
PixelSearch, FoundX, FoundY, xfov1, yfov1, xfov2, yfov2, 0xFF71FF, 40, Fast RGB
If (ErrorLevel = 0){
gui,  +Owner +AlwaysOnTop -caption
Gui, Show, w25 h25 x%FoundX% y%FoundY% NoActivate , gui
WinActivate, VALORANT
WinMove, gui,, %FoundX%, %FoundY%
}
Else If (ErrorLevel = 1){

}
}
return

f7::exitapp


User avatar
mikeyww
Posts: 26883
Joined: 09 Sep 2014, 18:38

Re: gui on game

Post by mikeyww » 04 Dec 2022, 14:08

I'm not sure, but some people have used GDI+ (or Gdip) to speed certain actions with graphics. You might search the forum for those ideas. Good luck! :wave:

Post Reply

Return to “Gaming Help (v1)”