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 

Turning within a FPS

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





PostPosted: Mon Sep 15, 2008 10:19 pm    Post subject: Turning within a FPS Reply with quote

Well to put it straight forward, I'm trying to create a script that spins me a certain amount of degrees within a game client.
The only problem I have is that it works, ONCE, then the thing goes haywire and randomly flings my camera in a random direction.

It's nothing exceptional tbh, just a simple "mousemove -100, 0, 20, R"
Back to top
Sivvy



Joined: 21 Jul 2008
Posts: 711
Location: Calgary, AB, Canada

PostPosted: Mon Sep 15, 2008 10:31 pm    Post subject: Reply with quote

What about:

Code:
GetMousePos, x, y
mousemove -100, 0, 20, R
Sleep, 100
mousemove %x%, %y%, 20
Back to top
View user's profile Send private message MSN Messenger
Kay
Guest





PostPosted: Mon Sep 15, 2008 11:54 pm    Post subject: Reply with quote

In reality, it's
Code:
MouseGetPos, xpos, ypos

But yea, works like a charm. Thanks.
Back to top
Kay
Guest





PostPosted: Mon Sep 15, 2008 11:57 pm    Post subject: Reply with quote

Blockinput kills it though :/
Back to top
Tuberkulos



Joined: 16 Sep 2008
Posts: 3

PostPosted: Tue Sep 16, 2008 12:04 am    Post subject: Reply with quote

Since guest accounts can't edit their posts, I decided to make this account instead.

Basically, the script works as long as I don't move my cursor at an Y-axis within the game. If I for some reason move the cursor on the Y-axis, the script spirals my sights UP/DOWN. Only way for me to get it to turn me on the X-axis only, is by locking the sights in the same position as when I started the script (which is kind of hard to do).
Back to top
View user's profile Send private message
Sivvy



Joined: 21 Jul 2008
Posts: 711
Location: Calgary, AB, Canada

PostPosted: Tue Sep 16, 2008 2:19 pm    Post subject: Reply with quote

Code:
CenterX := %A_ScreenWidth% / 2
CenterY := %A_ScreenHeight% / 2
MouseGetPos, xPos, yPos
mousemove %CenterX%, %CenterY%, 0
mousemove -100, 0, 20, R
Sleep, 100
mousemove %CenterX%, %CenterY%, 0
mousemove %xPos%, %yPos%, 20

How about this? It'll center the cursor in the middle of your screen before doing anything, then will move your cursor back to where you originally had it when you pressed the hotkey.
Back to top
View user's profile Send private message MSN Messenger
Tuberkulos



Joined: 16 Sep 2008
Posts: 3

PostPosted: Tue Sep 16, 2008 2:48 pm    Post subject: Reply with quote

The bug still prevails.
Also, that script forces my character to bounce back his sights to the original position - making the script useless.
Back to top
View user's profile Send private message
Sivvy



Joined: 21 Jul 2008
Posts: 711
Location: Calgary, AB, Canada

PostPosted: Tue Sep 16, 2008 3:15 pm    Post subject: Reply with quote

I'm not sure what the game window looks like... Think you can figure it out with the theories you have now?
%A_ScreenWidth% = the exact pixels of the screen's width... Divide by 2 to get the center.
%A_ScreenHeight% = Same as above, except vertical.

If the problem is the Y-Axis, then maybe take out the part about moving to the center on the X-Axis, and have it only center on the "Y".

Maybe change the %CenterX% to %xPos%.
Back to top
View user's profile Send private message MSN Messenger
Bigrob55



Joined: 24 Sep 2007
Posts: 37

PostPosted: Wed Sep 17, 2008 5:11 pm    Post subject: Reply with quote

And may i ask which game is it that you need this script for?
_________________
Bigrob

L337 Speak - A Ventrilo Client Side program

Winamp Sound Changer - Change Audio Output on the Fly!
Back to top
View user's profile Send private message
Tuberkulos



Joined: 16 Sep 2008
Posts: 3

PostPosted: Thu Sep 18, 2008 1:49 pm    Post subject: Reply with quote

Face of Mankind.
Its no big deal really, I just wanted it to work as a fun-script.
And yea, I'm playing it in third person for anyone that cares.
Back to top
View user's profile Send private message
Sivvy



Joined: 21 Jul 2008
Posts: 711
Location: Calgary, AB, Canada

PostPosted: Thu Sep 18, 2008 3:04 pm    Post subject: Reply with quote

Did you find a solution yet?
Back to top
View user's profile Send private message MSN Messenger
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