It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
I'm surprised I don't see autohotkey mentioned more in the GOG forums; it's a great tool for converting the archaic control schemes in these old games into something more familiar.

Anyway, I wrote a script to allow you to toggle mouselook on and off in Realms of the Haunting, instead of having to hold down the left and right mouse buttons all the time. I'm posting it here in case anyone else finds it useful.

You'll need to download and install autohotkey from [url=]http://www.autohotkey.com[/url]. Then create a text file named roth_keys.ahk and paste the following text into it:

w::Up
s::Down
a::,
d::.

LShift::
SetKeyDelay -1
Send {Blind}{LButton Down}
Send {Blind}{RButton Down}
return

MButton::
SetKeyDelay -1
Send {Blind}{LButton Up}
Send {Blind}{RButton Up}
return

^k::Suspend


When this script is running, pressing the left shift key will toggle mouselook on and then pressing the middle mouse button will toggle mouselook off. Please note, just like in the vanilla game, you can't enter mouselook mode while the cursor is over an interactive object. This script will also change the movement keys to standard WASD. Pressing Ctrl+K will temporarily suspend the script, for example when you want to type in a save game filename.

Obviously, use your own judgment as to whether autohotkey is a safe program to install, but I've had nothing but good experiences with it. (I use it for any and every game that doesn't allow me to remap keys, but it's especially useful for old games with unusual controls schemes like ROTH.)
Thank-you for this!

I just finished playing through the entirety of the game WITHOUT this, but it certainly won't hurt next time I pick the game up. At any rate, I'll pass it along to my little brother. He's going to love me for this!

Thanks again.

EDIT: Now if only I could find a script for Elder Scrolls: Daggerfall, to give it a more modern control scheme... any ideas where I should start looking?
Post edited April 11, 2011 by Mahglazzies
This script is excellent, but there is one problem; A is also the jump key, so whenever you strafe left, you jump as well. Adding Space::a to the script didn't help.

Is there a way to unbind A from jump?
Looking briefly at the documentation, I'm a little surprised that the 'a' key continues to send ROTH an 'a' code with this program in effect, but failing that there are some other options:

1) You can use the US binary ( http://www.gog.com/en/forum/realms_of_the_haunting/patch_to_allow_changing_keybindings ), and redefine the jump key.

2) You can use DOSBox to unbind the 'a' key entirely ( http://www.gog.com/en/forum/realms_of_the_haunting/tips_for_beginners ).
Post edited April 18, 2011 by Shadowcat
(edit 3: This (my) config has a bunch of issues, so feel free to test and improve, but expect problems. I welcome any solutions!)


Thanks for this post, Beckett.

I've been looking into AutoHotKey today, and looking to make this approach even better. My present version seems to work decently well*, but I'm sure there are plenty more tweaks and improvements which could be made, so do speak up if you have better ways of doing things.

* Admittedly I've not actually played the game much like this, so I might have missed some things. (edit: Ha. Like combat. I was in a combat-free zone when I put this together!)

I'm using the middle mouse button as a toggle, rather than having separate keys to switch mouse look on and off. (I think I may actually switch this to the 'q' key, but that's a trivial change.)

(edit2: Ah... perhaps it was the context-sensitive nature of the mouse buttons which led you to implement this with separate buttons? I realise now it is easy to switch into the wrong state when you are pointing at something 'interesting' in the game.)


I copied AutoHotKey.exe into my ROTH game directory. If you used the installer and it's in your execution path, maybe you don't need to do that?

I'm using a batch file to launch AutoHotKey, run ROTH, and then kill the AHK script after ROTH exits, as I couldn't find a way of doing this successfully within the AHK script itself.

The line which runs DOSBox is simply the 'target' property of the shortcut which would usually start ROTH, so substitute your own for that.

My roth.bat looks like this:

@echo off
start AutoHotKey.exe roth.ahk
"E:\Program Files\DOSBox-0.74\DOSBox.exe" -conf dosboxROTH.conf -noconsole -c "exit"
AutoHotKey.exe roth.ahk Die


