AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Mouse Clicks Not Working Right

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Wee Dawg
Guest





PostPosted: Tue Jun 24, 2008 11:40 pm    Post subject: Mouse Clicks Not Working Right Reply with quote

I'm trying to make a hotkey that launches Halo Combat Evolved to a certain multiplayer server. I've given up on how to link directly to the server itself (even though I know its possible). So I'm at least trying to make one that will connect through the game menus. I've tried using standard keystrokes (arrow keys), didn't work at all. The Mouse clicks act like they want to work. So far this is what i have:

Code:
;test:  Alt + z
$!Z::
Run, D:\Games\Halo\halo.exe -console -screenshot -novideo -nojoystick, D:\Games\Halo ;This works fine
Sleep, 31000
IfWinActive, Halo
{
Critical
;X619 Y529 Multiplayer button posistion
;X507 Y433 Direct addy posistion
;X810 Y454 Input addy posistion
SendMode Click 619, 529 Down ;What I meant by kinda worked is the Mouse pointer will disappear to my desktop to the said spot on the screen.
Sleep, 250
SendMode Click 507, 433, Down
Sleep, 250
SendMode Click 810, 454, Down
Sleep, 250
SendMode {Enter}
Sleep, 250
SendInput, x.x.xx.xx {Enter 2}
}
return


Any help is apprciated. Very Happy
Back to top
argneo



Joined: 14 Sep 2007
Posts: 124

PostPosted: Wed Jun 25, 2008 8:31 pm    Post subject: Re: Mouse Clicks Not Working Right Reply with quote

Code:
;test:  Alt + z
$!Z::
Run, D:\Games\Halo\halo.exe -console -screenshot -novideo -nojoystick, D:\Games\Halo ;This works fine
Sleep, 31000
IfWinActive, Halo
{
Critical
;X619 Y529 Multiplayer button posistion
;X507 Y433 Direct addy posistion
;X810 Y454 Input addy posistion
SetKeyDelay, 10, 10
WinGet, HALO, List, Halo
sleep, 10
ControlSend, , {Click 619 529}, ahk_id %HALO%
Sleep, 250
ControlSend, , {Click 507 433}, ahk_id %HALO%
Sleep, 250
ControlSend, , {Click 810 454}, ahk_id %HALO%
Sleep, 250
ControlSend, , {Enter}, ahk_id %HALO%
Sleep, 250
ControlSend, , x.x.xx.xx {Enter 2}, ahk_id %HALO%
}
return


Try this
_________________

WoW
Back to top
View user's profile Send private message
Wee Dawg
Guest





PostPosted: Wed Jun 25, 2008 10:27 pm    Post subject: No Good Reply with quote

Argneo,

Forgive me but I am fairly new to ahk. The above code didn't do anything at all. I did have another question after trying your code several different ways. I rechecked my cursor coords., and they were totally different than the prev. ones (and yes I tried those with no luck). I had the cursor roughly in the same spot as before, a few numbers off I wouldn't be asking, but its like +/-200 for each.

My previous coords for muiltiplay button: 619 529
Todays coords for multiplay button: 854 700

Code I used to check Coords:

Code:
;Mouse Coods:  Alt + c
$!C::
MouseGetPos, xpos, ypos
Msgbox, The cursor is at X%xpos% Y%ypos%
Return


So my other question is why is my coods changing, the Multiplayer button is stationary (middle of screen). Am I using the wrong code to get my coods?
Back to top
engunneer



Joined: 30 Aug 2005
Posts: 6772
Location: Pacific Northwest, US

PostPosted: Wed Jun 25, 2008 10:32 pm    Post subject: Reply with quote

that looks like good code for checking coordinates. Did you change your screen resolution?
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
ImprisonedPride



Joined: 30 Apr 2008
Posts: 28

PostPosted: Thu Jun 26, 2008 12:27 am    Post subject: Reply with quote

For full screen games like halo, I always use WindowSpy, but it might be hard to use if you only have one monitor. (I use 4.)
_________________
Call me IP.
Back to top
View user's profile Send private message
Wee Dawg
Guest





PostPosted: Thu Jun 26, 2008 1:00 am    Post subject: Reply with quote

