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 11-28-2005, 10:50 AM
DavidC DavidC is offline
Senior Member
 
Join Date: Aug 2004
Location: Ontario, Canada
Posts: 292
Default Using a Game Controller as a mouse

I'm checking out the following thread:

http://archiveserver.twoplustwo.com/show...part=1&vc=1

as well as looking up a program called "joymouse".

I'm looking to use my game controller as a mouse. This is somewhat different than keyboard mapping, in that I want to be able to move about freely with my game controller, instead of sticking with a set of macros which I've mapped to the keyboard.

I'm not sure if I should be using tweakui or the other program, and I'm about to read up on that now.

---

Part of the purpose of this thread is to bump the old thread.

Anyone with experience with this feel free to chime in. I'm still working on the other threads at this time though. [img]/images/graemlins/smile.gif[/img]

--DAve.
Reply With Quote
  #2  
Old 11-28-2005, 10:54 AM
krimson krimson is offline
Senior Member
 
Join Date: Mar 2005
Location: wwdsd
Posts: 559
Default Re: Using a Game Controller as a mouse

I have a Party Poker autohotkey script in which I can control mouse movements with the left analog stick. I can post this tonight when I get home from work if someone doesn't help you out beforehand.
Reply With Quote
  #3  
Old 11-28-2005, 11:53 AM
MrMoo MrMoo is offline
Member
 
Join Date: Sep 2004
Posts: 43
Default Re: Using a Game Controller as a mouse

AHK script
Reply With Quote
  #4  
Old 11-28-2005, 07:31 PM
Nomad84 Nomad84 is offline
Senior Member
 
Join Date: Mar 2005
Posts: 194
Default Re: Using a Game Controller as a mouse

[ QUOTE ]
I have a Party Poker autohotkey script in which I can control mouse movements with the left analog stick. I can post this tonight when I get home from work if someone doesn't help you out beforehand.

[/ QUOTE ]

Please do post it. I am trying to get my xbox controller set up to multitable. I don't expect to find any particular script that does exactly what I want, but hopefully I can take bits and pieces out of several and arive at my ideal solution.
Reply With Quote
  #5  
Old 11-28-2005, 08:10 PM
krimson krimson is offline
Senior Member
 
Join Date: Mar 2005
Location: wwdsd
Posts: 559
Default Re: Using a Game Controller as a mouse

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Party Poker Keyboard Shortcuts
;
; Distributed the Online Poker FAQ
; See http://www.onlinepokerfaq.com/guide/...ess-poker.html
;
; Based on an original script by "illunious" at 2+2, posted 8/18/2004.


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Define keys for fold, check/call, and bet/raise
;
; The key for each action is defined by the string before the double colon.
; You can change the key like this:
; Regular keys: a, b, c, 1, 2, 3, etc.
; Function keys: F1, F2, etc.
; Numeric keypad: Numpad1, Numpad2, NumpadPlus, etc
; Arrows keys: Left, Right, Up, Down
; Control key prefix: add caret in front, like this: ^f, ^c, ^r
; Alt key prefix: add exclamantion point in front: !f, !c, !r
; Windows key prefix: add hash mark in front: #f, #c, #r

; Using a Joystick as a Mouse
; http://www.autohotkey.com
; This script converts a joystick into a three-button mouse. It allows each
; button to drag just like a mouse button and it uses virtually no CPU time.
; Also, it will move the cursor faster depending on how far you push the joystick
; from center. You can personalize various settings at the top of the script.

; Increase the following value to make the mouse cursor move faster:
JoyMultiplier = 0.30

; 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 = 2.5

; Change these values to use joystick button numbers other than 1, 2, and 3 for
; the left, right, and middle mouse buttons, respectively:
ButtonLeft = 2
ButtonRight = 12

; If your joystick has a POV control, you can use it as a mouse wheel. The
; following value is the number of milliseconds between turns of the wheel.
; Decrease it to have the wheel turn faster:
WheelDelay = 250

; If your system has more than one joystick, increase this value to use a joystick
; other than the first:
JoystickNumber = 1

; END OF CONFIG SECTION -- Don't change anything below this point unless you want
; to alter the basic nature of the script.

; this is to suspend the hotkeys, so you can type normally/browse web/etc
; note: ! = alt, ^ = ctrl.. so !t = alt+t

#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%

!t::
Suspend, Toggle

return ; End of auto-execute section.



; Fold
Joy1::
;MouseClick, left, 240, 474
;Sleep, 100
MouseClick, left, 240, 474
Sleep, 100
return

; Check/Call
Joy4::
;MouseClick, left, 385, 474
;Sleep, 100
MouseClick, left, 385, 474
Sleep, 100
return

; Bet/Raise
Joy3::
;MouseClick, left, 550, 474
;Sleep, 100
MouseClick, left, 550, 474
Sleep, 100
return

; AutoPost
Joy9::
MouseClick, left, 14, 533
Sleep, 100
return

; SitOut
Joy10::
MouseClick, left, 14, 568
Sleep, 100
return


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Define keys for absolute mouse motion to a particular window.
; For example, "Numpad7" always goes to the upper-left window.
; This does not depend on where the mouse starts.