And my associated roth.ahk script is as follows. You would almost certainly want to change some of the keys, as I know my preferred layout is atypical (S,A,D,ALT rather than W,A,S,D, and I'm then using W as a Use key).



#SingleInstance, Force
#NoEnv

; Let the batch file kill this script after the game exits.
Command = %1%
if (Command == "Die") {
DisableMouseLook()
ExitApp
}

; Remap the keys
s::Up ; forward
Alt::Down ; backwards
a::, ; left
d::. ; right
z::Left ; turn left
c::Right ; turn right
Space::a ; jump
Shift::z ; duck
w::Enter ; use inventory item
Ctrl::` ; toggle run
[::c ; gamma up
]::v ; gamma down
e::Ctrl

MButton::
; Toggle mouse look
SetKeyDelay -1
ToggleMouseLook()
return

; *$LButton::
; ; Fire weapon
; SetKeyDelay -1
; if (mouse_look) {
; Send Ctrl ; actually causes gamma up?! :/
; }
; else {
; Send {LButton}
; }
; return

Tab::
; Inventory
DisableMouseLook()
Send i
return

ToggleMouseLook() {
global mouse_look
if mouse_look {
DisableMouseLook()
}
else {
EnableMouseLook()
}
}

EnableMouseLook() {
global mouse_look
if not mouse_look {
Send {Blind}{LButton Down}
Send {Blind}{RButton Down}
mouse_look := true
}
}

DisableMouseLook() {
global mouse_look
if mouse_look {
Send {Blind}{LButton Up}
Send {Blind}{RButton Up}
mouse_look := false
}
}
Post edited April 18, 2011 by Shadowcat
You're right, I forgot about the jump key. I think adding space::a should definitely work, except I think the spacebar may be in use by the game as well, in which case you'll want to remap it as well. (Please note that you need to restart the script after saving a change to it - right click on the icon in the taskbar and choose "Reload this script".)

Shadowcat, thanks for posting that. I couldn't figure out to toggle the mode with a single key; your method of using a boolean variable works great. (I see from the lines you have commented out that you also experimented with trying to get the left mouse button to work for firing guns while in mouselook mode. I tried that too and finally gave up. Unfortunately, I think it might be impossible; it can't detect a new mouse-button-down event because it is already treating the mouse button as 'down' the whole time mouselook mode is active.)
Hmm... that's a good theory, but I'm not sure it's accurate. I would expect that we could circumvent it by wrapping the 'Send Ctrl' with a 'Disable/EnableMouseLook()' pair (which should all happen fast enough to not be a bother to the end-user). That didn't fix the problem for me, though.
Works great, but how do you adjust the speed while in mouselook? It's way too fast for me.

The in-game mouse speed setting only seems to affect the cursor in non-mouselook mode.
JDR13: I did attempt to address that using the mouse hook feature described in the following thread, but without much success -- I can affect the horizontal mouse control, but it does not at all work in the simple way described (or not in the game, at any rate), and I'm not sure what the correct calculations would look like.

http://www.autohotkey.com/forum/topic19376-15.html

However, after playing ROTH a bit more in this fashion, I have personally decided to abandon this control method. The biggest issue for me is simply that you lose the contextual cursor when you're in mouse-look, and consequently also lose the information about what you can interact with, and that knowledge is simply too important.

I originally thought the ability to easily switch between modes would mitigate this, but I've found I really do want this information available by default, rather than merely on demand.
avatar
JDR13: Works great, but how do you adjust the speed while in mouselook? It's way too fast for me.

The in-game mouse speed setting only seems to affect the cursor in non-mouselook mode.
I know this is an old post, but if you go into the install directory (GOG.com/Realms of the Haunting) there is a file called 'dosboxROTH.conf'. Open it and look for the line that says 'sensitivity=100', and change 100 to a lower number (25 works for me). Then in game, turn the sensitivity all the way up or else the cursor will be sluggish.
Post edited June 06, 2011 by MaxwellKraft
Hello, first of all, this thread is superb! thx for all the good work.

Can someone tell me how to autostart the roth.bat?

thx
First of all, thanks to op for telling me about this program!

Very simple script in case anyone just wants to use the same key to toggle mouselook on and off. :) (There might be a better way but this is what newbie me put together after an hour of research. :P)

#MaxThreadsPerHotkey 2

toggle=0

LShift::

if toggle := !toggle
{
SetKeyDelay -1
Send {Blind}{LButton Down}
Send {Blind}{RButton Down}
}
else
{
SetKeyDelay -1
Send {Blind}{LButton Up}
Send {Blind}{RButton Up}
}
return
Post edited June 08, 2015 by tfishell
avatar
tfishell: First of all, thanks to op for telling me about this program!

Very simple script in case anyone just wants to use the same key to toggle mouselook on and off. :) (There might be a better way but this is what newbie me put together after an hour of research. :P)

#MaxThreadsPerHotkey 2

toggle=0

LShift::

if toggle := !toggle
{
SetKeyDelay -1
Send {Blind}{LButton Down}
Send {Blind}{RButton Down}
}
else
{
SetKeyDelay -1
Send {Blind}{LButton Up}
Send {Blind}{RButton Up}
}
return
Thanks. This worked a treat. It'd be pure perfection if somebody could enable the in-game mouse cursor to appear and be activated with left click, as usual when not in mouse-look mode. Or even just having the left mouse button as the attack button. Heck, I'll even find a way to have a permanent crosshair and we're golden. LOVE ROTH! Thanks again :-)

But, thank you, This has made the game much more appealing to play.

On reflection I've been trying to devise three scripts. If anyone's still interested in optimising ROTH for a great experience let me know.

One script is above and works great.

The second script would use the left mouse button as shoot, and the right mouse button as reload. And the mouse wheel as toggle weapon.

The third script would draw on a crosshair so essentially with toggling mouselook, there'd be a cursor and the ability to fire and reload.

Then with using the US files to edit movement controls A can be strafe left and D can be strafe right. Thus when all three scripts are run together you basically have an awesome shooter. And It's ROTH, so, double awesome.

Please can someone come and steal all the glory, as I'm very new to all this.

So far I've used a crosshair successfully, it's drawn on, not an overlay image. But it disappears upon loading the game, and runs like a giant cross from top to bottom and side to side, not neat like a crosshair should be. If anyone fancies a challenge this would be awesome. Thanks. I'll get back to work...
Post edited October 10, 2017 by theoliger
avatar
theoliger: ...
Glad I could help. :) I haven't touched the game since 2015, I got stuck on a bug and gave up eventually.
Yet another improvement on Beckett's script. This one automatically toggles mouselook when you move forward and automatically disengages it when you need to interact with an object or fight. It also remaps the keys to ESDF, as that way you can look left without jumping.

Enjoy,

-- Marcio

-------------------

; Having AutoLookaround engage during combat could be lethal, so only
; engage it the specified number of miliseconds after last click.
DelayUntilAutoLookaround := 1000

; Internal state variables, do not use
Walking := 0
LastClickT := A_TickCount

#MaxHotkeysPerInterval 2000

; Only run script if we are in DOSBox
#IfWinActive DOSBox

; Since A is mapped to jump, we use ESDF instead of WASD:
; e: Move forward
; s: Turn left
; d: Move backwards
; f: Turn right
; w: Step left
; r: Step right
; SPACE: Jump
#InputLevel 1
e::Up
d::Down
s::Left
f::Right
w::,
r::.
Space::a

#InputLevel 0
Up::
if(!Walking && ((A_TickCount - LastClickT) > DelayUntilAutoLookaround)) {
SoundBeep 100, 100
Walking = 1
SetKeyDelay -1
Send {Blind}{LButton Down}{RButton Down}
}
return

LButton::
if(Walking) {
SoundBeep 100, 100
Walking = 0
SetKeyDelay -1
Send {Blind}{LButton Up}{RButton Up}
}
Send {Blind}{LButton Down}
LastClickT := A_TickCount
return

RButton::
if(Walking) {
SoundBeep 100, 100
Walking = 0
SetKeyDelay -1
Send {Blind}{LButton Up}{RButton Up}
}
Send {Blind}{RButton Down}
LastClickT := A_TickCount
return

^k::Suspend