Running Function 2 after Function 1 finished

09/15/2013 12:50 milk4hunn#1
Hey, its me again.
Im stuck on a problem since yesterday and as much as i hate to ask for help, i really dont know what else to try. I want Function 2 to run after Function 1 has finished. I tried GuiCtrlSetOnEvent and MsgLoop, but i dont really understand it. I tried to read tutorials but they didnt help at all.

The line that are underline is what im talking about. I want gamestart() to run first and when its finished, i want iniviteteam() to run.

Code:
#AutoIt3Wrapper_UseX64=n
#include<File.au3>
#include<autologin.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=


$Form1 = GUICreate("bot", 409, 240)
$_StartBot = GUICtrlCreateButton("Start Bot", 128, 128, 161, 33)
$_StopBot = GUICtrlCreateButton("Close bot", 129, 165, 161, 33)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
HotKeySet("{F1}", "_stopbot") ;Emergency Stop


While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit 1
	EndSwitch
	[U]Select
		Case $nMsg = $_StartBot
			gamestart()
			inviteteam()
	EndSelect[/U]
	Select
		Case $nMsg = $_StopBot
			_stopbot()
	EndSelect
WEnd
09/15/2013 13:06 th0rex#2
Ehh ?
Just let gamestart call inviteteam when it is finished.
09/15/2013 13:23 alpines#3
The Switch-Statement is kinda useless, better use it like this:
Code:
While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit1

		Case $_StartBot
			gamestart()
			inviteteam()

		Case $_StopBot
			_stopbot()
	EndSwitch
WEnd
If these functions don't work like you want to, then the problem is probably inside gamestart().
09/15/2013 13:47 milk4hunn#4
@omitma: I already tried it, but the function didnt run.. or so i thought, just placed a msgbox inside the function and it ran. So it looks like the inviteteam() has a problem somewhere.


@alpines: Thanks, i was wondering if its possible to clean that up a little bit.