Hi started coding autoit yesterday and created a small project for a game I play.
The GUI works fine but the IF statement does not seem to read the inputs correctly. What have I done wrong? Take in mind I started yesterday so if things could be explained that would be great. Thanks for your time :handsdown:
The GUI works fine but the IF statement does not seem to read the inputs correctly. What have I done wrong? Take in mind I started yesterday so if things could be explained that would be great. Thanks for your time :handsdown:
Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{END}", "Terminate")
#Region ### START Koda GUI section ### Form=
$craftool = GUICreate("SWG Crafting Script", 319, 206, 438, 229)
GUISetBkColor(0xBFCDDB)
$GroupBox1 = GUICtrlCreateGroup("", 8, 1, 297, 193)
GUICtrlSetBkColor(-1, 0x3399FF)
$Input1 = GUICtrlCreateInput("", 152, 32, 137, 21)
$Input2 = GUICtrlCreateInput("", 152, 72, 137, 21)
$Output = GUICtrlCreateInput("", 152, 112, 137, 21)
$Button3 = GUICtrlCreateButton("Calculate", 112, 144, 81, 33)
$Label1 = GUICtrlCreateLabel("Xerco's SWG Crafting Script v0.3", 16, 16, 161, 17)
GUICtrlSetBkColor(-1, 0xBFCDDB)
$Label2 = GUICtrlCreateLabel("Input Crafting Exp per Item", 16, 40, 129, 17)
GUICtrlSetBkColor(-1, 0xBFCDDB)
$Label3 = GUICtrlCreateLabel("Max Skill Experiance", 16, 72, 102, 17)
GUICtrlSetBkColor(-1, 0xBFCDDB)
$Label4 = GUICtrlCreateLabel("Items Left To Craft", 16, 112, 114, 17)
GUICtrlSetBkColor(-1, 0xBFCDDB)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Local $timesCraft, $itemExp , $maxExp, $data3, $ReadT1, $ReadT2, $peakExp, $timesCraft, $macro
While 1
$peakExp = $maxExp * 1.5
$nMsg = GUIGetMsg()
$ReadI1 = GUICtrlRead($Input1)
$ReadI2 = GUICtrlRead($Input2)
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Input1
$itemExp = GUICtrlRead($Input1)
GUICtrlSetData($Input1, $itemExp)
Case $Input2
$maxExp = GUICtrlRead($Input2)
GUICtrlSetData($Input2, $maxExp)
Case $Button3
$timesCraft = GUICtrlRead($Output)
GUICtrlSetData($Output, $peakExp / $itemExp)
If $macro < 7 And $timesCraft > 0 Then
WinActivate("SwgClient", "")
Send($macro)
Sleep(2000)
MouseClick ( "left" , 160, 290, 2 )
Sleep(2000)
MouseClick ( "left" , 160, 290, 4 )
Sleep(2000)
Send("{ESC}")
Sleep(500)
Send("{ESC}")
Sleep(500)
Send("{ESC}")
$timesCraft = $timesCraft - 1
$macro = $macro + 1
If $macro < 7 Then
$macro = 1
EndIf
EndIf
EndSwitch
WEnd
Func TogglePause()
$Paused = NOT $Paused
While $Paused
sleep(100)
ToolTip('Script is "Paused"',0,0)
WEnd
ToolTip("")
EndFunc
Func Terminate()
Exit 0
EndFunc