kallblodig Posted May 3, 2009 Share Posted May 3, 2009 Heya, I have some trouble with my script, I want to make my Stop ($Button3) and my Pause($Button2) to Stop respective pause the script. I got the start button to work but not the others. Here is some parts of the script, expandcollapse popupGlobal $Paused HotKeySet("{F8}", "TogglePause") HotKeySet("{F9}", "Terminate") HotKeySet("+!d", "ShowMessage") ;Shift-Alt-d #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=c:\documents and settings\pc\mina dokument\form3.kxf $Form3 = GUICreate("Darkangel Leveling bot Beta v1.9", 563, 356, 302, 218) $Pic1 = GUICtrlCreatePic("C:\Documents and Settings\pc\Skrivbord\namnlös.JPG", 0, 0, 561, 89, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) $Button1 = GUICtrlCreateButton("Button1", 176, 296, 49, 49, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, "C:\Documents and Settings\pc\Skrivbord\Kopia av fire-dancing-icon.bmp", -1) $Button2 = GUICtrlCreateButton("Button2", 256, 296, 57, 49, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, "C:\Documents and Settings\pc\Skrivbord\Pause.bmp", -1) $Button3 = GUICtrlCreateButton("Button3", 344, 296, 57, 49, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, "C:\Documents and Settings\pc\Skrivbord\fire-dancing-icon.bmp", -1) $Group1 = GUICtrlCreateGroup("Welcome to Darkangel leveling Bot Beta v1.9 ", 136, 96, 297, 177) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $Label1 = GUICtrlCreateLabel("Please setup the settings you want to use before starting", 144, 120, 270, 17) $Label2 = GUICtrlCreateLabel("In the config.ini file that is located in your bot folder.", 144, 136, 245, 17) $Label3 = GUICtrlCreateLabel("Start up WoW, login to your character, set resolution to", 144, 152, 263, 17) $Label4 = GUICtrlCreateLabel("800x600 and enable windowed mode. Maximise WoW", 144, 168, 261, 17) $Label5 = GUICtrlCreateLabel("as much as you can (dont disable Windowed mode)", 144, 184, 248, 17) $Label6 = GUICtrlCreateLabel("And then find a location where you wich to grind mobs, and", 144, 200, 283, 17) $Label7 = GUICtrlCreateLabel("then start the bot. ", 144, 216, 90, 17) $win_title = "World of Warcraft" GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Start() EndSwitch WEnd While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button2 Togglepause() EndSwitch WEnd While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button2 Terminate(); EndSwitch WEnd ; Globals AutoItSetOption("MouseCoordMode", 0) AutoItSetOption("PixelCoordMode", 0) $win_title = "World of Warcraft" ; Fires up WOW WinActivate($win_title, "") WinSetOnTop($win_title, "", 0) Sleep(1000) Start() ; ***** Combat function $coord = PixelSearch( 0, 0, 1152, 864, 0x32394A, 2 ) 0xBF0000 Func Start() While 1 Send("{TAB}") $coord = PixelSearch( 0, 0, 1152, 864, 0xCBC800 , 2 ) If @error Then TrayTip("No mob found ", "Doing findmob routine", 5, 1) sleep(1000) Find_mob() Else TrayTip("Mob spotted! ", "Attacking Mob", 5, 1) Battle() EndIf Wend EndFunc ; MAIN SCRIPT IS HERE Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Bot is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Func ShowMessage() MsgBox(4096,"","This is a message from the darkside....") EndFunc Any help would be aprusiated Link to comment Share on other sites More sharing options...
Developers Jos Posted May 3, 2009 Developers Share Posted May 3, 2009 Think a little bit longer about this section of code, I am sure you are able to figure out why Button2 and again Button2 (should be button3?) do not work. While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Start() EndSwitch WEnd While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button2 Togglepause() EndSwitch WEnd While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button2 Terminate(); EndSwitch WEnd SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
kallblodig Posted May 3, 2009 Author Share Posted May 3, 2009 Think a little bit longer about this section of code, I am sure you are able to figure out why Button2 and again Button2 (should be button3?) do not work. While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Start() EndSwitch WEnd While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button2 Togglepause() EndSwitch WEnd While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button2 Terminate(); EndSwitch WEndSo I should change Button 2 to Button 3 and Button 3 to button 2? Link to comment Share on other sites More sharing options...
Developers Jos Posted May 3, 2009 Developers Share Posted May 3, 2009 So I should change Button 2 to Button 3 and Button 3 to button 2?Have you properly looked at the section I quoted?There is a reference to Button2 twice and none to button3.Also the whole logic is wrong because initially your script will be in the first While-Wend loop thus Button2 and button3 is never checked for.Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
kallblodig Posted May 3, 2009 Author Share Posted May 3, 2009 Have you properly looked at the section I quoted?There is a reference to Button2 twice and none to button3.Also the whole logic is wrong because initially your script will be in the first While-Wend loop thus Button2 and button3 is never checked for.JosYea, I saw that you referred to button 2 two times. But It don't seem to work when I changed it :/ Link to comment Share on other sites More sharing options...
Developers Jos Posted May 3, 2009 Developers Share Posted May 3, 2009 Yea, I saw that you referred to button 2 two times. But It don't seem to work when I changed it :/Also the whole logic is wrong because initially your script will be in the first While-Wend loop thus Button2 and button3 is never checked for. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
CodyBarrett Posted May 3, 2009 Share Posted May 3, 2009 in other words...put it in the SAME while loop... [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
kallblodig Posted May 4, 2009 Author Share Posted May 4, 2009 I tried this now, While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Start() EndSwitch $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button2 Togglepause() EndSwitch $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button3 Terminate(); EndSwitchWEndBut it still isnt working Apprusiating your help tho Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 4, 2009 Moderators Share Posted May 4, 2009 kallblodig, While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Start() Case $Button2 Togglepause() Case $Button3 Terminate(); EndSwitch WEnd M23 P.S. Sorry to butt in, but I cannot bear it any longer! 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...
Developers Jos Posted May 4, 2009 Developers Share Posted May 4, 2009 P.S. Sorry to butt in, but I cannot bear it any longer!Sometimes I wonder how peoples brains work. Don't get me wrong kallblodig, but you will have to try to understand what you are coding because else you are just trying things and that will not work when your script grows. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Valuater Posted May 4, 2009 Share Posted May 4, 2009 ...you will have to try to understand what you are coding because else you are just trying things and that will not work when your script grows.... Therein lies my problem. 8) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 4, 2009 Moderators Share Posted May 4, 2009 Jos & Val,That is why I apologised in advance.I do not know if you ever saw the file "They Shoot Horses Don't They"......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...
kallblodig Posted May 5, 2009 Author Share Posted May 5, 2009 kallblodig, While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Start() Case $Button2 Togglepause() Case $Button3 Terminate(); EndSwitch WEnd M23 P.S. Sorry to butt in, but I cannot bear it any longer!Still doesnt work :/ Tried everything I can :S Link to comment Share on other sites More sharing options...
BrettF Posted May 5, 2009 Share Posted May 5, 2009 What doesn't work? What is your script currently? Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 5, 2009 Moderators Share Posted May 5, 2009 kallblodig,The following is extracted from your original code with my While...WEnd loop:#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> $Form3 = GUICreate("Darkangel Leveling bot Beta v1.9", 563, 356, 302, 218) $Button1 = GUICtrlCreateButton("Button1", 176, 296, 49, 49, BitOR($BS_BITMAP,$WS_GROUP)) $Button2 = GUICtrlCreateButton("Button2", 256, 296, 57, 49, BitOR($BS_BITMAP,$WS_GROUP)) $Button3 = GUICtrlCreateButton("Button3", 344, 296, 57, 49, BitOR($BS_BITMAP,$WS_GROUP)) $win_title = "World of Warcraft" GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 ConsoleWrite("Start()" & @CRLF) Case $Button2 ConsoleWrite("Togglepause()" & @CRLF) Case $Button3 ConsoleWrite("Terminate()" & @CRLF); EndSwitch WEndThe buttons work for me!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...
kallblodig Posted May 10, 2009 Author Share Posted May 10, 2009 (edited) Alright, well it works with this while loop, While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Start() Case $Button2 Togglepause() Case $Button3 Exit EndSwitch WEnd Tho the buttons only work when I havent started the bot. I want them to work while im running the bot after I have pressed Button 1 (Start). So basicly I want the script to be paused if its running when I press button 2, And Exit the bot if script is running and you have pressed Button 3. Any ideas? Thx <33 Edited May 10, 2009 by kallblodig Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 10, 2009 Moderators Share Posted May 10, 2009 kallblodig,It sounds as though you never return to this loop after entering the Start() function. Do you have a While...WEnd loop in that function? If so, then you need to put the other key Cases in there. Pseudo-code:Start of script While Case $GUI_EVENT_CLOSE Exit Case $Button1 Start() WEnd Func Start() Main function code While Case $Button2 Togglepause() Case $Button3 Exit WEnd EndFuncM23 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...
kallblodig Posted May 11, 2009 Author Share Posted May 11, 2009 kallblodig, It sounds as though you never return to this loop after entering the Start() function. Do you have a While...WEnd loop in that function? If so, then you need to put the other key Cases in there. Pseudo-code:Start of script While Case $GUI_EVENT_CLOSE Exit Case $Button1 Start() WEnd Func Start() Main function code While Case $Button2 Togglepause() Case $Button3 Exit WEnd EndFunc M23Alright, here is the whole start function, I sound soo naabish, but wich cases should I add to the function since Im already using a While loop in it. Thx <3 Start() ; ***** Combat function Func Start() WinActivate($win_title, "") WinSetOnTop($win_title, "", 0) Sleep(1000) While 1 Send("{TAB}") $coord = PixelSearch( 0, 0, 1152, 864, 0xBF0000 , 2 ) If @error Then ToolTip('No mob found, doing Find Mob routine"',0,0) sleep(1000) Find_mob() Else ToolTip('Mob spotted, attacking"',0,0) Battle() EndIf Wend EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 11, 2009 Moderators Share Posted May 11, 2009 kallblodig,This is the last time I offer any assistance unless you start showing some initiative and produce some code of your own! If you cannot manage to code a simple GUIGetMsg section by now.....As I explained to you in my previous post, to have the "Pause" and "Exit" buttons active in the Start() function you need to poll GUIGetMsg in the While...WEnd loop of the function:Func Start() WinActivate($win_title, "") WinSetOnTop($win_title, "", 0) Sleep(1000) While 1 Send("{TAB}") $coord = PixelSearch(0, 0, 1152, 864, 0xBF0000, 2) If @error Then ToolTip('No mob found, doing Find Mob routine"', 0, 0) Sleep(1000) Find_mob() Else ToolTip('Mob spotted, attacking"', 0, 0) Battle() EndIf ; See if the buttons have been pressed Switch GUIGetMsg() Case $Button2 Togglepause() Case $Button3 Exit EndSwitch WEnd EndFunc ;==>StartNow Buttons 2 & 3 will be active while Start() is running.M23P.S. Please use Code tags. Put [code ] before and [/code ] after your posted code (but omit the trailing space - it is only there so the tags display here). 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...
kallblodig Posted May 11, 2009 Author Share Posted May 11, 2009 kallblodig, This is the last time I offer any assistance unless you start showing some initiative and produce some code of your own! If you cannot manage to code a simple GUIGetMsg section by now..... As I explained to you in my previous post, to have the "Pause" and "Exit" buttons active in the Start() function you need to poll GUIGetMsg in the While...WEnd loop of the function:Func Start() WinActivate($win_title, "") WinSetOnTop($win_title, "", 0) Sleep(1000) While 1 Send("{TAB}") $coord = PixelSearch(0, 0, 1152, 864, 0xBF0000, 2) If @error Then ToolTip('No mob found, doing Find Mob routine"', 0, 0) Sleep(1000) Find_mob() Else ToolTip('Mob spotted, attacking"', 0, 0) Battle() EndIf ; See if the buttons have been pressed Switch GUIGetMsg() Case $Button2 Togglepause() Case $Button3 Exit EndSwitch WEnd EndFunc ;==>Start Now Buttons 2 & 3 will be active while Start() is running. M23 P.S. Please use Code tags. Put [code ] before and [/code ] after your posted code (but omit the trailing space - it is only there so the tags display here). Got it to work, Thx alot man ! =) And btw, I tried servral diffrent solutions but I didnt post them here since I didnt find it to be nessesary. 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