Oni_Gabriel Posted January 30, 2021 Share Posted January 30, 2021 (edited) Hi, it's me again, I'm having a problem somewhere but I can't figure out where. I want to use global variables to say that a while is true or false, but that they can be executed together. the problem is that when I enable the first one only that works. Now if I put 2 of the 3 functions inside the while and technically "activate" the one that remains outside if it works for me. My question is can I use it independently knowing that the pixelserch works on a variable that has coordinates? The script is this: expandcollapse popupGlobal $Prueba = False Global $Prueba2 = False #Region ### START Koda GUI section ### Form=C:\Program Files (x86)\AutoIt3\SciTE\Koda\Forms\Moebot.kxf $inicio = GUICreate("MoeBot 1.1 Rev 1.0", 703, 327, -1, -1) $Label1 = GUICtrlCreateLabel(" Moe Bot Por Onigumo", 0, 0, 702, 52) GUICtrlSetFont(-1, 30, 800, 2, "Verdana") $Group1 = GUICtrlCreateGroup("Seleccion de Acciones del Bot", 8, 56, 689, 121) $movimiento = GUICtrlCreateCheckbox("Movimiento", 24, 80, 137, 41) GUICtrlSetFont(-1, 15, 800, 0, "MS Sans Serif") $atacar_campos = GUICtrlCreateCheckbox("Atacar Campos", 168, 80, 177, 41) GUICtrlSetFont(-1, 15, 800, 0, "MS Sans Serif") $curar_tropa = GUICtrlCreateCheckbox("Curar Tropa", 352, 88, 137, 33) GUICtrlSetFont(-1, 15, 800, 0, "MS Sans Serif") GUICtrlCreateGroup("", -99, -99, 1, 1) $configurar_movimiento = GUICtrlCreateButton("Configurar Movimiento", 40, 208, 177, 41) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $configurar_campos = GUICtrlCreateButton("Configurar Campos", 232, 208, 201, 41) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $configurar_templo = GUICtrlCreateButton("Configurar Curar tropa", 448, 208, 201, 41) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While (1) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ExitLoop case $atacar_campos if GUICtrlRead ($atacar_campos) = 1 then $Prueba2 = True msgbox(0, "", "Atacar campos") EndIf ; Activar curar tropa case $curar_tropa if GUICtrlRead ($curar_tropa) = 1 then $Prueba = True MsgBox(0, "", "Habilitado" ) if GUICtrlRead ($curar_tropa) = 4 then $Prueba = False msgbox(0, "", "Desabilitado" ) EndIf EndIf case $configurar_movimiento posmovimiento() case $configurar_campos poscampamento() EndSwitch $moverse = PixelSearch($lockx1, $locky1, $lockx2, $locky2, $colormovimiento, 3) if not (@error) Then movimiento() EndIf While($Prueba2) $camp = PixelSearch($campx1, $campy1, $campx2, $campy2, $colorcamp) if not (@error) Then campamentos() EndIf WEnd While($Prueba) $moverse = PixelSearch($lockx1, $locky1, $lockx2, $locky2, $colormovimiento, 3) if not (@error) Then movimiento() EndIf $camp = PixelSearch($campx1, $campy1, $campx2, $campy2, $colorcamp, 2) if not (@error) Then campamentos() EndIf $curar = PixelSearch($curarx1, $curary1, $curarx2, $curary2, $colorcuracion, 3) if not (@error) Then curartropas() Sleep(500) ExitLoop EndIf WEnd WEnd Edited January 30, 2021 by Melba23 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 30, 2021 Moderators Share Posted January 30, 2021 Moved to the appropriate forum. Moderation Team 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...
Moderators Melba23 Posted January 30, 2021 Moderators Share Posted January 30, 2021 Oni_Gabriel, When you post code in future please use Code tags - see here how to do it. Then you get a scrolling box and syntax colouring as you can see above now I have added the tags. Thanks in advance for your cooperation. 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...
Moderators Melba23 Posted January 30, 2021 Moderators Share Posted January 30, 2021 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 automation - and then you will understand why you will get no help and this thread will now be locked. See you soon with a legitimate question I hope. The Moderation team 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