Stars NLH AHK Script Help
I'm trying to create an AHK script for playing Stars SNGs using an XBox 360 controller. I like to stack the tournaments one on top of another.
I am running in to two problems: 1. If 2 or more tables are waiting for action, the second tables does not come to the front after processing the action on the first table. I suspect this is because the script is clicking multiple times due to a rapid fire gamepad (I can't seem to turn this off). 2. I cannot get the slider to work for NL. The Party version Roland made works great. I would like to have both the slider work and a button to bet the pot. Any suggestions? |
Re: Stars NLH AHK Script Help
I don't know about 1. I find also this active-table stuff very confusing (you probably know that).
The slider I can help with though. Could you post what you have so far? The "bet pot" part is tricky though, I'm afraid. Or do they write hhs to hard drive (I never looked)? Basically it's a matter of getting the info the moment we need it. Edit: No, the bet pot part is easy - "Dealer Messages - Everything". [img]/images/graemlins/smile.gif[/img] |
Re: Stars NLH AHK Script Help
[ QUOTE ]
Edit: No, the bet pot part is easy - "Dealer Messages - Everything". [img]/images/graemlins/smile.gif[/img] [/ QUOTE ]Ugh. You're going to force the chat-box in Everything mode and then constantly scan, calculating the total pot? That's not SO easy. Is the "bet pot" function really that useful? When I've played NL (this is a short list of times), I bet "the pot" as often as I bet "3/4 of the pot" or "half the pot". I just use the slider every time. -Sam P.S. Sam's NL Tip #28: Instead of betting 75, bet 74. Instead of betting 100, bet 99. That way the stacks of chips looks more menacing! |
Re: Stars NLH AHK Script Help
[ QUOTE ]
Ugh. You're going to force the chat-box in Everything mode and then constantly scan, calculating the total pot? That's not SO easy. [/ QUOTE ] Hey. I wrote that in like 30 minutes for Party. It's VERY easy. [img]/images/graemlins/grin.gif[/img] [ QUOTE ] Is the "bet pot" function really that useful? [/ QUOTE ] How'd I know? I just like writing this stuff. [img]/images/graemlins/smile.gif[/img] I think betting the pot and then using the slider to ajust is faster though. |
Re: Stars NLH AHK Script Help
I haven't got far, but here is what I have.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Stars SNG Joystick Script ; ; ; Joystick Portions Based on an original script by "illunious" at 2+2. ; Compiled and optimized for SNGs by Bishop22 at 2+2. 1/06 ; Hacked again by New York Jet at 2+2 for stacking SNGs 3/06 ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Define keys for fold, check/call, and bet/raise ; ;;Joy1= Check/Call ;;Joy2= Bet/Raise/All-in Button (as would appear to call an All-In) ;;Joy3= Fold ;;Joy4= Check/Call ;;Joy5= Bet the pot ;;Joy6= All-In types "999999" in bet window, player needs to confirm by pressing ;;JoyZ= Move the bet slider ;*****Joystick Portion*********** ; Increase the following value to make the mouse cursor move faster: ; The setting of 1 is ideal for 8-tabling (pretty quick), you may want to go lower ; if you are playing 4 tables or less JoyMultiplier = 1 ; Decrease the following value to require less joystick displacement-from-center ; to start moving the mouse. However, you may need to calibrate your joystick ; -- ensuring it's properly centered -- to avoid cursor drift. A perfectly tight ; and centered joystick could use a value of 1: JoyThreshold = 5 ButtonLeft = 2 ButtonRight = 12 WheelDelay = 250 ; If your system has more than one joystick, increase this value to use a joystick ; other than the first: JoystickNumber = 1 ; Added to try and fix the multi-clicks on each table... I does not seem to help much SetControlDelay, 300 ; END OF CONFIG SECTION -- Don't change anything below this point unless you want ; to alter the basic nature of the script. #SingleInstance Hotkey, %JoystickNumber%Joy%ButtonLeft%, ButtonLeft Hotkey, %JoystickNumber%Joy%ButtonRight%, ButtonRight ; Calculate the axis displacements that are needed to start moving the cursor: JoyThresholdUpper = 50 JoyThresholdUpper += %JoyThreshold% JoyThresholdLower = 50 JoyThresholdLower -= %JoyThreshold% SetTimer, WatchJoystick, 10 ; Monitor the movement of the joystick. GetKeyState, JoyInfo, %JoystickNumber%JoyInfo IfInString, JoyInfo, P ; Joystick has POV control, so use it as a mouse wheel. SetTimer, MouseWheel, %WheelDelay% #Persistent ; Keep this script running until the user explicitly exits it. SetTimer, WatchAxis, 5 return WatchAxis: GetKeyState, JoyX, JoyX ; Get position of X axis. GetKeyState, JoyY, JoyY ; Get position of Y axis. KeyToHoldDownPrev = %KeyToHoldDown% ; Prev now holds the key that was down before (if any). ;;;;Joystick Button Assignments;;; Joy1:: MouseGetPos,,, curWin ControlClick, x596 y534, ahk_id %curWin% ; Clicks Check or Call ControlClick, x546 y500, ahk_id %curWin% ; Clicks Top Check/Call Button return Joy2:: MouseGetPos,,, curWin WinActivate, ahk_id %curWin% ControlClick, x727 y538, ahk_id %curWin% return Joy3:: MouseGetPos,,, curWin ControlClick, x478 y534, ahk_id %curWin% ; Clicks Fold ControlCLick, x420 y519, ahk_id %curWin% ; Clicks Fold in turn ControlClick, x421 y496, ahk_id %curWin% ; Clicks Check/Fold in turn return Joy4:: MouseGetPos,,, curWin ControlClick, x596 y534, ahk_id %curWin% ; Clicks Check or Call ControlClick, x546 y500, ahk_id %curWin% ; Clicks Top Check/Call Button return Joy5:: ;Help!!! Joy6:: MouseGetPos,,, curWin ControlClick, x623 y471, Tournament ; WinActivate, ahk_id %curWin% Send {del 5} WinActivate, ahk_id %curWin% Send 99999 return ;Allows numpad to be used for betting ;Numpad Plus brings focus to bet box and clears it ;Numpad Enter finalizes the bet NumpadAdd:: MouseGetPos,,, curWin WinActivate, ahk_id %curWin% ControlClick, x623 y471, ahk_id %curWin% ; WinActivate, ahk_id %curWin% Send {del 5} return NumpadEnter:: MouseGetPos,,, curWin WinActivate, ahk_id %curWin% ControlClick, x727 y538, ahk_id %curWin% ; return ;***************Functions********************* ;*******Don't Change Anything Below*********** ; The subroutines below do not use KeyWait because that would sometimes trap the ; WatchJoystick quasi-thread beneath the wait-for-button-up thread, which would ; effectively prevent mouse-dragging with the joystick. ButtonLeft: SetMouseDelay, -1 ; Makes movement smoother. MouseClick, left,,, 1, 0, D ; Hold down the left mouse button. SetTimer, WaitForLeftButtonUp, 10 return ButtonRight: SetMouseDelay, -1 ; Makes movement smoother. MouseClick, right,,, 1, 0, D ; Hold down the right mouse button. SetTimer, WaitForRightButtonUp, 10 return WaitForLeftButtonUp: GetKeyState, JoyStateLeft, %JoystickNumber%Joy%ButtonLeft% if JoyStateLeft = D ; The button is still, down, so keep waiting. return ; Otherwise, the button has been released. SetTimer, WaitForLeftButtonUp, off SetMouseDelay, -1 ; Makes movement smoother. MouseClick, left,,, 1, 0, U ; Release the mouse button. return WaitForRightButtonUp: GetKeyState, JoyStateRight, %JoystickNumber%Joy%ButtonRight% if JoyStateRight = D ; The button is still, down, so keep waiting. return ; Otherwise, the button has been released. SetTimer, WaitForRightButtonUp, off MouseClick, right,,, 1, 0, U ; Release the mouse button. return WatchJoystick: MoveMouse? = n ; Set default. SetFormat, float, 03 GetKeyState, joyx, %JoystickNumber%JoyX GetKeyState, joyy, %JoystickNumber%JoyY if joyx > %JoyThresholdUpper% { MoveMouse? = y DeltaX = %joyx% DeltaX -= %JoyThresholdUpper% } else if joyx < %JoyThresholdLower% { MoveMouse? = y DeltaX = %joyx% DeltaX -= %JoyThresholdLower% } else DeltaX = 0 if joyy > %JoyThresholdUpper% { MoveMouse? = y DeltaY = %joyy% DeltaY -= %JoyThresholdUpper% } else if joyy < %JoyThresholdLower% { MoveMouse? = y DeltaY = %joyy% DeltaY -= %JoyThresholdLower% } else DeltaY = 0 if MoveMouse? = y { DeltaX *= %JoyMultiplier% DeltaY *= %JoyMultiplier% SetMouseDelay, -1 ; Makes movement smoother. MouseMove, %DeltaX%, %DeltaY%, 0, R } return MouseWheel: GetKeyState, JoyPOV, %JoystickNumber%JoyPOV if JoyPOV = -1 ; No angle. return if (JoyPOV > 31500 or JoyPOV < 4500) ; Forward Send {WheelUp} else if JoyPOV between 13500 and 22500 ; Back Send {WheelDown} return RETURN |
Re: Stars NLH AHK Script Help
[ QUOTE ]
I think betting the pot and then using the slider to ajust is faster though. [/ QUOTE ] Exactly what I want it for. Betting the pot gets me close to what I want to bet. I use the Z axis to take it down to what I want to bet. |
Re: Stars NLH AHK Script Help
For problem 1. it's not that your joystick is sending rapid fire clicks, that is just the way I hacked this script. You can't use widgets to click visible buttons on Stars like you can on Party and most others because the some of the buttons are not identified by AHK although a more astute programmer could use the send message thing maybe. So the solution is to send multiple clicks which miss buttons that aren't present and click the ones that are. This script was designed for my system where all tables are visible at all times. I guess MTH doens't work with Stars?? That would solve your activation problems.
|
Re: Stars NLH AHK Script Help
[ QUOTE ]
You can't use widgets to click visible buttons on Stars like you can on Party and most others because the some of the buttons are not identified by AHK although a more astute programmer could use the send message thing maybe. [/ QUOTE ] I had to try... I can't find the code for EN_SETFOCUS though. When I send this WinspectorSpy says "Unknown edit code:0". SetTitleMatchMode 2 hwnd = 0x00170460 ;__auto-post checkbox or something - doesn't matter return !c:: PostMessage, 0x111,1001,%hwnd%,,Logged In as ;__0x0111 is WM_COMMAND, 1001 is the ControlID return |
Re: Stars NLH AHK Script Help
Nope, I can't figure out this PostMessage stuff. Here's a working slider-control example for play money though.
#Persistent ; Keep this script running until the user explicitly exits it. SetTimer, WatchAxis, 5 return WatchAxis: GetKeyState, JoyX, JoyX ;____I used the Z-axis because I use X and Y in my other script If JoyX > 70 ;____i.e. when you push it "up", increase the bet amount { WinGetTitle, title, A ;___just for testing-purposes we use the activ table... StringMid, bb, title, InStr(title, "/") + 1, InStr(title, "Play") - InStr(title, "/") - 1 ;___retrieve the big blind ControlGetText, t, Edit6, %title% ;___retrieve the text from the edit next to the slider t := t + bb ;___add one big blind ControlSetText, Edit6, %t%, %title% ;___set the new text If JoyX <> 100 ;___if it's bigger than zero (i.e. push it hard), don't sleep Sleep, 150 } return It's really not hard to modify the Party script. I'm sure you can get the "bet pot" code to work. |
Re: Stars NLH AHK Script Help
Thanks for the help!
I cannot figure out how to read the text in the Stars Chat tab, so betting the pot may be more difficult than hacking the party code. In the mean time, I think I may just set the button to bet 3x BBs. I will then use the slider (Z Axis) to adjust. |
All times are GMT -4. The time now is 12:19 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.