;-------------------------------------------------------------------- ; ; Stars GamePad AHK script ; Patti Beadles ; pattib (at sign) pattib (dot) org ; ; Inspired by an old Party keyboard shortcut script ; ;-------------------------------------------------------------------- ; ; This script is designed for two 1600x1200 monitors side-by-side, ; though it can be used easily with only one monitor just by not ; using the right joystick. It can also be modified for different ; screen sizes by changing the constants at the top of the script. ; ; It requires AutoHotKey, which is available at ; ; http://www.autohotkey.com ; ;-------------------------------------------------------------------- ; ; Usage of this script is done via two mechanisms: ; ; (1) A GamePad ; (2) The numeric keypad ; ; It is optimized for the gamepad, but left-side windows can also ; be controlled by the keypad. ; ;-------------------------------------------------------------------- ; ; Keypad keys: ; ; 7,9,1,3: Top left, top right, bottom left, bottom right windows ; 4: fold ; 5: check/call ; 6: bet/raise ; 2,8: bet up/down (nolimit) ; ;-------------------------------------------------------------------- ; ; Gamepad use: ; ; The left and right joysticks move to the various windows ; scattered about the screen-- left joystick goes to the left ; monitor and right joystick goes to the right monitor. ; ; The four index and middle finger buttons go to the four windows ; on the left monitor. There are no right monitor equivalents. ; ; The POV controller (the thing under your left thumb) is used to ; raise and lower the bet in nolimit. ; ; Button 1 is used to fold, button 4 to check/call, and button 3 ; to bet/raise. These will intuitively make sense to you pretty ; quickly, as they're left-center-right for the three buttons on ; the screen. In cases where the buttons move (e.g. calling an ; all in is on the far right) you would use the button that lines ; up with that position. Just try it. ; ; Button 9 (center of the controller, left) is used to check the ; fold to any bet box. ; Button 10 (center of the controller, right) is used to check the ; check/fold box. ; ;-------------------------------------------------------------------- ; ; Window position definitions. These should be ; approximately the center of where each window ; lives ; debug = 0 ; left monitor TopRow = 300 BottomRow = 900 LeftColumn = 400 RightColumn = 1200 ; right monitor RTopRow = 300 RBottomRow = 900 RLeftColumn = 2000 RRightColumn = 2800 ; Threshold for engaging the joysticks. ; The default value will be good in most cases JSThreshold = 25 JSTopThreshold = 75 ; ; ; Functions dealing with PokerStars actions ; ; Fold() { Mouseclick,left,423,524 Sleep, 100 return } CheckCall() { MouseClick, left, 600, 550 Sleep, 100 return } BetRaise() { MouseClick, left, 720, 550 Sleep, 100 return } BetUp() { MouseClick, left, 775, 478 Sleep, 100 return } BetDown() { MouseClick, left, 684, 478 Sleep, 100 return } ; not currently used SitOut() { MouseClick, left, 16, 405 Sleep, 100 return } CheckFold() { MouseClick, left, 423, 500 Sleep, 100 return } FoldToAny() { MouseClick, left,15, 372 Sleep, 100 return } ; You shouldn't have to change anything beyond this point ; functions for moving to a specific window QMove(Y, X) { CoordMode, Mouse, Screen MouseMove,X,Y MouseGetPos, curPosX, curPosY, curWin WinGetTitle, title, ahk_id %curWin% WinActivate, %title% sleep,100 return } ; This is the start of the main part of the script #Persistent SetTimer, WatchPOV, 5 return ; numpad functions NumPad7:: Qmove(TopRow, LeftColumn) return NumPad9:: Qmove(TopRow, RightColumn) return NumPad1:: Qmove(BottomRow, LeftColumn) return NumPad3:: Qmove(BottomRow, RightColumn) return NumPad8:: BetUp() return NumPad2:: BetDown() return NumPad4:: Fold() return NumPad5:: CheckCall() return NumPad6:: BetRaise() return ; Joystick button functions ; These are the four index-finger button ; They're used for switching between windows Joy5:: Qmove(TopRow, LeftColumn) return Joy6:: Qmove(TopRow, RightColumn) return Joy7:: Qmove(BottomRow, LeftColumn) return Joy8:: Qmove(BottomRow, RightColumn) return ; Buttons for checking, betting, raising-- right thumb Joy1:: Fold() return Joy4:: CheckCall() return Joy3:: BetRaise() return ; special buttons-- fold to any bet, check-fold Joy9:: FoldToAny() return Joy10:: CheckFold() return ; main loop ; This deals with the POV controller-- it's used for bet up/down WatchPOV: GetKeyState, POV, joyPOV ; Get position of the POV control. if POV < 0 ; No angle to report goto, JoyCheck else if POV = 0 { BetUp() return } else if POV = 18000 { BetDown() return } ; this deals with the left and right joystick. Left is X-Y ; and right is Z-R JoyCheck: SetFormat, float, 03 getKeyState, joyz, 1JoyZ getKeyState, joyr, 1JoyR getKeyState, joyx, 1JoyX getKeyState, joyy, 1JoyY if(debug) { ToolTip 'x: %joyx% y: %joyy% z: %joyz% r: %joyr% Threshold: %JSThreshold% %JSTopThreshold%' } ; ; left monitor ; if(joyx > JSTopThreshold and joyy < JSThreshold) { Qmove(TopRow, RightColumn) return } if(joyx < JSThreshold and joyy < JSThreshold) { Qmove(TopRow, LeftColumn) return } if(joyx < JSThreshold and joyy > JSTopThreshold) { Qmove(BottomRow, LeftColumn) return } if(joyx > JSTopThreshold and joyy > JSTopThreshold) { Qmove(BottomRow, RightColumn) return } ; ; right monitor ; if(joyz > JSTopThreshold and joyr < JSThreshold) { Qmove(RTopRow, RRightColumn) return } if(joyz < JSThreshold and joyr < JSThreshold) { Qmove(RTopRow, RLeftColumn) return } if(joyz < JSThreshold and joyr > JSTopThreshold) { Qmove(RBottomRow, RLeftColumn) return } if(joyz > JSTopThreshold and joyr > JSTopThreshold) { Qmove(RBottomRow, RRightColumn) return } return