Jump to content

make gui text change when variable changes - (Locked)


adarkz
 Share

Recommended Posts

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>
#include <WinAPI.au3>
#include <WinAPISysWin.au3>

Local $hGUI = 0, $hGraphics = 0, $hBrush = 0, $hFormat = 0, $hFamily = 0, $hFont = 0, $tLayout = 0
local $txt = "OFF"
Global $Paused = False
HotKeySet("{PAUSE}", "TogglePause")
$iVkCode = 0x47 ; code for g
$hWnd = WinGetHandle("Dungeon Defenders 2")
$hWndalt = WinGetHandle("[CLASS:Sandbox:steam:LaunchUnrealUWindowsClient]")
HotKeySet ("{END}", "quitme")
#region GUI
$hGUI = GUICreate("MyGUI", 1919, 1050, -1, -1, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED))
GUISetBkColor(0x000000)

_WinAPI_SetLayeredWindowAttributes($hGUI, 0x000000)
GUISetState(@SW_SHOW, $hGUI)
#endregion

#region Draw
_GDIPlus_Startup()

$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)

$hBrush = _GDIPlus_BrushCreateSolid(0xFF00FF00)

$hFormat = _GDIPlus_StringFormatCreate()
$hFamily = _GDIPlus_FontFamilyCreate("Arial")
$hFont = _GDIPlus_FontCreate($hFamily, 17, 1)
$tLayout = _GDIPlus_RectFCreate(0, 0, 0, 0)

While GUIGetMsg() <> $GUI_EVENT_CLOSE

    While $Paused
        _WinAPI_PostMessage($hWnd, $WM_KEYDOWN, $iVkCode, 0)
        _WinAPI_PostMessage($hWndalt, $WM_KEYDOWN, $iVkCode, 0)
        Sleep(2000)
        _WinAPI_PostMessage($hWnd, $WM_KEYUP, $iVkCode, 0)
        _WinAPI_PostMessage($hWndalt, $WM_KEYUP, $iVkCode, 0)

        _GDIPlus_GraphicsDrawStringEx($hGraphics, $txt, $hFont, $tLayout, $hFormat, $hBrush)

    WEnd
WEnd
#endregion


#region Release ressources
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)

_GDIPlus_BrushDispose($hBrush)

_GDIPlus_GraphicsDispose($hGraphics)

_GDIPlus_Shutdown()

GUIDelete($hGUI)
#endregion
Func TogglePause() ; anywhere in script
$Paused = Not $Paused ; change the state of the var
if $txt = "OFF" Then
    $txt = "ON"
ElseIf $txt = "ON" Then
    $txt = "OFF"

EndIf
EndFunc

Func quitme() ; exit fun
    Exit
EndFunc

so i made this script that auto clicks g for me in a random game but i have tried to make a gui that shows OFF in top of the screen when the auto g is not running ($paused is false) and shows ON when the auto g is running ($paused is True) 

i cant manage to change the gui text and thats what i need help with 
script might be a bit unorganized but feel free to make any changes to make it work pls and ty :)

Link to comment
Share on other sites

  • Developers

Welcome to the AutoIt forum.

Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked.

See you soon with a legitimate question I hope.

The Moderation team

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...