BluhBlah Posted October 26, 2009 Share Posted October 26, 2009 This part of my code seems like it wont trigger or something, I tested and the pixelsearch works but hmm it wont send !Q ( im 100% it havent found the extloop part If PixelGetColor(217, 591) = 0xCCB211 Then $iBegin = TimerInit() While TimerDiff($iBegin) < $delay If PixelGetColor(35, 149) = 0x737777 Then ExitLoop WEnd If PixelGetColor(217, 591) = 0xCCB211 Then Send ("!Q") EndIf Else Sleep(10) EndIf[/codebox] Here's whole code expandcollapse popupDim $stop = 0 HotKeySet("{F4}", "toggle") HotKeySet("{F5}", "off") $password = IniRead(@ScriptDir & "\settings.ini", "Settings", "Password", "Notfound") $delay = IniRead(@ScriptDir & "\settings.ini", "Settings", "Delay", 5000) While 1 If $stop = 1 Then ;******************************************************************************** If PixelGetColor(217, 591) = 0xCCB211 Then $iBegin = TimerInit() While TimerDiff($iBegin) < $delay If PixelGetColor(35, 149) = 0x737777 Then ExitLoop WEnd If PixelGetColor(217, 591) = 0xCCB211 Then Send ("!Q") EndIf Else Sleep(10) EndIf ;******************************************************************************** If PixelGetColor(167, 86) = 0xFFF052 Then ; Press B to enter bnet Send("B") Sleep(5000) EndIf ;******************************************************************************** If PixelGetColor(359, 414) = 0x291C11 Then ; Type password to enter game Send($password) Send("{ENTER}") Sleep(10000) EndIf ;******************************************************************************** If PixelGetColor(504, 375) = 0x000000 Then Send("{ENTER}") ; If wrong password screen come up it press enter If PixelGetColor(28, 157) = 0x5C594D Then Send("!Q") ; Sends search game if it is in ..channel If PixelGetColor(479, 114) = 0xFFFFFF Then Send("!Q") ;Leave if quitscreen come If PixelGetColor(109, 2) = 0x444244 Then Send("{ENTER}") ; If scorescreen comes ;******************************************************************************** ;Undead If PixelGetColor(673, 243) = 0x929270 Then Send("!Q") ;Leave if defeatscreen come If PixelGetColor(677, 215) = 0x49412D Then Send("!Q") ;Leave if victoryscreen come ;Human If PixelGetColor(680, 232) = 0x485055 Then Send("!Q") ;Leave if defeatscreen come If PixelGetColor(684, 224) = 0x3D3E3D Then Send("!Q") ;Leave if victoryscreen come ;Nightelf If PixelGetColor(657, 235) = 0x3D6129 Then Send("!Q") ;Leave if defeatscreen come If PixelGetColor(670, 209) = 0x354019 Then Send("!Q") ;Leave if victoryscreen come ;Orc If PixelGetColor(645, 245) = 0x454531 Then Send("!Q") ;Leave if defeatscreen come If PixelGetColor(680, 237) = 0x434130 Then Send("!Q") ;Leave if victoryscreen come ;******************************************************************************** WEnd Func toggle() If $stop = 0 Then $stop = 1 Else $stop = 0 EndIf EndFunc Func off() Exit EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 26, 2009 Moderators Share Posted October 26, 2009 Xoriaz,It worked when I wrote it for you. You could try removing the unneeded EndIf (the one before the Else) that you seem to have added.M23P.S. If you use the full SciTE4AutoIt3 package, you can run Tidy on your code (by pressing Ctrl-T or selecting it from the Tools menu) and it will find these sort of errors for you automatically. 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...
BluhBlah Posted October 26, 2009 Author Share Posted October 26, 2009 (edited) expandcollapse popupDim $stop = 0 HotKeySet("{F4}", "toggle") HotKeySet("{F5}", "off") $password = IniRead(@ScriptDir & "\settings.ini", "Settings", "Password", "Notfound") $delay = IniRead(@ScriptDir & "\settings.ini", "Settings", "Delay", 5000) While 1 If $stop = 1 Then ;******************************************************************************** If PixelGetColor(217, 591) = 0xCCB211 Then $iBegin = TimerInit() While TimerDiff($iBegin) < $delay If PixelGetColor(35, 149) = 0x737777 Then ExitLoop WEnd If PixelGetColor(217, 591) = 0xCCB211 Then Send("!Q") Else Sleep(10) EndIf ;******************************************************************************** If PixelGetColor(167, 86) = 0xFFF052 Then ; Press B to enter bnet Send("B") Sleep(5000) EndIf ;******************************************************************************** If PixelGetColor(359, 414) = 0x291C11 Then ; Type password to enter game Send($password) Send("{ENTER}") Sleep(10000) EndIf ;******************************************************************************** If PixelGetColor(504, 375) = 0x000000 Then Send("{ENTER}") ; If wrong password screen come up it press enter If PixelGetColor(28, 157) = 0x5C594D Then Send("!Q") ; Sends search game if it is in ..channel If PixelGetColor(479, 114) = 0xFFFFFF Then Send("!Q") ;Leave if quitscreen come If PixelGetColor(109, 2) = 0x444244 Then Send("{ENTER}") ; If scorescreen comes ;******************************************************************************** ;Undead If PixelGetColor(673, 243) = 0x929270 Then Send("!Q") ;Leave if defeatscreen come If PixelGetColor(677, 215) = 0x49412D Then Send("!Q") ;Leave if victoryscreen come ;Human If PixelGetColor(680, 232) = 0x485055 Then Send("!Q") ;Leave if defeatscreen come If PixelGetColor(684, 224) = 0x3D3E3D Then Send("!Q") ;Leave if victoryscreen come ;Nightelf If PixelGetColor(657, 235) = 0x3D6129 Then Send("!Q") ;Leave if defeatscreen come If PixelGetColor(670, 209) = 0x354019 Then Send("!Q") ;Leave if victoryscreen come ;Orc If PixelGetColor(645, 245) = 0x454531 Then Send("!Q") ;Leave if defeatscreen come If PixelGetColor(680, 237) = 0x434130 Then Send("!Q") ;Leave if victoryscreen come ;******************************************************************************** ;### Tidy Error -> "wend" is closing previous "if" on line 14 WEnd ;### Tidy Error -> while Not closed before "Func" statement. ;### Tidy Error -> "func" cannot be inside any IF/Do/While/For/Case/Func statement. Func toggle() If $stop = 0 Then $stop = 1 Else $stop = 0 EndIf EndFunc ;==>toggle ;### Tidy Error -> while Not closed before "Func" statement. ;### Tidy Error -> "func" cannot be inside any IF/Do/While/For/Case/Func statement. Func off() Exit EndFunc ;==>off;### Tidy Error -> while is never closed in your script. I dont know how to fix :7 lol Edited October 26, 2009 by Xoriaz Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 26, 2009 Moderators Share Posted October 26, 2009 Xoriaz,Yes, Tidy can be a bit confusing - the problem is that 1 error can cascade throughout the script and make it look as if you have multiple errors! In this case there is only one - trust me!The trick is to always start with the first error:;### Tidy Error -> "wend" is closing previous "if" on line 14 WEndThis is telling you that you are missing an EndIf here to close the If statement on line 14. So add an EndIf like this:expandcollapse popupDim $stop = 0 HotKeySet("{F4}", "toggle") HotKeySet("{F5}", "off") $password = IniRead(@ScriptDir & "\settings.ini", "Settings", "Password", "Notfound") $delay = IniRead(@ScriptDir & "\settings.ini", "Settings", "Delay", 5000) While 1 If $stop = 1 Then ;******************************************************************************** If PixelGetColor(217, 591) = 0xCCB211 Then $iBegin = TimerInit() While TimerDiff($iBegin) < $delay If PixelGetColor(35, 149) = 0x737777 Then ExitLoop WEnd If PixelGetColor(217, 591) = 0xCCB211 Then Send("!Q") Else Sleep(10) EndIf ;******************************************************************************** If PixelGetColor(167, 86) = 0xFFF052 Then ; Press B to enter bnet Send("B") Sleep(5000) EndIf ;******************************************************************************** If PixelGetColor(359, 414) = 0x291C11 Then ; Type password to enter game Send($password) Send("{ENTER}") Sleep(10000) EndIf ;******************************************************************************** If PixelGetColor(504, 375) = 0x000000 Then Send("{ENTER}") ; If wrong password screen come up it press enter If PixelGetColor(28, 157) = 0x5C594D Then Send("!Q") ; Sends search game if it is in ..channel If PixelGetColor(479, 114) = 0xFFFFFF Then Send("!Q") ;Leave if quitscreen come If PixelGetColor(109, 2) = 0x444244 Then Send("{ENTER}") ; If scorescreen comes ;******************************************************************************** ;Undead If PixelGetColor(673, 243) = 0x929270 Then Send("!Q") ;Leave if defeatscreen come If PixelGetColor(677, 215) = 0x49412D Then Send("!Q") ;Leave if victoryscreen come ;Human If PixelGetColor(680, 232) = 0x485055 Then Send("!Q") ;Leave if defeatscreen come If PixelGetColor(684, 224) = 0x3D3E3D Then Send("!Q") ;Leave if victoryscreen come ;Nightelf If PixelGetColor(657, 235) = 0x3D6129 Then Send("!Q") ;Leave if defeatscreen come If PixelGetColor(670, 209) = 0x354019 Then Send("!Q") ;Leave if victoryscreen come ;Orc If PixelGetColor(645, 245) = 0x454531 Then Send("!Q") ;Leave if defeatscreen come If PixelGetColor(680, 237) = 0x434130 Then Send("!Q") ;Leave if victoryscreen come ;******************************************************************************** EndIf ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Added WEnd Func toggle() If $stop = 0 Then $stop = 1 Else $stop = 0 EndIf EndFunc ;==>toggle Func off() Exit EndFunc ;==>offRun Tidy again and it removes all the other errors which were just cascading from the first and tells you everything is now fine.So remember that you need to fix the FIRST error and then rerun Tidy to see if there are any further problems. 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...
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