Two Plus Two Older Archives  

Go Back   Two Plus Two Older Archives > Internet Gambling > Software
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-19-2005, 06:43 PM
climber climber is offline
Member
 
Join Date: Sep 2004
Posts: 53
Default Help with an AutoHotKey Script I\'m using

Hi I have a script that is working fine for me and am trying to add some new funtionality using a gamepad controller I bought.

<font class="small">Code:</font><hr /><pre>;;;;;;;;;;;;;;Here is what I have in my old script working fine:
;;;;;;;;;;;;;;This is the functionality I am trying to get using my gamepad
; WindowLeft
Numpad4::
CoordMode, Mouse, Relative
MouseMove,-400,300
MouseGetPos, curPosX, curPosY, curWin
WinGetTitle, title, ahk_id %curWin%
WinActivate, %title%
return

; WindowDown
Numpad2::
CoordMode, Mouse, Relative
MouseMove,400,900
MouseGetPos, curPosX, curPosY, curWin
WinGetTitle, title, ahk_id %curWin%
WinActivate, %title%
return

; WindowRight
Numpad6::
CoordMode, Mouse, Relative
MouseMove,1200,300
MouseGetPos, curPosX, curPosY, curWin
WinGetTitle, title, ahk_id %curWin%
WinActivate, %title%
return

; WindowUp
Numpad8::
CoordMode, Mouse, Relative
MouseMove,400,-300
MouseGetPos, curPosX, curPosY, curWin
WinGetTitle, title, ahk_id %curWin%
WinActivate, %title%
return

;;;;;;;;;;;;;;;;;Here is some script I am using currently to do something else with the POV controls of my gamepad

GetKeyState, JoyPOV, %JoystickNumber%JoyPOV
if JoyPOV = -1 ; No angle.
return
if JoyPOV=0 ; Forward
{
;MouseClick, left, 240, 474
;Sleep, 100
MouseClick, left, 240, 474
Sleep, 100
}
else if JoyPOV between 5000 and 9500 ; Forward
{
;MouseClick, left, 550, 474
;Sleep, 100
MouseClick, left, 550, 474
Sleep, 100
}
else if JoyPOV between 20000 and 27500 ; Forward
{
;MouseClick, left, 240, 474
;Sleep, 100
MouseClick, left, 240, 474
Sleep, 100
}
else if JoyPOV between 12000 and 18500 ; Back
{
;MouseClick, left, 385, 474
;Sleep, 100
MouseClick, left, 385, 474
Sleep, 100
}
return


;;;;;;;;;;I cut and paste resulting in this and its doesn't do anything
GetKeyState, JoyPOV, %JoystickNumber%JoyPOV

if JoyPOV = -1 ; No angle.
return

if JoyPOV=0
{
CoordMode, Mouse, Relative
MouseMove,400,-300
MouseGetPos, curPosX, curPosY, curWin
WinGetTitle, title, ahk_id %curWin%
WinActivate, %title%
}

else if JoyPOV between 5000 and 9500
{
CoordMode, Mouse, Relative
MouseMove,1200,300
MouseGetPos, curPosX, curPosY, curWin
WinGetTitle, title, ahk_id %curWin%
WinActivate, %title%
}

else if JoyPOV between 20000 and 27500
{
CoordMode, Mouse, Relative
MouseMove,-400,300
MouseGetPos, curPosX, curPosY, curWin
WinGetTitle, title, ahk_id %curWin%
WinActivate, %title%
}

else if JoyPOV between 12000 and 18500
{
CoordMode, Mouse, Relative
MouseMove,400,900
MouseGetPos, curPosX, curPosY, curWin
WinGetTitle, title, ahk_id %curWin%
WinActivate, %title%
}

return</pre><hr />
any ideas why my "if else" function doesn't seem to be able to use the POV controls of my gamepad to move the mouse and change the active table for me?

Thanks
--climber

[/ QUOTE ]
Reply With Quote
  #2  
Old 10-20-2005, 02:31 PM
MrMoo MrMoo is offline
Member
 
Join Date: Sep 2004
Posts: 43
Default Re: Help with an AutoHotKey Script I\'m using

You basically need to have an endless loop which continually queries 1JoyV. Use GetKeyState.

There is sample code in the .chm help file for using a joystick. I think it's under sample scripts or something like that. Run that code and you'll see how a joystick is controlled.

If you want, send me a PM and I'll send my joystick script when I get home.
Reply With Quote
  #3  
Old 10-22-2005, 05:39 AM
Guest
 
Posts: n/a
Default Re: Help with an AutoHotKey Script I\'m using

I had trouble with this too when I tried to get my gamepad working.

Here's bits of from my script (these are my Will Hill settings)

Put this bit of code at the top of your script, before any hotkey assignments like Joypad buttons.
<font color="green">
<font class="small">Code:</font><hr /><pre>
SetTimer, WatchPOV, 50
return
</pre><hr /></font>
This sets up the timer to check the state of the POV button.

You can then put in any hotkey assignments.

After your hotkey assignments, you have the function that is triggered by the timer.
<font color="green">
<font class="small">Code:</font><hr /><pre>
WatchPOV:

GetKeyState, POV, JoyPOV ; Get position of the POV control.

if POV &lt; 0 ; No angle to report
KeyToHoldDown =
else if POV between 0 and 4500 ; 0 to 45 degrees: Up - Check/Call
{
MouseClick, left, 588, 548
Sleep, 100
}
else if POV between 4501 and 13500 ; 45 to 135 degrees: Right - Raise
{
MouseClick, left, 712, 559
Sleep, 100
}
else if POV between 13501 and 22500 ; 135 to 225 degrees: Down - Post Blinds
{
MouseClick, left, 446, 541
Sleep, 100
}
else ; 225 to 315 degrees: Left - Fold
{
MouseClick, left, 447, 580
Sleep, 100
}

return
</pre><hr />
</font>
Hope that helps

SwingSwingSwing
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:54 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.