Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2 3 ... 7

Author Topic: Mouse plugin, now with live "Look on hover" mode + more point & click support  (Read 46864 times)

falconne

  • Bay Watcher
    • View Profile

Download (Windows, Linux and OS X)
Link contains download archive with all my plugins.
Only works on the latest DFHack r3 (see the dfhack thread). Follow the instructions in the included readme for installation. The relevant file for just this plugin is mousequery.plug.*

Mouse Plugin
I've made several improvements to my mouse plugin that should hopefully make it more useful. This plugin didn't use to have its own thread, but I felt it has enough functionality now to warrant one. Please see the subsequent sections for new functionality.

Smart Query
Left clicking on items, creatures, buildings, etc will make the game open the appropriate query menu for it, in a somewhat context sensitive fashion. For example clicking a workshop will open the building (q)uery menu with the cursor placed on the workshop (it simulates you pressing "q" then moving the cursor to the workshop). Clicking on a dwarf or creature will open the (v)iew menu with the cursor placed on the unit. Clicking an item or empty floor will open the loo(k) menu on that item.

Clicking on one location multiple times will cycle through the 4 "query" menus that DF uses: (q)uery building, (v)iew units, loo(k), view i(t)ems, with the cursor placed at that location.

Right mouse button cancels the query mode.

Live View
If you have the menu panel open, then hovering your mouse over a tile will display a list, telling you what's on that tile. It's similar to what you would see if your were to loo(k) at that tile. The following screenshot is an example of what happens when I hover over the seed bag circled in yellow:



Point & Click Support
If you left click on a tile while the ingame cursor is active, this will simulate moving the cursor to that location and pressing Enter. Furthermore, when in the material selection menu for building, left licking simulates pressing Shift-Enter (see below for how you can make the mouse wheel scroll this menu). This should allow you to do more actions with the mouse, such as clicking two corners to designate.

If you use my automaterial (Construction Helper) plugin, then you can enable box mode for construction placement, which will let you use this plugin to designate walls, floors etc by simply clicking the two corners. Using "auto type select" and "auto material select" will make construction placement with the mouse even faster. There are a couple of bugfixes to automaterial included in this updated to help it work together with this plugin, so please update automaterial.plug.* as well.

If you use my Building Plan plugin, then you can turn on planning mode for furniture, which will let you place buildings fairly quickly with the mouse.

Map Scrolling
Unfortunately it's not possible to allow clicking and dragging the map, because it doesn't look like dfhack can detect "mouse key up" events. I've made it so that in default mode if you right click towards the edge of the map that causes it to scroll in that direction. Note that if "cursor tracking" is enabled (see next section), the game will automatically cause the map to scroll when the cursor is enabled (because moving the ingame cursor to the edge of the map causes it to scroll anyway).

You can also enable "edge scrolling", where the map scrolls automatically if you move the mouse to the edge of the screen, which is probably more convenient once you get used to it. To enable this add the following to dfhack.init:
Code: [Select]
mousequery edge enable
When edge scrolling is enabled it also turns on "cursor tracking".

Cursor Tracking
By default moving the mouse while the ingame cursor is active doesn't move the cursor itself, you will just see a yellow X "ghost cursor" under the mouse. Left clicking a tile automatically moves the cursor there and sends an "ENTER" keypress. If you want the cursor to move with the mouse, add this command to your dfhack.init:
Code: [Select]
mousequery track enable
I don't have it turned on by default, because some people might not like the edge scrolling side effect this has: when the cursor is moved to about 5 tiles from the edge of the screen, the game automatically causes the map to scroll. On its own this could be annoying if using the mouse, because it can cause the map to zip across screen. I've reduced the effect of this by adding a short delay to cursor movement when the mouse is at the edges. This allows you to use the mouse when you want to edge scroll the cursor, but enough time to react and stop it when you move to the edge accidentally.

Extra Details
If you type "mousequery" into dfhack, you'll get the full commandline help for a couple more functions. You can now disable the right mouse button handling entirely if you want to use the plugin in conjunction with Mouse Fortress. You can also enable edge scrolling in default mode and adjust edge scroll delay.

Keybindings
Changing some Df keybindings will make using the mouse more convenient. I've remapped my scrollwheel to change z-levels instead of zooming, as well as enable it to scroll secondary menus, such as the material selection menu. With the support in this plugin for left clicking to pass a "select all" to the materials menu, using the scrollwheel to select items makes more sense.

