How to implement map mouse scrolling

Adanac's Strategic level World War I grand campaign game designed by Frank Hunter

Moderator: SeanD

Post Reply
MarkShot
Posts: 7327
Joined: Sat Mar 29, 2003 6:04 am

How to implement map mouse scrolling

Post by MarkShot »

This is just a sample of code which can be used at 1080p. Works great for me.

You would need AHK (auto hot key) which is an open source scripting language. It will run directly or can be compiled and run as an EXE.

How does it work. The game will open to screen position 0,0. It takes the full screen scrolling sense areas and creates larger windowed landing zones so that scrolling is triggered. In order, to stop the scrolling and free your mouse, you must cause the game to lose focus. (You hit the WIN key or ALT-TAB, whatever ...)

This was developed and tested under WIN10 64 using a many year old 32 bit version of AHK (mainly I have lots scripts and don't want to deal with migration issues). Enjoy! (sorry no option to use a monospace font below)

#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.
#SingleInstance force
#Persistent
#NoTrayIcon
SetTitleMatchMode 3

Game01 = The Guns of August

TimerInterval = 1

SetTitleMatchMode 1
CoordMode, Mouse, Screen

Sleep, 15000
SetTimer, ScriptDone, %TimerInterval%
SetTimer, WatchCursor, %TimerInterval%
return

ScriptDone:

IfWinNotExist,%Game01%,
ExitApp

Return

WatchCursor:

CoordMode, Mouse, Screen,

IfWinActive, %Game01%
{
SysGet, Screen, Monitor,
MouseGetPos, XPOS, YPOS
If (YPOS < 13)
{
MouseMove, %XPOS%, 13
}
If (YPOS > 943) AND (YPOS < 1025)
{
MouseMove, %XPOS%, 943
}
If (XPOS < 9)
{
MouseMove, 9, %YPOS%
}
If (XPOS > 1894)
{
MouseMove, 1894, %YPOS%
}
}
return

#IfWinActive, The Guns of August,

; PrintScreen Alternate (Snagit)
PrintScreen::!b
2021 - Resigned in writing as a 20+ year Matrix Beta and never looked back ...
MarkShot
Posts: 7327
Joined: Sat Mar 29, 2003 6:04 am

Re: How to implement map mouse scrolling

Post by MarkShot »

I developed this under WIN10, but I found that setting compatibility to XP SP3 game much quicker scrolling. I have not idea why.
2021 - Resigned in writing as a 20+ year Matrix Beta and never looked back ...
Post Reply

Return to “Guns of August 1914 - 1918”