Sign in to follow this  
Followers 0
meowbits

GUI wont start

5 posts in this topic

I was trying to get the GameBot script to only have the features to allow the user to pick the four coordinates..

Anyway, I managed to finally get rid of all the error messages. But now it wont even bring up the interface.

I'm not worried about the positioning of it right.. considering I can't see it.

Do you know what I need to change on this? Help is appreciated!

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Dim $pos = "", $CHex = "", $Cpos = "", $Count = 0, $data[11], $Label_[11], $Run, $Launcher, $cwait = 0
Dim $pause, $left = 0, $right = 0, $top = 0, $bottom = 0
Dim $Gloc = @ScriptDir & "\Games\", $Ginfo

Opt("PixelCoordMode", 0)   ;1=absolute, 0=relative, 2=client
Opt("MouseCoordMode", 0)   ;1=absolute, 0=relative, 2=client

HotKeySet("{ESC}", "Terminate")

$Gamebot = GUICreate("FarmBot", 392, 402, -1, -1, -1, $WS_EX_ACCEPTFILES)
$Group_5 = GUICtrlCreateGroup("Game Launch", 10, 80, 370, 80)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
GUICtrlSetState(-1, $GUI_DISABLE)
$Radio_9 = GUICtrlCreateRadio("Dont Launch Anything", 230, 100, 130, 20)
GUICtrlSetState(-1, $GUI_CHECKED)
$Group_10 = GUICtrlCreateGroup("Pixel Search Area", 10, 170, 370, 100)
$Label_11 = GUICtrlCreateLabel("Left              Top             Right         Bottom", 20, 190, 350, 20)
$Input_12 = GUICtrlCreateInput($left, 20, 210, 40, 20)
$Input_13 = GUICtrlCreateInput($top, 80, 210, 40, 20)
$Input_14 = GUICtrlCreateInput($right, 140, 210, 40, 20)
$Input_15 = GUICtrlCreateInput($bottom, 200, 210, 40, 20)
$Button_29 = GUICtrlCreateButton("Get Area", 280, 240, 90, 25)
$Button_33 = GUICtrlCreateButton("Run GameBot", 140, 360, 110, 30)
$Button_34 = GUICtrlCreateButton("Exit GameBot", 270, 360, 110, 30)

; pixel search
     $left = IniRead($Gloc & $Ginfo & ".ini", "Settings", "Left", "None")
     GUICtrlSetData($Input_12, $left)
     $top = IniRead($Gloc & $Ginfo & ".ini", "Settings", "Top", "None")
     GUICtrlSetData($Input_13, $top)
     $right = IniRead($Gloc & $Ginfo & ".ini", "Settings", "Right", "None")
     GUICtrlSetData($Input_14, $right)
     $bottom = IniRead($Gloc & $Ginfo & ".ini", "Settings", "Bottom", "None")
     GUICtrlSetData($Input_15, $bottom)
     $Vary = IniRead($Gloc & $Ginfo & ".ini", "Settings", "Vary", "5")

Func Get_Area()
     $Count = 0
     If GUICtrlRead($Button_29) = "Get Area" Then
         HotKeySet("{F9}", "set_Area")
         ToolTip('Press "F9" to Get the Area under the Mouse Left-Top-Right-Bottom, Click "Done" when Finished', 0, 0)
         GUICtrlSetData($Button_29, "Done")
         Return
     Else
         HotKeySet("{F9}")
         ToolTip('')
         GUICtrlSetData($Button_29, "Get Area")
         $Count = 0
     EndIf
EndFunc;==>Get_Area

Func set_Area()
     $Count = $Count + 1
     $Mpos = MouseGetPos()
     If $Count = 1 Then GUICtrlSetData($Input_12, $Mpos[0])
     If $Count = 2 Then GUICtrlSetData($Input_13, $Mpos[1])
     If $Count = 3 Then GUICtrlSetData($Input_14, $Mpos[0])
     If $Count = 4 Then GUICtrlSetData($Input_15, $Mpos[1])
     If $Count >= 4 Then $Count = 0
EndFunc;==>set_Area

Func _start()
     $Colors = IniReadSection($Gloc & $Ginfo & ".ini", "Colors")
     For $i = 0 To $Colors[0][0]
         $data[$i] = IniRead($Gloc & $Ginfo & ".ini", "Colors", $i, "")
         If $i >= 10 Then ExitLoop
     Next
     $pause = Not $pause
     While $pause
         ToolTip('GameBot is "Running"..   Press F9 to Quit', 0, 0)
         $t = 0
         Do
             $t = $t + 1
             If $t > 10 Then ExitLoop
             Sleep($cwait)
         Until Not @error
         If $t > 10 Then ContinueLoop
         MouseClick("left", $Cpos[0], $Cpos[1], 1, 0)
;MouseMove($left, $top)
     WEnd
     ToolTip('')
     GUISetState(@SW_RESTORE, $Gamebot)
     HotKeySet("{F9}")
EndFunc;==>_start

Func _ReduceMemory()
     Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
     Return $ai_Return[0]
EndFunc;==>_ReduceMemory

Func Terminate()
     Exit
EndFunc;==>Terminate

Share this post


Link to post
Share on other sites



GUISetState() and a While/Wend loop

Man that a butcher job!!

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

GUISetState(@SW_SHOW)

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

case $Button_33

_start()

EndSwitch

WEnd

Edited by KenNichols

[topic="21048"]New to AutoIt? Check out AutoIt 1-2-3![/topic] Need to make a GUI? You NEED KODA FormDesigner!

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

You even had GUISetState in there, but as @SW_RESTORE, and later in the script...

Valuater, as always, is right, you will probably want a loop in there too.

MDiesel

Edit: loops aren't necessary though, just something you will probably need.

Edited by mdiesel

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0