Adnihil Posted April 1, 2017 Share Posted April 1, 2017 Hey what's up I'm having some trouble with a creating a GUI that can be used while a function is happening. There's this online game I play that often crashes so I made a script that automatically opens the game and logs me back in when the game is closed (and it closes error messageboxes too if there are any). I've got a GUI with buttons to start, pauze, and end the script, which works fine when the login-function is not playing, but when the login-function is playing, the buttons become unresponsive until it is finished. Stripped down, the script looks something like this: expandcollapse popupGlobal $started = 0 ; GUI Global $hGUI = GUICreate("Auto login") Global $idSTART = GUICtrlCreateButton("Start", 210, 370, 85, 25) Global $idCLOSE = GUICtrlCreateButton("Quitter", 305, 370, 85, 25) GUISetState(@SW_SHOW, $hGUI) ;Hotkeys: Toggle to switch between Func Deactivated() and Func Activated(). Close to end the entire script. HotKeySet("{PGDN}", "Toggle") HotKeySet("{HOME}", "Close") Deactivated() Func Deactivated() $started = 0 While 1 Switch GUIGetMsg() Case $idSTART Activated() Case $idCLOSE Exit EndSwitch WEnd EndFunc Func Activated() $started = 1 While 1 Switch GUIGetMsg() Case $idSTART Deactivated() Case $idCLOSE Exit EndSwitch ;Function that closes error messages, checks if the game isn't already open, and starts Func Login() if it's not. WEnd EndFunc Func Login() ; Function that opens the game, checks if there's a valid connection, waits for the game to be ready etc, enters the login information, and logs in. EndFunc ;Toggle between Activated() and Deactivated(). Func Toggle() If $started = 0 Then Activated() Else Deactivated() EndIf EndFunc ;Ends entire script. Func Close() Exit EndFunc I could post the entire script if needed. Now, I know why the buttons become unresponsive; There is no 'SwitchGUIGetMsg' in Func Login(), and Func Login() is not in a loop (because it's only supposed to play once every time Func Activated() tells it to). So how can I make it so I can still use the buttons while the Login() is playing? Many thanks in advance! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 1, 2017 Moderators Share Posted April 1, 2017 Adnihil, 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 interaction - and then you will understand why you will get no specific help and this thread will now be locked. However, you might find the Interrupting a running function tutorial in the Wiki a useful read. See you soon with a legitimate question I hope. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts