JesterRM Posted June 4, 2015 Share Posted June 4, 2015 (edited) Alright, so my title isn't really specific, but that's because I don't exactly know what to title this,So, my problem is, I need to be able to click a button whileSleep(5000)is happening, I need this because my script will rely on time,Currently, I have the code at bare bones, because I'm new to AutoIt, so I'm learning as I'm going, by using their reference pages,I need to click a button while that Sleep code above is happening, to stop the script, otherwise, I cant close the program I'm making without using Task Manager,I removed the clicking from the code, just for this, because I put random locations,and I don't need it clicking right now, but here is my current codeexpandcollapse popup#include <GUIConstantsEx.au3> ;Comments On Information ;Set Mouse Position - MouseMove ( x, y) ;Mouse Click At Current Position - MouseClick ("Button") Opt('MustDeclareVars', 1) MainGUI() Func MainGUI() Local $Button1, $Button2, $Button3, $msg, $count $count = 0 GUICreate("FREE KaW Bot V0.01", 1000, 650) ; Button Position and Names Opt("GUICoordMode", 2) $Button1 = GUICtrlCreateButton("Start", 370, 30, 100) $Button2 = GUICtrlCreateButton("Stop", 10, -1, 100) $Button3 = GUICtrlCreateButton("Close", 10, -1, 100) GUISetState() ; Run the GUI until the window is closed While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop ; Button PopUp Messages ; Start The Bot Case $msg = $Button1 MsgBox(0, 'Start', 'Starting Bot in 10 Seconds after PopUp Closes') Sleep(10000) $count = 1 Do MouseMove (800, 100) Sleep(1000) MouseMove (200, 453) Sleep(5000) Until $count = 0 ; Stop The Bot Case $msg = $Button2 MsgBox(0, 'Stop', 'Stopping Bot') $count = 0 ; Close The Bot Case $msg = $Button3 MsgBox(0, 'Close', 'Closing Bot') Exit EndSelect WEnd EndFuncAs previously said, the stop button does not work while Sleep function is enabled,Is there a work around, like instead of sleep, a "Wait" function? I also need to have a web page open in this programHow is this done? Edited June 4, 2015 by JesterRM Link to comment Share on other sites More sharing options...
kaisies Posted June 4, 2015 Share Posted June 4, 2015 Don't sleep for 10 seconds, sleep a small amount of time like 10ms 100 times, while getting the gui state. Alternatively, when they click start, Store the time, and then use timediff Link to comment Share on other sites More sharing options...
JesterRM Posted June 4, 2015 Author Share Posted June 4, 2015 (edited) Don't sleep for 10 seconds, sleep a small amount of time like 10ms 100 times, while getting the gui state. Alternatively, when they click start, Store the time, and then use timediff As I said, I'm learning as I go, I have no idea what this means, usually I would hit the reference pages for help,Could you please explain?Also, the beginning sleep for 10000 is useless, I just have it there so there is a small delay after they click OK on the PopUp, I could make it any time I feel needed, I think... EDIT:It wont let me edit the main thread to explain this, I NEED the waits, because it is for Anti-Ban purposes, for time between the clicks, and also to make sure the computer can keep up with it... Also, could I create a time variable, to make the time between the clicks become RANDOM between 2 seconds to 5 seconds? Edited June 4, 2015 by JesterRM Link to comment Share on other sites More sharing options...
kaisies Posted June 4, 2015 Share Posted June 4, 2015 What is this for exactly? Link to comment Share on other sites More sharing options...
JesterRM Posted June 4, 2015 Author Share Posted June 4, 2015 What is this for exactly? An auto clicking bot for a browser game, like an MMO but without the movements,It's all based on screens, every hour, your troops regen to full, I only make 30 million gold per attack hit, with 20 attack hits per full unload, and my upgrades all cost 60 billion gold or more, I'm a PVP build, so I don't make much, but I don't mind, as I don't enjoy hitting the computer battles, I prefer players, so this isn't a bot for me, but because the only bot for this game costs $25, my friends don't want to buy it, and since I'm decent with learning code pretty quickly, my friends asked me if I could make one for them... and I like the way AutoIt is layed out, so I prefer to use it, over other coding/scripting programs Link to comment Share on other sites More sharing options...
kaisies Posted June 4, 2015 Share Posted June 4, 2015 Bots are against the rules of this forum, so.... Link to comment Share on other sites More sharing options...
JesterRM Posted June 4, 2015 Author Share Posted June 4, 2015 Bots are against the rules of this forum, so.... Ahh, I did not know that, I just wanted to ask because I'm new to AutoIt, and I'm having trouble with it,Whatever, mods, feel free to lock/delete, whatever you guys do on your IPB forum, But help with my issue is still appreciated I'm not exactly Pro-Bot either, I find it ruins the game, but I'm not against it, as long as it doesn't effect me,Which is why I'm making it for my friend... Link to comment Share on other sites More sharing options...
JesterRM Posted June 4, 2015 Author Share Posted June 4, 2015 Hmmmm, Upon research on other sites,the TimerInit function will do what I need Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 4, 2015 Moderators Share Posted June 4, 2015 JesterRM,As youhave been told, please read the Forum rules - particularly the bit about not discussing [game automation- before you post again. Thread locked.But welcome to the AutoIt forum - and see you soon with a legitimate question I hope.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