Here is the code I am using for the test script.
Code: Select all
Gui, 4:+Owner +AlwaysOnTop -Caption +Toolwindow +LastFound
Gui, 4:Color, F0F0F0
WinSet, TransColor, F0F0F0
WinSet, Transparent, 225
WinSet, Region, 0-0 R45-45
Gui, 4:Add, Picture, x0 y0 w420 h340, HaloHosting.png
Gui, 4:Add, Picture, x20 y25 BackgroundTrans gShowPlayers, ShowPlayers.png
Gui, 4:Add, Picture, x20 y85 BackgroundTrans gKickPlayer, KickPlayer.png
Gui, 4:Add, Picture, x20 y145 BackgroundTrans gBanPlayer, BanPlayer.png
Gui, 4:Add, Picture, x20 y205 BackgroundTrans gUnbanPlayer, UnbanPlayer.png
Gui, 4:Add, Picture, x20 y265 BackgroundTrans gResetMap, ResetMap.png
Gui, 4:Show, W420 H340
OnMessage(0x200, "WM_MOUSEMOVE") ; WM_MOUSEMOVE = 0x2A1
Esc::
ExitApp
WM_MOUSEMOVE(wParam, lParam, msg, hwnd)
{
static previousHoveredControl := ""
MouseGetPos positionX, positionY, hoveredWindow, hoveredControl, 2
if(previousHoveredControl != hoveredControl)
{
if(previousHoveredControl)
{
GuiControlGet OriginalPictureName, , % previousHoveredControl
GuiControl, , % previousHoveredControl, % OriginalPictureName
previousHoveredControl := ""
}
if(hoveredControl)
{
GuiControlGet OriginalPictureName, , % hoveredControl
HoveredPictureName := StrReplace(OriginalPictureName, ".png", "2.png")
GuiControl, , % hoveredControl, % HoveredPictureName
previousHoveredControl := hoveredControl
}
}
if(hoveredControl)
{
GuiControlGet OriginalPictureName, , % hoveredControl
if(OriginalPictureName != "HaloHosting.png")
{ ; Just exclude it here
HoveredPictureName := StrReplace(OriginalPictureName, ".png", "2.png")
GuiControl, , % hoveredControl, % HoveredPictureName
previousHoveredControl := hoveredControl
}
}
}
ShowPlayers:
MsgBox, You clicked on Show Players
return
KickPlayer:
return
BanPlayer:
return
UnbanPlayer:
return
ResetMap:
return
I took your advice and the gui works good in halo except for 2 problems.
1. Where do I put my gLabels now. Example: gShowPlayers which shows the players currently playing on our server.
2. The cursor is changing images correctly but the selection goes to the plain blue text images below the one the cursor displays. I know this because if I leave the cursor over Shower Players the correct image displays. But if I push the up or down keys on the keyboard the selection moves up or down the plain blue text images. Instead it needs to display the same images the cursor displays.
Here is the code I am using in my halo script. I have commented out the old Gui except for what is needed.
Code: Select all
~`::
If vConsoleFlag = 0
{
If vHaloExecution = Window
{
IfWinActive TeamSpeak 2
{
vConsoleFlag = 0
Return
}
IfWinActive TeamSpeak 3
{
vConsoleFlag = 0
Return
}
IfWinActive Chat Buttons
{
vConsoleFlag = 0
Return
}
IfWinActive Chat Setup
{
vConsoleFlag = 0
Return
}
If vMultiPlayer = Joining
{
If vUseDirectIP = Yes
{
Sleep 500
Gui, 4:+Owner +AlwaysOnTop -Caption +Toolwindow +LastFound
Gui, 4:Color, F0F0F0
WinSet, TransColor, F0F0F0
WinSet, Transparent, 240
WinSet, Region, 0-0 W820 H400 R45-45
; Gui, 4:Margin, 0, 0
Gui, 4:Add, Picture, x0 y0 w820 h400, HaloJoining.png
Gui, 4:Add, Picture, x20 y25 BackgroundTrans gShowPlayers, ShowPlayers.png
Gui, 4:Add, Picture, x20 y85 BackgroundTrans gKickPlayer, KickPlayer.png
Gui, 4:Add, Picture, x20 y145 BackgroundTrans gBanPlayer, BanPlayer.png
Gui, 4:Add, Picture, x20 y205 BackgroundTrans gUnbanPlayer, UnbanPlayer.png
Gui, 4:Add, Picture, x20 y265 BackgroundTrans gBanList, BanList.png
Gui, 4:Add, Picture, x20 y325 BackgroundTrans gResetMap, ResetMap.png
; Gui, 4:Font, cMaroon s10 w700
; Gui, 4:Add, GroupBox, xm+115 ym+5 Section w110 h205, Map Control
; Gui, 4:Font, s9 w300
Gui, 4:Add, Picture, x410 y25 BackgroundTrans gStartMapcycle, StartMapcycle.png
Gui, 4:Add, Picture, x410 y85 BackgroundTrans gCurrentMaps, CurrentMaps.png
Gui, 4:Add, Picture, x410 y145 BackgroundTrans gAddMap, AddMap.png
Gui, 4:Add, Picture, x410 y205 BackgroundTrans gDeleteMap, DeleteMap.png
Gui, 4:Add, Picture, x410 y265 BackgroundTrans gNextMap, NextMap.png
Gui, 4:Add, Picture, x410 y325 BackgroundTrans gChooseMap, ChooseMap.png
Gui, 4:Show, W820 H400
; WinSet, Transparent, 230, Joining Console Buttons
vConsoleFlag = 1
return
}
Else If vUseDirectIP = No
{
return
}
}
Else If vMultiPlayer = Hosting
{
#Include Class_ImageButton.ahk ; https://autohotkey.com/boards/viewtopic.php?f=6&t=1103
DisableFadeEffect()
; Create background
Gui, 4:Color, White
Gui, 4:-Caption +LastFound +Owner +AlwaysOnTop
WinSet, TransColor, White
WinSet, Transparent, 225
WinSet, Region, 0-0 W420 H340 R45-45
Gui, 4:Add, Button, x0 y0 w420 h340 HWNDhBtn Disabled
opt1 := [0, 0x39495F,,, 25, "White", 0x409FFD, 5]
ImageButton.Create(hBtn, opt1, "", "", opt1)
; Create buttons
Gui, 4:Font, s26 bold, Arial
Gui, 4:Margin, x0 y0,
CreateImgBtn("xp+20 yp+25 w380 h50", "SHOW PLAYERS")
CreateImgBtn("wp hp", "KICK PLAYER")
CreateImgBtn("wp hp", "BAN PLAYER")
CreateImgBtn("wp hp", "UNBAN PLAYER")
CreateImgBtn("wp hp", "RESET MAP")
Gui, 4:Show
; Return
;GuiClose:
;ExitApp
CreateImgBtn(Options, Text) {
global
static opt1 := [0, 0x39495F, "", 0x40A0FE]
static opt2 := [0, 0x253245, "", 0xD1D1D1, 22, 0x38485E, 0x40A0FE, 5]
Gui, 4:Add, Button, %Options% HWNDhBtn, %Text%
ImageButton.Create(hBtn, opt1, opt2)
}
DisableFadeEffect() {
; SPI_GETCLIENTAREAANIMATION = 0x1042
DllCall("SystemParametersInfo", "UInt", 0x1042, "UInt", 0, "UInt*", isEnabled, "UInt", 0)
if isEnabled {
; SPI_SETCLIENTAREAANIMATION = 0x1043
DllCall("SystemParametersInfo", "UInt", 0x1043, "UInt", 0, "UInt", 0, "UInt", 0)
Progress, 10:P100 Hide
Progress, 10:Off
DllCall("SystemParametersInfo", "UInt", 0x1043, "UInt", 0, "UInt", 1, "UInt", 0)
}
}
; Gui, 4:+Owner +AlwaysOnTop -Caption +Toolwindow +LastFound
; Gui, 4:Color, F0F0F0
; WinSet, TransColor, F0F0F0
; WinSet, Transparent, 225
; WinSet, Region, 0-0 W420 H340 R45-45
; Gui, 4:Add, Picture, x0 y0 w420 h340, HaloHosting.png
; Gui, 4:Add, Picture, x20 y25 BackgroundTrans gShowPlayers, ShowPlayers.png
; Gui, 4:Add, Picture, x20 y25 Hidden BackgroundTrans gShowPlayers, ShowPlayers2.png
; Gui, 4:Add, Picture, x20 y85 BackgroundTrans gKickPlayer, KickPlayer.png
; Gui, 4:Add, Picture, x20 y85 Hidden BackgroundTrans gKickPlayer, KickPlayer2.png
; Gui, 4:Add, Picture, x20 y145 BackgroundTrans gBanPlayer, BanPlayer.png
; Gui, 4:Add, Picture, x20 y145 Hidden BackgroundTrans gBanPlayer, BanPlayer2.png
; Gui, 4:Add, Picture, x20 y205 BackgroundTrans gUnbanPlayer, UnbanPlayer.png
; Gui, 4:Add, Picture, x20 y205 Hidden BackgroundTrans gUnbanPlayer, UnbanPlayer2.png
; Gui, 4:Add, Picture, x20 y265 BackgroundTrans gResetMap, ResetMap.png
; Gui, 4:Add, Picture, x20 y265 Hidden BackgroundTrans gResetMap, ResetMap2.png
; Gui, 4:Show, W420 H340
MouseMove, 210, 50
vConsoleFlag = 1
}
}
Else If HaloExecution = Full Screen
{
vConsoleFlag = 0
}
}
Else If vConsoleFlag = 1
{
vConsoleFlag = 0
Sleep 100
Gui, 4:Destroy
WinActivate Halo
SendEvent {Enter}
}
Return