You can change DF keybindings by escaping to the main menu, choose keybindings->General. Find the "Zoom in/out" entries and the "Move view/cursor up/down (z), aux" entries, then swap the keybindings of these. You can delete existing keybindings with backspace and add new ones. This will let you change z levels with the wheel and zoom with Ctrl+5/Shift+5.

Next find the "Move secondary selector up/down" entries and add additional keybindings to use the mouse wheel for these, leaving the existing +- bindings, so you can use both keys and wheel to scroll. It's ok to have two bindings for the wheel, because the two actions are used in different modes.
« Last Edit: June 04, 2013, 03:08:49 pm by falconne »
Logged
Utility plugins for DFHack, for improving Dwarf Fortress' user interface.

Aerval

  • Bay Watcher
    • View Profile

wtf...


I said it once and say it again: "My next firstborn dwarf will be named falconne"
Logged

Itnetlolor

  • Bay Watcher
    • View Profile
    • Steam ID

As usual, awesome stuff.

PeridexisErrant

  • Bay Watcher
  • Dai stihó, Hrasht.
    • View Profile

I tried using this with mouse fortress, and it was both amazing and kinda clashy (as expected) - mostly just awesome.  The clashy bit is just minor jitter when the mouse stops and two programs are moving the cursor - it settles in about half a second. 

Live view is kinda like dwarf monitor:  once you get used to having that overlay, you can never go back. 

How difficult would it be to show the potential area when digging / tree cutting / etc?  It seems like essentially the same function as the 'x' to show area in construction helper?  I've just been attempting to lay out some long tunnels, and I keep getting the width wrong  :-)

Editing the keybindings was also rather painful, but I assume that getting the same results without that would be rather more difficult - and luckily its a one-time thing. 

10/10, would  will use mouse again.
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist

I actually did remove mouse fortress from my utilities once mousequery came out. If this is even better, or can be combines, I would be happy to include both in the next update. :)
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

falconne

  • Bay Watcher
    • View Profile

I wouldn't say it's "combinable" at the moment, as PeridexisErrant said it would be kind of clashy.

I could add a "compatibility" mode you can enable in dfhack.init, where this plugin doesn't move the cursor in designation/build mode and doesn't handle right click, so it won't interfere with MF.

I'll also look at a "preview selection" box for designation mode, as suggested.
Logged
Utility plugins for DFHack, for improving Dwarf Fortress' user interface.

Graf Zeppelin

  • Escaped Lunatic
    • View Profile

Hello there. I am new to DF and use the lazy newb pack. So If I follow the instructions and copy the plugin into the folder I get an error message at launch in that DFhack screen which says cant load -name of plugin-

I would really love to play DF with some mouse usage and maybe someone can help me here.

Thanks in advance.
Logged

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist

LNP packs an outdated dfhack. You need to get dfhack r3
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Graf Zeppelin

  • Escaped Lunatic
    • View Profile

LNP packs an outdated dfhack. You need to get dfhack r3

That promptly solved my problem. thanks alot.

*grabs the pickaxe*

Ah thanks alot also to the maker of this amazing mod.
Logged

PeridexisErrant

  • Bay Watcher
  • Dai stihó, Hrasht.
    • View Profile

I actually uploaded  my expanded LNP pack recently because explaining to friends the setup required to play was a deterrent to picking it up.   It basically updates everything in the advanced lazy newb pack and includes a few extra utilities.   

Kinda clashy is still plenty usable and a net benefit;  I just noticed a little cursor jitter when moving and two behaviors when right clicking - it opens the mouse mouse fortress menu and then a second right click returns to the un paused game 

Regarding the combination, compatibility mode would be awesome a total waste of time - it's at least usable anyway.  To be honest, once this provides some kind of scroll method and cursor visibility mouse fortress will be obsolete, since those are now the only reason to use it and only just worth the jitter (mostly the scrolling so I can avoid using arrow keys). 


EDIT:  Having actually fiddled with it again, trying to work out a compatibility mode is going to be more trouble than it's worth - the clashes are really minor, and any energy going into improving the plugin would be better spent increasing functionality so that only one is necessary.  As above, the two that would do that for me are scrolling - either right-click-drag, or hover-near-edge - and the visible cursor which you're apparently already working on.  Brilliant. 