engunneer: No same resolution.

ImprisonedPride: I only have 1 monitor, can I borrow a couple of yours Wink

Got another question: I (along with others), admin for our Halo servers. Occasionally we have to do our duty and kick/ban people from the server. Originally I had the code set as followed:

Code:
;Kick: Left Alt + K
$~<!K::
IfWinActive, Halo
{
Critical
BlockInput, On
Sleep, 110
SendInput, {Enter}+~
Sleep, 110
SendInput rcon Password sv_players)
Sleep, 110
SendInput, {Enter}
Sleep, 110
SendInput, rcon Password sv_kick ){left}
BlockInput, Off
KeyWait, Enter, D
Sleep, 50
SendInput, {Enter}
Sleep, 250
SendInput, T
Sleep, 50
SendInput Player KICKED{!} {Enter}
}
return


This code worked great, but I always wanted to set it up so ahk would insert our password from elsewhere in the file, so incase we ever changed the password, I'd just have to change it once and not a dozen times. So a couple of days ago I came up with this:

Code:
Password = ourpass

;Kick: Left Alt + K
$~<!K::
IfWinActive, Halo
{
Critical
BlockInput, On
Sleep, 110
SendInput, {Enter}+~
Sleep, 110
SendInput rcon %ourpass% sv_players)
Sleep, 110
SendInput, {Enter}
Sleep, 110
SendInput, rcon %ourpass% sv_kick ){left}
BlockInput, Off
KeyWait, Enter, D
Sleep, 50
SendInput, {Enter}
Sleep, 250
SendInput, T
Sleep, 50
SendInput Player KICKED{!} {Enter}
}
return


This code worked perfectly up until today. Now it won't insert the password. Why would it stop working?
Back to top
argneo



Joined: 14 Sep 2007
Posts: 124

PostPosted: Thu Jun 26, 2008 6:05 pm    Post subject: Reply with quote

Well.. you have to understand that there are 2 types of coordinates... global (desktop) and local (within a specific window). So when it might be a certain number for the global type, it may be a very different one for the local one.
If the mouse clicks didn't work, try using the arrows like this..

Code:
ControlSend, , {RIGHT DOWN}{RIGHT UP}, ahk_id %HALO%

_________________

WoW
Back to top
View user's profile Send private message
Wee Dawg
Guest





PostPosted: Thu Jun 26, 2008 8:59 pm    Post subject: Reply with quote

argneo,

Yes you are right about the coordinates. The arrow keys still don't work. It does nothing, and yet while im in the game everything works fine, why won't anything work on the start screens?
Back to top
argneo



Joined: 14 Sep 2007
Posts: 124

PostPosted: Thu Jun 26, 2008 9:23 pm    Post subject: Reply with quote

I honestly don't have a clew because i never played halo Razz
_________________

WoW
Back to top
View user's profile Send private message
Wee Dawg
Guest





PostPosted: Fri Jun 27, 2008 9:33 pm    Post subject: Reply with quote

Argneo, not a problem thats for trying Razz

I fixed the Password thing i think? I had added another hotkey code before the password, moved the hotkey code below it, so the password string is at the top of the whole code, and it works again.
Back to top
Wee Dawg
Guest





PostPosted: Fri Jun 27, 2008 9:35 pm    Post subject: Reply with quote

Thats = Thanks lol
Back to top
Wee Dawg



Joined: 28 Jun 2008
Posts: 5
Location: Kentucky

PostPosted: Sun Jul 06, 2008 12:43 am    Post subject: Reply with quote

Ok one more question, and I think I know the answer to this because I've tried and it didnt work, but its worth an a try. I've found that if I do this:

Code:
z::down


will simulate the down arrow in the menu screen of Halo (if I press the z key), is there anyway to string a bunch of those together to get what i want like this (I know this doesn't work because I tried):

Code:
z::down enter down down down enter down down enter


or is there a way to make a loop or subrutine that can simulate keys without using any of the Send commands because none of those will work (the menu screens only).

Incase you didn't read my orignal question I'm trying to make a script that with a couple keystrokes will start Halo, and log into a multiplayer game. As you can see I've tried simulating mouse clicks, and using every Send command AHK has, and none have worked.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group