LegacyWeapon Posted August 20, 2005 Share Posted August 20, 2005 I wrote this script to play Dice Escape for me on Neopets (thinking this would be quite easy since it's a bunch of pressing arrow keys). expandcollapse popup;Find Arrow Position $coord = PixelSearch( 0, 0, 600, 800, 0xF1EE72, 10 ) If @error Then MsgBox(0, "Dice Escape", "Error at finding pixel!") Exit EndIf ;Check Left/Right Mouse Buttons Dim $primary Dim $secondary $k = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons") If $k = 1 Then $primary = "right" $secondary = "left" Else;normal (also case if could not read registry key) $primary = "left" $secondary = "right" EndIf MouseMove($coord[0]+50, $coord[1]) MouseClick($primary) Sleep(5000) AutoItSetOption("SendKeyDelay", 500) Level1() Sleep(2000) Level2() Sleep(2000) Level3() Exit Func Level1() Send("{UP}{UP}{UP}{UP}{UP}") Sleep(5000) Send("N") EndFunc Func Level2() Send("{UP}{UP}{RIGHT}{RIGHT}{DOWN}{LEFT}") Sleep(5000) Send("N") EndFunc Func Level3() Send("{UP}{UP}") Sleep(4000) Send("{UP}{UP}{RIGHT}{UP}{UP}{RIGHT}{LEFT}{LEFT}") Sleep(5000) Send("N") EndFuncStrangely at level 3 it doesn't seem to press a lot of the arrow keys... Link to comment Share on other sites More sharing options...
Valuater Posted August 20, 2005 Share Posted August 20, 2005 this is done so fast... that maybe the system isn't ready ... so slow it down a little and that may help send up + up sleep(10) send right + right sleep (10) etc... etc... 8) Link to comment Share on other sites More sharing options...
LegacyWeapon Posted August 20, 2005 Author Share Posted August 20, 2005 Notice this line in the code: AutoItSetOption("SendKeyDelay", 500) Link to comment Share on other sites More sharing options...
LxP Posted August 21, 2005 Share Posted August 21, 2005 This probably won't help you but I believe that the following code: ;Check Left/Right Mouse Buttons Dim $primary Dim $secondary $k = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons") If $k = 1 Then $primary = "right" $secondary = "left" Else;normal (also case if could not read registry key) $primary = "left" $secondary = "right" EndIf MouseMove($coord[0]+50, $coord[1]) MouseClick($primary) can be expressed as simply: mouseClick("primary", $coord[0] + 50, $coord[1]) Link to comment Share on other sites More sharing options...
LxP Posted August 21, 2005 Share Posted August 21, 2005 Try adding this near the beginning: opt("sendKeyDownDelay", 100) The default for this is 1ms, which is like tapping your keys hard and super-fast. Generally that won't work for games. Link to comment Share on other sites More sharing options...
LegacyWeapon Posted August 21, 2005 Author Share Posted August 21, 2005 Oh thanks it works now Link to comment Share on other sites More sharing options...
LxP Posted August 21, 2005 Share Posted August 21, 2005 (edited) One more thing which may make your script easier to maintain: it's possible to combine multiple consecutive presses of a key into one code like so: send("{UP}{UP}{UP}{UP}{UP}") ; is identical to send("{UP 5}") All the best! Edited August 21, 2005 by LxP 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