edited for link formatting
« Last Edit: May 08, 2013, 09:12:09 pm by PeridexisErrant »
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist

Is added to the newest masterwork update. No mouse fortress though, I had no time to test both together.
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

falconne

  • Bay Watcher
    • View Profile

I've just uploaded a new version adding a few extra functions. Unfortunately it's not possible to allow clicking and dragging the map, because it doesn't look like dfhack can detect "mouse key up" events. The best I could do for scrolling with the mouse in default mode is making it so that if you right click towards the edge of the map that causes it to scroll in that direction. The active area is about a third of the way from each edge. This isn't exactly a great way to scroll... what would be best is to keep using Mouse Fortress for "click and drag" to scroll and possibly try and add a "compatibility" mode to MF to deal with conflicts.

I've also added functionality to move the cursor with the mouse in build and designation mode. To enable it add the following command into your dfhack.init file:
Code: [Select]
mousequery track enable

I don't have it turned on by default, both because I don't want to add further incompatibility with MF but also because some people might not like the edge scrolling side effect this has: when the cursor is moved to about 5 tiles from the edge of the screen, the game automatically causes the map to scroll. This can be annoying when using the mouse, because it can cause the map to zip across screen. I've tried to reduce the effect of this by adding a short delay to cursor movement when the mouse is at the edges. This allows you to use the mouse when you want to edge scroll in build/designation mode, but enough time to react and stop it when you move to the edge accidentally.

Even with tracking disabled, you will now see a yellow "X" under the mouse, a sort of "ghost cursor", that tells you what tile will be affected if you left click.

If you type "mousequery" into dfhack, you'll get the full commandline help for a couple more functions. You can now disable the right mouse button handling entirely if you want to use the plugin in conjunction with Mouse Fortress. You can also adjust the edge scroll delay in build/designation modes.
Logged
Utility plugins for DFHack, for improving Dwarf Fortress' user interface.

PeridexisErrant

  • Bay Watcher
  • Dai stihó, Hrasht.
    • View Profile

I love it - edge scrolling is brilliant, and far more stable than for mouse fortress (where track delay also limits cursor movement speed).  Seeing the ghost cursor is also a nice touch. 

My last two wishlist items are: 
1) include in the help text the default and current tracking delay to make tweaking it less painful
2) an option to enable cursor movement (and thus edge scrolling) for all contexts with a cursor, not just b/d.  If I'm placing stockpiles, querying, looking, etc I've got a small laptop so edge scrolling is awesome. 

As always, I love all your plugins, but this one wins.  (1) is a truly minor quibble but I assume correspondingly easy to fix.  I now sometimes play without Mouse Fortress, and (2) above would be enough to delete it entirely - apart from the right-click menus which are more trouble than they're worth, this is the only feature advantage. 

Edit: build-mode scrolling appears not to work, though it's fine in designation mode.
Edit #2: does work if placing a specific building, but not generally.   Is this the intended behaviour?
« Last Edit: May 19, 2013, 08:27:38 am by PeridexisErrant »
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.

falconne

  • Bay Watcher
    • View Profile

My last two wishlist items are: 
1) include in the help text the default and current tracking delay to make tweaking it less painful
2) an option to enable cursor movement (and thus edge scrolling) for all contexts with a cursor, not just b/d.  If I'm placing stockpiles, querying, looking, etc I've got a small laptop so edge scrolling is awesome. 

Ok just uploaded a new version that. Now omitting the delay amount (i.e. the command "mousequery delay") will show the current delay.

Tracking is now also possible in query, look and view mode as suggested. You have to add this to dfhack.init:
Code: [Select]
mousequery track enable
« Last Edit: May 21, 2013, 04:45:13 am by falconne »
Logged
Utility plugins for DFHack, for improving Dwarf Fortress' user interface.

PeridexisErrant

  • Bay Watcher
  • Dai stihó, Hrasht.
    • View Profile

Beautiful.  Mouse fortress is now dead to me. 

2b) edge scrolling in all contexts with a cursor, such as building before choosing what to build, placing stockpiles, zones, burrows, etc. 

The aim is to never use the keyboard to move the cursor again (except when unpaused, because I assume that would be way more difficult to implement) - its getting closer, but not quite there yet. 

OTOH, mousequery is already the definitive best mouse utility there is.  :-)
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.
Pages: [1] 2 3 ... 7