View Full Version : Hot Tip: Make your mouse wheel zoom in the map!
MarkShot
11-27-2009, 04:18 AM
Here is a hot tip for everyone who wanted to use the mouse wheel in the map screen to zoom in and out. Yes, ESim it is almost 2010 and all G*d's children have mouse wheels these days.
Download this free utility:
http://www.autohotkey.com/
Create the following script file "MouseZoom.ahk":
; Make the mouse wheel zoom in and out in Steel Beast Pro PE
;
; Mark Kratzer - 11/26/09 (revised 11/26/09)
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetTitleMatchMode 3
#IfWinActive, Steel Beasts Pro PE
WheelDown::
Send -
Return
WheelUp::
Send {+}
Return
My formatting will probably be lost above, but it does not really matter.
Now, before playing launch the script by double clicking on the file. (You can create a shortcut to the file if you like.)
This will have no impact on any other programs as it only activates when you are SBPPE. When you are not playing, you can shot down the utility from the System Tray. It will be the green icon with an "H".
Have fun!
MarkShot
11-27-2009, 04:37 PM
My next upgrade to mouse support will be to make the map scroll by pushing the cursor to the edge of the screen.
This will push my scripting with this utility to the next level.
OTW!
Piotre
11-27-2009, 06:54 PM
That's just what the doctor ordered!
Works like a charm, thank you :luxhello:.
Now, since people are never happy ;) and you expressed interest in pushing your scripting with this utility to the next level :biggrin:, how about letting us drag the map by pressing the central mouse button?
MarkShot
11-27-2009, 07:02 PM
Sorry to not take your request, but I am coding for ME!
However, if just got the basic code structure working to scroll the map when you push the mouse to the screen edge.
I have to go out, but I will finish it up later today and post after some more testing.
The only issue I see is for people with a single processor and poor performance. This might eat into their FPS. I have four processors and I am running SBPPE and AutoHotKey on different processors.
Later.
MarkShot
11-27-2009, 10:31 PM
ZOOM + SCROLL !!!!!
Okay, working and tested. Very enhanced mouse support in the map.
Note1: You'll have to modify your script to correspond to your playing resolution. Yes, I know there must be a function to check the screen resolution, but I am doing this for myself and just making it available to others as a courtesy.
Note2: The code is not the most elegant. Clearly, I should have used an additional subroutine. But I am only started learning this utility/language yesterday.
; Enhance mouse map handling in Steel Beasts Pro PE
; Make the mouse wheel zoom in and out.
; Added map scrolling by moving the mouse to edge of map.
;
; Mark Kratzer - 11/27/09 (revised 11/27/09)
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
ScreenWidth = 1600
ScreenHeight = 1200
EdgeTopY = 0
EdgeRightX := ScreenWidth - 1
EdgeBottomY := ScreenHeight - 1
EdgeLeftX = 0
HoldInterval = 200
TimerInterval = 200
SetTitleMatchMode 3
SetTimer, WatchCursor, %TimerInterval%
return
WatchCursor:
IfWinActive, Steel Beasts Pro PE
{
MouseGetPos, XPos, YPos
If (YPos = EdgeTopY)
{
Send {UP down}
Sleep HoldInterval
Send {UP up}
}
If (YPos = EdgeBottomY)
{
Send {DOWN down}
Sleep HoldInterval
Send {DOWN up}
}
If (XPos = EdgeLeftX)
{
Send {LEFT down}
Sleep HoldInterval
Send {LEFT up}
}
If (XPos = EdgeRightX)
{
Send {RIGHT down}
Sleep HoldInterval
Send {RIGHT up}
}
}
return
#IfWinActive, Steel Beasts Pro PE
WheelDown::
Send -
Return
WheelUp::
Send {+}
Return
MarkShot
11-27-2009, 11:28 PM
I have taken it to yet another level.
I now have a version that:
(1) Does all the above.
(2) Dynamically responds to whatever resolution is used. You change the resolution in the middle of running SBPPE.
(3) The code is compiled. Just run a 200K EXE and you have mouse support in the map.
I plan to release to the site downloads after I get some people to test it.
Tacbat
11-29-2009, 07:03 AM
You've got my attention.
MarkShot
11-29-2009, 03:01 PM
There are some unintended consequences of using this due to the way it functions which are handy, in fact. (see my comments in the code)
After using, I decided to create mouse landing zones at the top and bottom of the screen. This prevents quickly stabbing for the menu at the top or units at the bottom while playing from triggering scrolling.
However, after making the above change. It makes it difficult to deliver a dynamic resolution version that is compiled and needs no tweaking by the player. Perhaps, I can simply disable the landing zones if the resolution is below a certain minimum. If it is above the required minimum, then I simply split the width and make the mouse landing zones the top right and the bottom left for scrolling.
What do you think? (I'll include my non-dynamic version below for my personal use so that you can see what I mean.)
There is also the issue of MP use. This allows the player to crank the turret much more conveniently by pushing the mouse to the edge than by stabbing the keyboard. Some might consider that a cheat. I am hesitant to be the source of "a cheat utility", since I know how MP communities are.
; Enhance mouse map handling in Steel Beasts Pro PE
;
; Make the mouse wheel zoom in and out.
; Added map scrolling by moving the mouse to edge of map.
;
; Further tuning for 1600x1200 to avoid scrolling problems in games 3D
; at top edge and bottom edge. Basically, to scroll you must hit the
; top right half or the bottom left half.
;
; Unintended but useful consequences:
; - Can scroll the F8 (external view) more smoothly left and right.
; - Can use the scroll to manually crank the turrent instead of the arrow keys.
;
; Mark Kratzer - 11/27/09 (revised 11/28/09)
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
ScreenWidth = 1600
ScreenHeight = 1200
TopMenuLoc = 800
BottomDialogueLoc = 800
EdgeTopY = 0
EdgeRightX := ScreenWidth - 1
EdgeBottomY := ScreenHeight - 1
EdgeLeftX = 0
HoldInterval = 100
TimerInterval = 100
SetTitleMatchMode 3
SetTimer, WatchCursor, %TimerInterval%
return
WatchCursor:
IfWinActive, Steel Beasts Pro PE
{
MouseGetPos, XPos, YPos
If (YPos = EdgeTopY)
{
If (XPos > TopMenuLoc)
{
Send {UP down}
Sleep HoldInterval
Send {UP up}
}
}
If (YPos = EdgeBottomY)
{
If (XPos < BottomDialogueLoc)
{
Send {DOWN down}
Sleep HoldInterval
Send {DOWN up}
}
}
If (XPos = EdgeLeftX)
{
Send {LEFT down}
Sleep HoldInterval
Send {LEFT up}
}
If (XPos = EdgeRightX)
{
Send {RIGHT down}
Sleep HoldInterval
Send {RIGHT up}
}
}
return
#IfWinActive, Steel Beasts Pro PE
WheelDown::
Send -
Return
WheelUp::
Send {+}
Return
MarkShot
12-03-2009, 05:27 PM
Did anyone try this with the script I made available above?
Interest seems pretty underwhelming.
If no one is interested, then I think I will skip the trouble of releasing an EXE only version with map zoom+scroll which dynamically handles any resolution and provides 1/2 screen landing zones on the top and bottom to avoid interference with other elements (menu/units) if the horizontal resolution is 1024 or better.
Please advise if you are interested. Thanks.
GH_Lieste
12-03-2009, 05:55 PM
I would be interested, but my mouse scroll wheel is INOP. The axle has sheared off and I only have the 'middle button click' functionality on it. So cannot test the zoom.
I might get around to trying to glue the bits of axle back together, but as the rest of the mouse is fine I doubt I'll be replacing it very soon if that doesn't work.
Ssnake
12-03-2009, 09:40 PM
I'm highly interested, but currently traveling. :redface:
Mogwa
12-03-2009, 10:01 PM
It would appear we can scratch one item off "the list". Perhaps after the release of your .exe, you can put out a playable T-72 or something...
Mog
MarkShot
12-03-2009, 10:38 PM
Nils,
In honor of your interest I have added "mouse landing zones". This should be the final version.
(see email for where to download for testing)
Piotre
12-03-2009, 10:50 PM
Mark,
the wheel zoom works nicely as I had previously reported ;).
However, the scroll feature only works up and to the left on my system, i.e. works when the mouse reaches the top of the screen or the left side of the screen, but it doesn't seem to work right and down.
This happens both in map view and in observer view (F8).
I'm running the sim full screen at 1680x1050 under Vista X64, using the script version of your post #8.
MarkShot
12-03-2009, 10:52 PM
PM me an email address. You can try the latest compiled version and see if you have any better luck.
MarkShot
12-03-2009, 11:00 PM
My initial guess would be that there is something different about how Vista 64 is reporting the screen resolution and/or the mouse position.
Top and left are both being tested against zero. Bottom and right are being tested against 1049 and 1679 respectively.
You can display a variable while running the script by adding the following line:
Msgbox %VariableName%
Perhaps this might help you to figure out why the screen bounds testing is not working.
MarkShot
12-03-2009, 11:04 PM
Forget it. I see your problem. (script in post #8)
If you didn't edit your resolution from my script, it was hard coded to work for me at 1600x1200.
PM me and you'll get the dynamic resolution EXE. Much more adaptible; you can even change res in the middle of playing and it continues to work.
Piotre
12-03-2009, 11:16 PM
My bad, I hadn't noticed the resolution part.
I've manually changed it in your script and now works nicely left and right, down 90% of the time and top is a hit and miss affair, sometimes needing 4/5 tries to make it budge.
PM sent and I'll report back.
MarkShot
12-04-2009, 12:07 AM
Well, see your email. I added the autocad support for your own private custom version. :)
That's enough of this for today. Take care.
Piotre
12-04-2009, 08:23 PM
Mark,
I was finally able to test both the EXE and the scripted, custom made version ;).
They both seem to work fine. I haven't been able to test your utility in the heat of the battle as I'm currently going through the tutorials, but I've experienced no adverse collateral effects so far.
The erratic behavior I was reporting was due to the safety dead zones you have setup to guard against accidental activation of the scroll feature while accessing the game menus. This only became clear after you sent the readme in the mail.
Well done with your scripting, this is a nifty little utility and I'll be definitely be using it.
Tacbat
12-06-2009, 05:38 AM
Thanks MS, works great.
Would it be at all possible to use the cursor location as the "zoom in point". Instead of having to center the screen where you want to zoom in? It would be useful to have the screen zoom in where ever the mouse cursor happens to be on the map screen.
I don't think there's a key command to do that, but you'll see an option in a drop down menu when you right-click on the map with the mouse to "Center View".
MarkShot
12-06-2009, 03:17 PM
Tacbat,
Nice concept, but you have to remember that this is a utility that stands alongside SBPPE and not a change to SBPPE itself.
So, I am able to know from the window name that the mouse actions are happening within SBPPE. However, I am unable to know whether SBPPE is displaying the map or something else. Thus, any coding I do for the map is active throughout the entire game. Sending right clicks blindly into the game is going to cause all types off problems.
This would have been doable if there was a keystroke combination which centers the map and was not overload with any other functionality in the game.
Sorry.
---
Glad you like it. Most likely you have the final build. I am waiting for a little more feedback and then I guess I will upload it the site.
Thanks again for your help.
Ssnake
12-06-2009, 11:18 PM
...so, if there was an option to set a hotkey to center the map at the current mouse position, you could do it?
MarkShot
12-06-2009, 11:34 PM
Yep. Assuming it was ALT-C. Then instead of sending only "+" to the window, I would send "ALT-C" + "+". This would cause the map to center and zoom in.
In fact, it would make it possible for the user to just rock the mouse wheel back and forth, if they only wanted to center the map.
So, Nils, did you get to try the EXE yet?
I've already written a number of AutoHotKey (www.autohotkey.com) scripts for various games. A most excellent free utility.
Ssnake
12-07-2009, 02:44 AM
So, Nils, did you get to try the EXE yet?
Actually, no. I will have to install Windows 7 on my computer to get rid of the release candidate, and since there is no upgrade path to it I need to backup my data first, so I'll be kept busy for the next days... :-|
Froggy
12-07-2009, 02:20 PM
it only take me 3 hours to get from RC1 to ultimate, with data transfert option (120mn to save 86Go)
Tacbat
12-07-2009, 04:34 PM
This would have been doable if there was a keystroke combination which centers the map and was not overload with any other functionality in the game.
Sorry.
---
Glad you like it. Most likely you have the final build. I am waiting for a little more feedback and then I guess I will upload it the site.
Thanks again for your help.
NP, thanks for the explanation.
I would very much encourage you to upload the current version, and a version without the auto-scrolling feature ASAP, as I'm sure others will find this immediately beneficial.
MarkShot
12-08-2009, 12:06 AM
Done.
Tango29
12-18-2009, 08:04 PM
Hi, MS,
I've found the download, but I'm at a bit of a loss as to where to download it to, and then how to activate it. Sorry to be a bother: "Hi-tech" to me is carbon paper and a Gestetner machine! Would you mind cluing me in to the ways and means of setting this up? TIA for any help!
MarkShot
12-18-2009, 08:08 PM
Unzip and see the readme.
Simply run the EXE while playing. It does not need to be placed in any specific location. It interacts with SBPPE at the process (meaning execution) level and not at the file level.
I hope that helps.
Tango29
12-18-2009, 11:48 PM
Thx, MS,
I'll sort it out! :smile:
Tango29
12-19-2009, 12:25 AM
By Gar, I got it, and it works like a charm: just in time for tonight's TGIF.
Thanks, MS! :clap: :drink: :clap:
john.gear
12-19-2009, 01:32 AM
Thank you. I am in the same boat being technically challenged. This will help.
Legitz
01-03-2010, 07:14 PM
Autohotkey. One of the best utilities ever made.
If you have a 5-button mouse, Autohotkey allows you to assign hotkeys to the 2 extra buttons that most programs don't use!
Also, you can program the the xtra buttons as *Shift* keys when used w/a combination of another mouse button, thereby doubling (or even tripling) the normal mouse functions of left/right click, middle click, and wheel up/down.
For a simple example, if you hold down the mouse's "page back" key while left-clicking, you can fire the main gun:
XButton1 & LButton::
Send {Space}
Return
Or . . . just use your imagination! I love this little program.
JanTog
01-07-2010, 03:35 AM
Great Thanks MarkShot , just make a run of it and it's GREAT
vBulletin® v3.7.2, Copyright ©2000-2010, Jelsoft Enterprises Ltd.