AutoHotkey Community

It is currently May 27th, 2012, 5:54 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 26 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: RESOLVED
PostPosted: August 11th, 2010, 2:03 am 
Offline

Joined: June 20th, 2010, 3:01 am
Posts: 15
Anonymous wrote:
The second problem was not being able to scroll up. I messed around in the script and resolved this, all you need to do is modify the original script at ONE part in the script:

UChar,(llY + 30) >> 8*A_Index-8)

Just change the 30 to a 25 and BINGO, save the script, close the script, reopen it, done


Doesn't work for me on Win7


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 11th, 2010, 2:27 am 
Offline

Joined: June 20th, 2010, 3:01 am
Posts: 15
Oops, I made a bonehead error -- It works for me with

(llY + 26)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 27th, 2010, 10:04 am 
Offline

Joined: August 27th, 2010, 10:00 am
Posts: 2
Hi, could you modify this script to use scroll lock?

Since it's not polite to write with CAPS in a multiplayer game.

Also will this work on Windowed mode (fullscreen)?

I have to monitors and when i scroll to the right with the mouse.. it doesn't it simply moves the mouse to the other screen.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: September 8th, 2010, 7:34 am 
Bkid wrote:
I really enjoyed the fact that you can scroll the map by moving your mouse to the very edge of the screen, but I wasn't happy with the fact that the game didn't lock your mouse into its window if you play the game in windowed mode.

I wanted to have the best of both worlds, so I came up with this script. It's a good amount of borrowed code from "corrupt", a user here on the AHK forums. I've modified the code a little so that it doesn't go all the way to the top of the window (bar and all), and doesn't go to the very edges of any side of the screen. Also, it's now activated with CapsLock.

Code:
;
;    Author:      Bkid <Bkid@bemaniso.ws>
;   Thanks to corrupt for the original mouse locking code.
;
;   This script finds the size of the SC2 window, its edges, and locks
;   the mouse into the window. This way, you can use the mouse scroll,
;   even if you're windowed. You can lock the mouse by turning CapsLock on,
;   and unlock it by turning CapsLock off.

#SingleInstance Force
#Persistent
Menu, Tray, NoStandard
Menu, Tray, Add, Credits
Menu, Tray, Add, Exit
TrayTip, Mouse lock v1.0 for SC2, CapsLock on = Lock the mouse to the StarCraft 2 window.`nCapsLock off = Release the mouse., 5, 1
SetCapsLockState, Off
SetTimer, LockCheck, 5

LockCheck:
GetKeyState, CapsState, CapsLock, T
If CapsState = D
{
Lock("StarCraft II")
Suspend, Off
WinActivate, StarCraft II
Return
} else {
Lock()
Suspend, On
return
}

Lock(llwindowname="")
{
  VarSetCapacity(llrectA, 16)
  WinGetPos, llX, llY, llWidth, llHeight, %llwindowname%
  If (!llWidth AND !llHeight) {
    DllCall("ClipCursor")
    Return, False
  }
  Loop, 4 {
    DllCall("RtlFillMemory", UInt,&llrectA+0+A_Index-1, UInt,1, UChar,(llX + 4) >> 8*A_Index-8)
    DllCall("RtlFillMemory", UInt,&llrectA+4+A_Index-1, UInt,1, UChar,(llY + 30) >> 8*A_Index-8)
    DllCall("RtlFillMemory", UInt,&llrectA+8+A_Index-1, UInt,1, UChar,(llWidth + llX - 4)>> 8*A_Index-8)
    DllCall("RtlFillMemory", UInt,&llrectA+12+A_Index-1, UInt,1, UChar,(llHeight + llY - 4) >> 8*A_Index-8)
  }
  DllCall("ClipCursor", "UInt", &llrectA)
Return, True
}

Credits:
MsgBox, 262144,, Mouse lock v1.0 for StarCraft II by Bkid (Bkid@bemaniso.ws).`n`nThanks to corrupt on the AutoHotKey forums for the`ninitial mouse locking code.
return

Exit:
exitapp




What needs to be added/changed:

