Jump to content

Hot Tip: Make your mouse wheel zoom in the map!


MarkShot

Recommended Posts

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!

Edited by MarkShot
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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".

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • Members
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... :-|

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...