DexterCry Posted April 28, 2010 Posted April 28, 2010 Can some1 help me ? i made this script and everything works great until i press EXIT BUTTON if opt1 is checked . I think it makes a loop inside the while from " If GUICtrlRead($AA_Radio_1) = 1 Then ". If i select opt2 in 1 or 2 sec it close. I want to rearange the code to work even opt1 is checked. I want to mention that this script will run on a private server so no terms will be broken becouse i own the server . expandcollapse popup#Include <NomadMemory.au3> #include <GUIConstantsEx.au3> #include <ComboConstants.au3> GUICreate("TEST", 200, 200) GUISetState(@SW_SHOW) $BB = GUICtrlCreateGroup("Mod ", 15, 70, 115, 55) GUICtrlSetFont($BB, "8", 1000) $AA = GUICtrlCreateGroup("Alege ", 15, 10, 115, 55) GUICtrlSetFont($AA, "8", 1000) GUIStartGroup() $AA_Radio_1 = GUICtrlCreateRadio( "opt1", 20, 105, -1, 13) $AA_Radio_2 = GUICtrlCreateRadio( "opt2", 20, 85, -1, 13) $input1 = GUICtrlCreateInput("1", 20, 30, 30, 20) $Button_1 = GUICtrlCreateButton("Exit", 50, 150, 100) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit EndIf ;buton exit Select Case $msg = $Button_1 Exit EndSelect $server = GUICtrlRead($input1) If GUICtrlRead($AA_Radio_1) = 1 Then $viata = 0x00E5F7E8 $mana = 0x00E5F7F0 $monstru = 0x0108EEAC $Handle = _memoryopen(WinGetProcess("Private (Server 1: Realm "& $server &" )")) ;AICI E VIATA **************************************************************************************** $viata2 = _MemoryRead($viata, $Handle, 'dword') If $viata2 < 10000 Then controlSend("Private (Server 1: Realm "& $server &" )", "", "", "{F1}") EndIf ;**************************************************************************************************** ;AICI E MANA***************************************************************************************** $mana2 = _MemoryRead($mana, $Handle, 'dword') If $mana2 < 1000 Then controlSend("Private (Server 1: Realm "& $server &" )", "", "", "{F2}") EndIf ;**************************************************************************************************** ;; monstru ****************************************************************************************** $monstru2 = _MemoryRead($monstru, $Handle, 'dword') If $monstru2 = 1 Then controlSend("Private (Server 1: Realm "& $server &" )", "", "", "{2}") sleep(500) controlSend("Private (Server 1: Realm "& $server &" )", "", "", "{3}") sleep(500) controlSend("Private (Server 1: Realm "& $server &" )", "", "", "{4}") sleep(500) Else; daca nu exista apasa TAB controlSend("Private (Server 1: Realm "& $server &" )", "", "", "{T}") sleep(500) EndIf ;;*************************************************************************************************** _MemoryClose($Handle) Else $viata = 0x00E5F7E8 $mana = 0x00E5F7F0 $monstru = 0x0108EEAC $Handle = _memoryopen(WinGetProcess("Private (Server 1: Realm "& $server &" )")) ;AICI E VIATA **************************************************************************************** $viata2 = _MemoryRead($viata, $Handle, 'dword') If $viata2 < 10000 Then controlSend("Private (Server 1: Realm "& $server &" )", "", "", "{F1}") EndIf ;**************************************************************************************************** ;AICI E MANA***************************************************************************************** $mana2 = _MemoryRead($mana, $Handle, 'dword') If $mana2 < 2000 Then controlSend("Private (Server 1: Realm "& $server &" )", "", "", "{F2}") EndIf ;**************************************************************************************************** _MemoryClose($Handle) EndIf WEnd
enaiman Posted April 29, 2010 Posted April 29, 2010 Messy-messy code What do you think indentation is used for? Also - the whole piece of code between While-WEnd should be put in a function. Here is the code; work a little bit on it. expandcollapse popup#Include <NomadMemory.au3> #include <GUIConstantsEx.au3> #include <ComboConstants.au3> GUICreate("TEST", 200, 200) GUISetState(@SW_SHOW) $BB = GUICtrlCreateGroup("Mod ", 15, 70, 115, 55) GUICtrlSetFont($BB, "8", 1000) $AA = GUICtrlCreateGroup("Alege ", 15, 10, 115, 55) GUICtrlSetFont($AA, "8", 1000) GUIStartGroup() $AA_Radio_1 = GUICtrlCreateRadio( "opt1", 20, 105, -1, 13) $AA_Radio_2 = GUICtrlCreateRadio( "opt2", 20, 85, -1, 13) $input1 = GUICtrlCreateInput("1", 20, 30, 30, 20) $Button_1 = GUICtrlCreateButton("Exit", 50, 150, 100) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $Button_1 _MyFunc() EndSwitch WEnd Func _MyFunc() $server = GUICtrlRead($input1) If GUICtrlRead($AA_Radio_1) = 1 Then $viata = 0x00E5F7E8 $mana = 0x00E5F7F0 $monstru = 0x0108EEAC $Handle = _memoryopen(WinGetProcess("Private (Server 1: Realm "& $server &" )")) ;AICI E VIATA **************************************************************************************** $viata2 = _MemoryRead($viata, $Handle, 'dword') If $viata2 < 10000 Then controlSend("Private (Server 1: Realm "& $server &" )", "", "", "{F1}") EndIf ;**************************************************************************************************** ;AICI E MANA***************************************************************************************** $mana2 = _MemoryRead($mana, $Handle, 'dword') If $mana2 < 1000 Then controlSend("Private (Server 1: Realm "& $server &" )", "", "", "{F2}") EndIf ;**************************************************************************************************** ;; monstru ****************************************************************************************** $monstru2 = _MemoryRead($monstru, $Handle, 'dword') If $monstru2 = 1 Then controlSend("Private (Server 1: Realm "& $server &" )", "", "", "{2}") sleep(500) controlSend("Private (Server 1: Realm "& $server &" )", "", "", "{3}") sleep(500) controlSend("Private (Server 1: Realm "& $server &" )", "", "", "{4}") sleep(500) Else; daca nu exista apasa TAB controlSend("Private (Server 1: Realm "& $server &" )", "", "", "{T}") sleep(500) EndIf ;;*************************************************************************************************** _MemoryClose($Handle) Else $viata = 0x00E5F7E8 $mana = 0x00E5F7F0 $monstru = 0x0108EEAC $Handle = _memoryopen(WinGetProcess("Private (Server 1: Realm "& $server &" )")) ;AICI E VIATA **************************************************************************************** $viata2 = _MemoryRead($viata, $Handle, 'dword') If $viata2 < 10000 Then controlSend("Private (Server 1: Realm "& $server &" )", "", "", "{F1}") EndIf ;**************************************************************************************************** ;AICI E MANA***************************************************************************************** $mana2 = _MemoryRead($mana, $Handle, 'dword') If $mana2 < 2000 Then controlSend("Private (Server 1: Realm "& $server &" )", "", "", "{F2}") EndIf ;**************************************************************************************************** _MemoryClose($Handle) EndIf EndFunc SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
DexterCry Posted April 29, 2010 Author Posted April 29, 2010 tnx for help rewrite code but its not working properly.i want to loop the function _MyFunc from If GUICtrlRead($AA_Radio_1) = 1 Then.i tried with While and with DO but wen i press EXIT BUTTON its not closing, i have put the UNTIL $msg = $Button_2 OR $msg = $GUI_EVENT_CLOSE but still not closing and continue loopingexpandcollapse popup#Include <NomadMemory.au3> #include <GUIConstantsEx.au3> #include <ComboConstants.au3> GUICreate("TEST", 200, 200) GUISetState(@SW_SHOW) $BB = GUICtrlCreateGroup("Mod ", 15, 70, 115, 55) GUICtrlSetFont($BB, "8", 1000) $AA = GUICtrlCreateGroup("Alege ", 15, 10, 115, 55) GUICtrlSetFont($AA, "8", 1000) GUIStartGroup() $AA_Radio_1 = GUICtrlCreateRadio( "opt1", 20, 105, -1, 13) $AA_Radio_2 = GUICtrlCreateRadio( "opt2", 20, 85, -1, 13) $input1 = GUICtrlCreateInput("1", 20, 30, 30, 20) $Button_1 = GUICtrlCreateButton("Start", 40, 150, 50) $Button_2 = GUICtrlCreateButton("Exit", 100, 150, 50) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $Button_1 _MyFunc() Case $Button_2 _iesire() EndSwitch WEnd Func _MyFunc() $server = GUICtrlRead($input1) If GUICtrlRead($AA_Radio_1) = 1 Then $viata = 0x00E5F7E8 $mana = 0x00E5F7F0 $monstru = 0x0108EEAC $Handle = _memoryopen(WinGetProcess("Private (Server 1: Realm "& $server &" )")) ;AICI E VIATA **************************************************************************************** $viata2 = _MemoryRead($viata, $Handle, 'dword') If $viata2 < 10000 Then controlSend("Private (Server 1: Realm "& $server &" )", "", "", "{F1}") EndIf ;**************************************************************************************************** ;AICI E MANA***************************************************************************************** $mana2 = _MemoryRead($mana, $Handle, 'dword') If $mana2 < 1000 Then controlSend("Private (Server 1: Realm "& $server &" )", "", "", "{F2}") EndIf ;**************************************************************************************************** ;; monstru ****************************************************************************************** $monstru2 = _MemoryRead($monstru, $Handle, 'dword') If $monstru2 = 1 Then controlSend("Private (Server 1: Realm "& $server &" )", "", "", "{2}") sleep(500) controlSend("Private (Server 1: Realm "& $server &" )", "", "", "{3}") sleep(500) controlSend("Private (Server 1: Realm "& $server &" )", "", "", "{4}") sleep(500) Else; daca nu exista apasa TAB controlSend("Private (Server 1: Realm "& $server &" )", "", "", "{T}") sleep(500) EndIf ;;*************************************************************************************************** _MemoryClose($Handle) Else $viata = 0x00E5F7E8 $mana = 0x00E5F7F0 $monstru = 0x0108EEAC $Handle = _memoryopen(WinGetProcess("Private (Server 1: Realm "& $server &" )")) ;AICI E VIATA **************************************************************************************** $viata2 = _MemoryRead($viata, $Handle, 'dword') If $viata2 < 10000 Then controlSend("Private (Server 1: Realm "& $server &" )", "", "", "{F1}") EndIf ;**************************************************************************************************** ;AICI E MANA***************************************************************************************** $mana2 = _MemoryRead($mana, $Handle, 'dword') If $mana2 < 2000 Then controlSend("Private (Server 1: Realm "& $server &" )", "", "", "{F2}") EndIf ;**************************************************************************************************** _MemoryClose($Handle) EndIf EndFunc Func _iesire() Exit EndFunc
AdmiralAlkex Posted April 29, 2010 Posted April 29, 2010 i tried with While and with DO but wen i press EXIT BUTTON its not closing, i have put the UNTIL $msg = $Button_2 OR $msg = $GUI_EVENT_CLOSE but still not closing and So what? There's nothing like that in the code so we can only guess, and that guess will be, You're forgetting to call GuiGetMsg! .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
DexterCry Posted April 29, 2010 Author Posted April 29, 2010 Tnx guys i managed to make it ... i have set a checkbox to exit
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now