* A better way to activate the window (right now it can be screwed up if you have a folder open named "StarCraft II"

* Bug fixes/things I haven't realized are wrong yet. :p

* Code clean up



Um... I was wondering how we use this script? Like what do you do with the script in order for it to work with the Starcraft 2?


Report this post
Top
  
Reply with quote  
PostPosted: September 8th, 2010, 4:42 pm 
Offline

Joined: August 27th, 2010, 10:00 am
Posts: 2
naki12 wrote:
Um... I was wondering how we use this script? Like what do you do with the script in order for it to work with the Starcraft 2?

There is a program that loads ahk scripts. It's called AutoHotkeyand you can download it at http://www.autohotkey.com


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 8th, 2010, 11:53 pm 
Offline

Joined: September 8th, 2010, 11:49 pm
Posts: 1
will you be banned if you use this?


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Further concerns
PostPosted: September 9th, 2010, 7:07 am 
Thank you for your reply, the program worked.

I was just wondering how to adjust the script so that it only locks the mouse for the StarCraft II window and not any other windows.

Also how to adjust the border height for where the mouse cursor is allowed to go because, with the current script, the cursor touches items on my taskbar and the top window.


Report this post
Top
  
Reply with quote  
PostPosted: April 11th, 2012, 4:46 am 
Thanks for the script. I have taken the liberty to adjust it for win 7:

;
; Author: Bkid <Bkid@bemaniso.ws>
; Thanks to corrupt for the original mouse locking code.
;
; This script finds the size of the SC2 window, its edges, and locks
; the mouse into the window. This way, you can use the mouse scroll,
; even if you're windowed. You can lock the mouse by turning CapsLock on,
; and unlock it by turning CapsLock off.

#SingleInstance Force
#Persistent
Menu, Tray, NoStandard
Menu, Tray, Add, Credits
Menu, Tray, Add, Exit
TrayTip, Mouse lock v1.0 for SC2, CapsLock on = Lock the mouse to the StarCraft 2 window.`nCapsLock off = Release the mouse., 5, 1
SetCapsLockState, Off
SetTimer, LockCheck, 5

LockCheck:
GetKeyState, CapsState, CapsLock, T
If CapsState = D
{
Lock("StarCraft II")
Suspend, Off
WinActivate, StarCraft II
Return
} else {
Lock()
Suspend, On
return
}

Lock(llwindowname="")
{
VarSetCapacity(llrectA, 16)
WinGetPos, llX, llY, llWidth, llHeight, %llwindowname%
If (!llWidth AND !llHeight) {
DllCall("ClipCursor")
Return, False
}
Loop, 4 {
DllCall("RtlFillMemory", UInt,&llrectA+0+A_Index-1, UInt,1, UChar,(llX + 8) >> 8*A_Index-8)
DllCall("RtlFillMemory", UInt,&llrectA+4+A_Index-1, UInt,1, UChar,(llY + 32) >> 8*A_Index-8)
DllCall("RtlFillMemory", UInt,&llrectA+8+A_Index-1, UInt,1, UChar,(llWidth + llX - 8)>> 8*A_Index-8)
DllCall("RtlFillMemory", UInt,&llrectA+12+A_Index-1, UInt,1, UChar,(llHeight + llY - 8) >> 8*A_Index-8)
}
DllCall("ClipCursor", "UInt", &llrectA)
Return, True
}

Credits:
MsgBox, 262144,, Mouse lock v1.0 for StarCraft II by Bkid (Bkid@bemaniso.ws).`n`nThanks to corrupt on the AutoHotKey forums for the`ninitial mouse locking code.
return

Exit:
exitapp


Report this post
Top
  
Reply with quote  
PostPosted: April 11th, 2012, 4:48 am 
Thanks for the script. I have taken the liberty to adjust it for win 7:

Code:
;
;    Author:      Bkid <Bkid@bemaniso.ws>
;   Thanks to corrupt for the original mouse locking code.
;
;   This script finds the size of the SC2 window, its edges, and locks
;   the mouse into the window. This way, you can use the mouse scroll,
;   even if you're windowed. You can lock the mouse by turning CapsLock on,
;   and unlock it by turning CapsLock off.

#SingleInstance Force
#Persistent
Menu, Tray, NoStandard
Menu, Tray, Add, Credits
Menu, Tray, Add, Exit
TrayTip, Mouse lock v1.0 for SC2, CapsLock on = Lock the mouse to the StarCraft 2 window.`nCapsLock off = Release the mouse., 5, 1
SetCapsLockState, Off
SetTimer, LockCheck, 5

LockCheck:
GetKeyState, CapsState, CapsLock, T
If CapsState = D
{
Lock("StarCraft II")
Suspend, Off
WinActivate, StarCraft II
Return
} else {
Lock()
Suspend, On
return
}

Lock(llwindowname="")
{
  VarSetCapacity(llrectA, 16)
  WinGetPos, llX, llY, llWidth, llHeight, %llwindowname%
  If (!llWidth AND !llHeight) {
    DllCall("ClipCursor")
    Return, False
  }
  Loop, 4 {
    DllCall("RtlFillMemory", UInt,&llrectA+0+A_Index-1, UInt,1, UChar,(llX + 8) >> 8*A_Index-8)
    DllCall("RtlFillMemory", UInt,&llrectA+4+A_Index-1, UInt,1, UChar,(llY + 32) >> 8*A_Index-8)
    DllCall("RtlFillMemory", UInt,&llrectA+8+A_Index-1, UInt,1, UChar,(llWidth + llX - 8)>> 8*A_Index-8)
    DllCall("RtlFillMemory", UInt,&llrectA+12+A_Index-1, UInt,1, UChar,(llHeight + llY - 8) >> 8*A_Index-8)
  }
  DllCall("ClipCursor", "UInt", &llrectA)
Return, True
}

Credits:
MsgBox, 262144,, Mouse lock v1.0 for StarCraft II by Bkid (Bkid@bemaniso.ws).`n`nThanks to corrupt on the AutoHotKey forums for the`ninitial mouse locking code.
return

Exit:
exitapp


sry for doublepost


Report this post
Top
  
Reply with quote  
PostPosted: April 17th, 2012, 8:32 pm 
Options -> Controls -> Confine Mouse Cursor exists in the game.


Report this post
Top
  
Reply with quote  
PostPosted: May 3rd, 2012, 1:06 am 
Offline

Joined: September 26th, 2005, 1:15 am
Posts: 66
Location: GA
Haha, I just started playing SC2 again, and I'm surprised this thread has any recent posts. I don't even think I have that script on my computer anymore, so it's a good thing that it's still here.

Also,

Guest wrote:
Options -> Controls -> Confine Mouse Cursor exists in the game.


This script was made during the SC2 beta, where that option may or may not have been available. Regardless, I had fun making this script and learned a lot about AHK in the process.

_________________
--Bkid--


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 26 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group