Checkpoint Posted July 7, 2009 Share Posted July 7, 2009 ; Expression count set $upgrade = 0 ; Script pauses for 0 seconds Sleep(0) ; While total expression is less than or equal to 100 (Will use 99 sun/moons) while $upgrade < 100 ; Double-click [Column 1, Row 6 / Upgrade Material #1] in inventory MouseClick( "left", 866, 410, 2, 0 ) ; Pause script for 0 milliseconds Sleep(0) ; Single-click[Column 1, Row 4 / Upgrade Item #1] in inventory MouseClick( "left", 903, 410, 1, 0 ) ; Pause script for 0 seconds (While item is upgraded, in your case if no time exists between upgrades delete this) Sleep(0) ; Increase total expression by 1 $upgrade = $upgrade + 1 ; Loop Wend That's the script that I've made to do my mouse clicking, but I'm wondering how I can make a function so that I can start/stop the script from running at will. I've just started AutoIT today, so I'm really really new to all of this. Will I have to create a totally separate script, or can I just add some more lines of code onto this one to create a start/stop function. After searching, I have found that it's a HotKeySet Function. I wanted to use F11 to start it and F12 to stop it. Thanks in advance, Checkpoint Link to comment Share on other sites More sharing options...
darkmaster071 Posted July 7, 2009 Share Posted July 7, 2009 (edited) Use it like this. expandcollapse popupGlobal $Paused HotKeySet("{F11}", "TogglePause") HotKeySet("{ESC}", "Terminate") ; Expression count set $upgrade = 0 ; Script pauses for 0 seconds Sleep(0) ; While total expression is less than or equal to 100 (Will use 99 sun/moons) while $upgrade < 100 ; Double-click [Column 1, Row 6 / Upgrade Material #1] in inventory MouseClick( "left", 866, 410, 2, 0 ) ; Pause script for 0 milliseconds Sleep(0) ; Single-click[Column 1, Row 4 / Upgrade Item #1] in inventory MouseClick( "left", 903, 410, 1, 0 ) ; Pause script for 0 seconds (While item is upgraded, in your case if no time exists between upgrades delete this) Sleep(0) ; Loop ; Increase total expression by 1 $upgrade = $upgrade + 1 Wend Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Edited July 7, 2009 by darkmaster071 Link to comment Share on other sites More sharing options...
Checkpoint Posted July 7, 2009 Author Share Posted July 7, 2009 Use it like this. expandcollapse popupGlobal $Paused HotKeySet("{F11}", "TogglePause") HotKeySet("{ESC}", "Terminate") ; Expression count set $upgrade = 0 ; Script pauses for 0 seconds Sleep(0) ; While total expression is less than or equal to 100 (Will use 99 sun/moons) while $upgrade < 100 ; Double-click [Column 1, Row 6 / Upgrade Material #1] in inventory MouseClick( "left", 866, 410, 2, 0 ) ; Pause script for 0 milliseconds Sleep(0) ; Single-click[Column 1, Row 4 / Upgrade Item #1] in inventory MouseClick( "left", 903, 410, 1, 0 ) ; Pause script for 0 seconds (While item is upgraded, in your case if no time exists between upgrades delete this) Sleep(0) ; Loop ; Increase total expression by 1 $upgrade = $upgrade + 1 Wend Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Thank you so much. =] I just joined this forum and I already love it. AutoIT is the only language that I've tried - and I've tried C# and C++ - that I've liked. Again, Thanks. 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