| View previous topic :: View next topic |
| Author |
Message |
Kay Guest
|
Posted: Mon Sep 15, 2008 10:19 pm Post subject: Turning within a FPS |
|
|
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
|
Posted: Mon Sep 15, 2008 10:31 pm Post subject: |
|
|
What about:
| Code: | GetMousePos, x, y
mousemove -100, 0, 20, R
Sleep, 100
mousemove %x%, %y%, 20 |
|
|
| Back to top |
|
 |
Kay Guest
|
Posted: Mon Sep 15, 2008 11:54 pm Post subject: |
|
|
In reality, it's | Code: | | MouseGetPos, xpos, ypos |
But yea, works like a charm. Thanks. |
|
| Back to top |
|
 |
Kay Guest
|
Posted: Mon Sep 15, 2008 11:57 pm Post subject: |
|
|
| Blockinput kills it though :/ |
|
| Back to top |
|
 |
Tuberkulos
Joined: 16 Sep 2008 Posts: 3
|
Posted: Tue Sep 16, 2008 12:04 am Post subject: |
|
|
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 |
|
 |
Sivvy
Joined: 21 Jul 2008 Posts: 711 Location: Calgary, AB, Canada
|
Posted: Tue Sep 16, 2008 2:19 pm Post subject: |
|
|
| 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 |
|
 |
Tuberkulos
Joined: 16 Sep 2008 Posts: 3
|
Posted: Tue Sep 16, 2008 2:48 pm Post subject: |
|
|
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 |
|
 |
Sivvy
Joined: 21 Jul 2008 Posts: 711 Location: Calgary, AB, Canada
|
Posted: Tue Sep 16, 2008 3:15 pm Post subject: |
|
|
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 |
|
 |
Bigrob55
Joined: 24 Sep 2007 Posts: 37
|
|
| Back to top |
|
 |
Tuberkulos
Joined: 16 Sep 2008 Posts: 3
|
Posted: Thu Sep 18, 2008 1:49 pm Post subject: |
|
|
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 |
|
 |
Sivvy
Joined: 21 Jul 2008 Posts: 711 Location: Calgary, AB, Canada
|
Posted: Thu Sep 18, 2008 3:04 pm Post subject: |
|
|
| Did you find a solution yet? |
|
| Back to top |
|
 |
|