; WindowNW
Joy7::
CoordMode, Mouse, Screen
MouseMove,400,300
MouseGetPos, curPosX, curPosY, curWin
WinGetTitle, title, ahk_id %curWin%
WinActivate, %title%
return

; WindowNE
Joy8::
CoordMode, Mouse, Screen
MouseMove,1200,300
MouseGetPos, curPosX, curPosY, curWin
WinGetTitle, title, ahk_id %curWin%
WinActivate, %title%
return

; WindowSW
Joy5::
CoordMode, Mouse, Screen
MouseMove,400,900
MouseGetPos, curPosX, curPosY, curWin
WinGetTitle, title, ahk_id %curWin%
WinActivate, %title%
return

; WindowSE
Joy6::
CoordMode, Mouse, Screen
MouseMove,1200,900
MouseGetPos, curPosX, curPosY, curWin
WinGetTitle, title, ahk_id %curWin%
WinActivate, %title%
return

; Return
Joy11::
Send {enter}
return


; 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
Reply With Quote
  #6  
Old 11-28-2005, 09:44 PM
Nomad84 Nomad84 is offline
Senior Member
 
Join Date: Mar 2005
Posts: 194
Default Re: Using a Game Controller as a mouse

Thanks! I'll read through this and see what will be usable for me.
Reply With Quote
  #7  
Old 11-29-2005, 05:00 AM
DavidC DavidC is offline
Senior Member
 
Join Date: Aug 2004
Location: Ontario, Canada
Posts: 292
Default Re: Using a Game Controller as a mouse

I'm definitely going to take a peek through what you guys have written here, but I'll put up my trip report so far:

Here's what I've found: I've glanced through the PDF referenced in the thread that I linked to. They're talking about scripts written with a program called "autohotkey", which are customized to party poker, and they certainly do their job.

There are other programs out there that you could use to convert your keyboard into the same purpose as a game controller... and I suppose that you could continuously switch up between scripts, going from mouse to keyboard to controller and back, in order to reduce stress on your body. This is ideal, and it's similar to what graphic artists do.

Here's what I did, though:

------------------------------------

1) I wanted to be able to use my controller as a mouse in all situations, so that I could use it with any software. I didn't have to multitable all the time with it. Therefore I went out and got joymouse (link). This program is shareware for 30 days.

I bookmarked all the other programs, just in case I wanted a more permanent, customized, and powerful solution later.

2) When I set up joymouse, you go down to performance and configure "pointer speed" to your desired sensitivity. If you want to make it capable of more subtle movements, I believe that you need to change the "pointer increment law" from linear to quadratic or cubic, which would probably give you some sensitivity in near regions to the center of the joystick, but fast movement in far regions... I haven't played around with that. I set my pointer speed to 1500, fwiw.

3) Just for fun I also tried to set up my joymouse to run ALT-TAB for me, but found that it was unable to specify LEFT TAB, and therefore it didn't work. [img]/images/graemlins/frown.gif[/img]

---

I've found that this program works fine for running a single program where there are two buttons to press and they're close together. This is probably not ideal for what you guys are trying to do, but it's fast, and it does its job for me, for now.

I'm not particularly looking forward to the day when I'm doing more multitabling and have to start using more complicated programs to get my job done. However, I'm content that the info is out there and easily available.

Thanks guys.

I hope you don't mind me posting up this alternative.

--Dave.
Reply With Quote
  #8  
Old 11-29-2005, 01:08 PM
MrMoo MrMoo is offline
Member
 
Join Date: Sep 2004
Posts: 43
Default Re: Using a Game Controller as a mouse

AutoHotKey will solve all the problems your looking to solve. Familiarizing yourself with the scripting language and modifying it to suit your needs is all that needs to be done.

Scripts for multitabling with AutoHotKey have already been written and can be found here .

A script for controlling your joystick can be found in the link I provided above.

Having your controller trigger alt+tab is easily done and can be figured out by reading the manual for AutoHotKey.

Combining all of the above into one script which works right for you should be achievable in a day or two. The majority of the time spent learning the autohotkey scripting language and understanding how the existing scripts I've linked to function.
Reply With Quote
  #9  
Old 11-29-2005, 05:09 PM
Nomad84 Nomad84 is offline
Senior Member
 
Join Date: Mar 2005
Posts: 194
Default Re: Using a Game Controller as a mouse

I just wanted say thanks for the link in the OP. I've been searching 2+2 for controller related scripts, but I never found that one. It is EXACTLY what I was needing, since I am trying to use my xbox controller to play poker. I had no idea how to script it myself, so having a starting point is awesome. Thanks to CMI and Qtip for writing those. I think I'll use a hybrid of them. I'll probably modify it to use the A, B, X, and Y buttons to select the tables (hold left trigger to choose the same on second monitor), start to check/uncheck autopost, d-pad to choose actions (check/fold, call, raise), and probably the black button to fold. I like having the joystick as a mouse too. I'll probably use the joystick click button for a mouseclick. I may post whatever I end up with, but I expect it to take some time to get it all right. Thanks again for the link. I was clueless about where to start.
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 08:37 AM.


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