Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 63 64 [65] 66 67 ... 185

Author Topic: Text Will Be Text - dfhack plugin  (Read 801628 times)

lethosor

  • Bay Watcher
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #960 on: September 14, 2014, 10:36:24 am »

Support for additional keys in keybindings should be manageable. Any suggestions? (Special characters, like '[' and '{', would be more of a challenge, but the mousewheel and F10-F12 should be simple enough.)
Edit: The mousewheel appears to use SDL_MouseButtonEvent, which makes combinations with modifier keys difficult to handle.
« Last Edit: September 14, 2014, 12:02:25 pm by lethosor »
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

0x517A5D

  • Bay Watcher
  • Hex Editor‬‬
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #961 on: September 14, 2014, 12:11:52 pm »

Support for additional keys in keybindings should be manageable. Any suggestions? (Special characters, like '[' and '{', would be more of a challenge, but the mousewheel and F10-F12 should be simple enough.)

The number keys, please!  (The main row, not the keypad.)  It's low-hanging fruit, and I've wanted them for a long time.

Right now I'm looking at library/Core.cpp:parseKeySpec(), and it's very limited as to what it parses.  And I'm thinking, how does DF itself translate the interface.txt file into actual keybindings?  Somewhere, something's parsing [SYM:4:Equals] into Key=61, Mod=KMOD_ALT, can it be hijacked?

I'm also wondering if there should just be a way to stuff in the raw SDL::Key and modifiers, as found in SDL_keysym.h.  So if a C++ coder wanted to trap, say, Ctrl-Alt-F15, she could just include that header file and use the symbolic name K_F15 with KMOD_CTRL|KMOD_ALT.

Edit:
Edit: The mousewheel appears to use SDL_MouseButtonEvent, which makes combinations with modifier keys difficult to handle.

I just tried it with DF's interface.txt.  I changed [BUTTON:0:4] and [BUTTON:0:5] to [BUTTON:2:4] and [BUTTON:2:5].  It worked; mousewheel no longer zooms but ctrl-mousewheel does. W00t, no more accidental zooming!
« Last Edit: September 14, 2014, 12:18:11 pm by 0x517A5D »
Logged

LeoCean

  • Bay Watcher
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #962 on: September 14, 2014, 12:15:43 pm »

Does anyone know what tile the cast uses? I can't find it, I'll try to look for it but if anyone knows before I find out that'd be helpful. You don't need to supply the tile # a screeshot or description is enough. Same with cheese :D

http://www.bay12forums.com/smf/index.php?topic=129219.msg5659262#msg5659262 New overrides.

Bug

#Alt 71 or 73 in tileset :88]
[OVERRIDE:88:T:ConstructedStairUD:3:88]

Is ok to write but,

[OVERRIDE:88:T:ConstructedStairUD:3:88]  #(:88] Alt 71 or 73 in tileset) or #Alt 71 or 73 in tileset :88]

Causes a error (i.e it doesn't find tileset 88), this only happens on tile overrides and not building (B) or item (I) overrides. I was testing this on version 40.10 though so maybe it was fixed I don't think it would have been though. version 4.49 probably.
« Last Edit: September 14, 2014, 01:15:57 pm by LeoCean »
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #963 on: September 14, 2014, 12:41:28 pm »

Edit: The mousewheel appears to use SDL_MouseButtonEvent, which makes combinations with modifier keys difficult to handle.

I just tried it with DF's interface.txt.  I changed [BUTTON:0:4] and [BUTTON:0:5] to [BUTTON:2:4] and [BUTTON:2:5].  It worked; mousewheel no longer zooms but ctrl-mousewheel does. W00t, no more accidental zooming!
It's easy to bind to mouse events with modifiers in DF, but DFHack's "keybinding" command only handles SDL::KeyboardEvents, and allowing a combination of mouse and keyboard events would require rewriting a significant portion of it.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Grumalg

  • Bay Watcher
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #964 on: September 14, 2014, 01:19:52 pm »

Support for additional keys in keybindings should be manageable. Any suggestions? (Special characters, like '[' and '{', would be more of a challenge, but the mousewheel and F10-F12 should be simple enough.)
Edit: The mousewheel appears to use SDL_MouseButtonEvent, which makes combinations with modifier keys difficult to handle.

Given the dicussion of international keyboard layouts earlier, it's pretty clear it won't be easy to satisfy everyone.

Unfortunately, for US style keyboards it's precisely the [/{ and ]/} keys that are one of the best pairs for a second zoom up/down pair that TwbT needs with minimal finger reaching and DF doesn't use them for anything.  Non-US keyboard styles will want something else.

Since such a zoom is frequently used and one may be almost anywhere in DF when you want to use it, it's hard to find *any* alpha keys that won't conflict somewhere. 

Function keys require an extra reach which isn't what you want for such a frequently used operation, though they are good for less frequently used actions - especially with modifier keys so they don't conflict with DF Hotkey locations.

I guess the best answer is 'everything you can support reasonably'.  No one would complain about being able to use *every* key, but will settle for as much as you can give. 

As many punctuation and 'special' keys as possible.  All the shifted numeric row symbols.  It's likely that even stuff like 'insert', 'delete', 'home', 'end', 'page up', and 'page down' may be useful to plugin writers and people wanting to bind command lines to keys as well - as they avoid alpha key conflicts.

It may also be useful to be able to tell DFHack to eat a bound keystroke and not send it on to DF after acting on it.  Something like a flag/parameter that says eat this keystroke after you recognize it on the keybind command line setting up a bind. 

This would allow people to say "I never use '.' One-Step or ';' Movies or '?' Help - if I bind them with key eating they won't also be sent to DF for action and I get a free extra key".  I say this because of noting the useing shift-P and shift-O for map resize bindings as was suggested earlier in this thread both pulls a lever *and* resizes the map.

The mousewheel poses interesting problems because you'd like to be able to distinguish mousewheel and mousewheel+modifier key just like click and click+modifier key are useful when seperately sensed.  If this can be handled, mousewheel+modifier key(s) might become useful to plugin writers for scrolling long lists for example.

Since DF uses mousewheel for zoom by default, I still think a very intuitive mousewheel use with TwbT would be for mousewheel to zoom the map and mousewheel+Ctrl would zoom the text.  I map zoom a* lot* more frequently than I text zoom with TwbT, so normal mousewheel is a better fit to map zooming than text zooming. 

This would require some coordination between DFHack and TwbT though as you'd need to be able to suppress normal mouse wheel operation from getting to DF after it was used to TwbT map zoom and recognize mousewheel+Ctrl must be stripped of the Ctrl modifier before being sent to DF as a normal mousewheel action.

I'm an old fart, and I haven't been coding for a living for a bit over a decade.  So I haven't dug into DFHack code as I never expect to be writing for it.  So my comments are based on ergonomics and ease of use rather than knowing what's reasonably expectable to be possible.

Logged

Grumalg

  • Bay Watcher
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #965 on: September 14, 2014, 01:47:42 pm »

I spent a fair amount of time composing that last post, so I hadn't seen the other new stuff before I posted it.

I just tried it with DF's interface.txt.  I changed [BUTTON:0:4] and [BUTTON:0:5] to [BUTTON:2:4] and [BUTTON:2:5].  It worked; mousewheel no longer zooms but ctrl-mousewheel does. W00t, no more accidental zooming!

Sounds like the Ctrl-mousewheel side is solved  :)

Logged

Freak2121

  • Bay Watcher
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #966 on: September 14, 2014, 04:44:32 pm »

It works very well in Adventure Mode, except for one small problem. When jumping/falling/etc, the screen turns black. I don't know if it's known or not but no harm done with just mentioning it. It kinda turns jumping into a guessing game.
Logged

mifki

  • Bay Watcher
  • works secretly...
    • View Profile
    • mifki
Re: Text Will Be Text - dfhack plugin
« Reply #967 on: September 14, 2014, 04:56:07 pm »

I'll probably try to add support for binding mouse events into dfhack then.

Freak2121, thanks for the report, I'll take a look.

kr0pper

  • Bay Watcher
  • Coding is fun!
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #968 on: September 16, 2014, 12:30:28 pm »

I'll probably try to add support for binding mouse events into dfhack then.

It's a good idea, I try to make navigation through main menu with mouse, but only way is external remapping utilities like autohotkey.
Logged

0x517A5D

  • Bay Watcher
  • Hex Editor‬‬
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #969 on: September 16, 2014, 01:42:26 pm »

It works very well in Adventure Mode, except for one small problem. When jumping/falling/etc, the screen turns black. I don't know if it's known or not but no harm done with just mentioning it. It kinda turns jumping into a guessing game.

Oh, that reminds me.  I've had some wonky behavior from the guide-path script, and it just occurred to me that it might be due to TWBT.  A bit of testing, and it looks happens when using TWBT-nextgen.

The bad behavior involves screen painting when the script jumps to a minecart stop.  Often the fortress viewscreen turns nearly all black, displaying just a few symbols related to the minecart stop and route.  Sometimes the viewscreen doesn't properly refresh after the jump to the new viewpoint, it just keeps showing the old invalid data with (again) a few symbols related to the stop and route.  The viewscreen corruption persists even after other viewscreens are invoked (e.g. the 'z' Fortress Status screen).

Reproduction in Windows, DF 0.40.11, DFHack 0.40.11-r1, TWBT 3.41 and TWBT-nextgen 4.61:
  • if necessary, delete the TWBT plugin.  start the game, load a fort.
  • use the Wiki's directions to set up a minecart hauling route that has a Z-level change.  (You don't even need track to do that.) 
  • change the viewed Z-level away from both stops.
  • press h to call up the hauling menu
  • select the first stop of that route and press Enter to work on its settings.
  • press Alt-P to invoke the gui/guide-path script. 
      (If that doesn't work, you don't have the keybinding, so invoke it manually by going to the DFHack console window and type in 'gui/guide-path' and press Enter.
  • press c to change the view to the current stop; press n to change the view to the next stop.  Experiment with these until you understand what normal behavior looks like.  Save your fort and quit the game
  • install TWBT 3.41, reload the fort, and do steps 3 through 7 again.
  • note that behavior has not changed, it is still correct.
  • delete the TWBT plugin, install TWBT nextgen 4.61, reload, and do steps 3 through 7 again.
  • This is the important part: note the screen corruption that occurs when c and n are pressed, and may occur when the Alt-P is pressed.
  • Also note that screen corruption can also persist when you Esc, Esc, Esc all the way out to the main DF menu.

Oh, this was without tweaking the multilevel setting; it was set at default.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #970 on: September 16, 2014, 02:03:22 pm »

Does resetting the zoom (F10 by default) change anything?
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

0x517A5D

  • Bay Watcher
  • Hex Editor‬‬
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #971 on: September 16, 2014, 02:33:31 pm »

Does resetting the zoom (F10 by default) change anything?

Good thought.  Testing... no, it shows the same behavior.  Also if I switch to/from fullscreen, it still has the same behavior.
Logged

LeoCean

  • Bay Watcher
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #972 on: September 16, 2014, 02:52:38 pm »

Screen shots would be handy. http://en.directupload.net/ is a good site you don't need to sign up to, to host images.
Logged

mifki

  • Bay Watcher
  • works secretly...
    • View Profile
    • mifki
Re: Text Will Be Text - dfhack plugin
« Reply #973 on: September 16, 2014, 06:03:59 pm »

I know what happens.
Plugins that draw something in the map need to be updated to be compatible with twbt, that's easy to do for actual plugins but for Lua scripts... I need to think.

LeoCean

  • Bay Watcher
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #974 on: September 16, 2014, 07:34:47 pm »

I don't see why the next gen can't use the graphics set instead of the text set like the old gen, only the people who are playing acii will ever want to see the text on the map/ embark map.

Here's a sort of map legend for the map tiles.

http://dwarffortresswiki.org/index.php/v0.34:Map_legend
http://dwarffortresswiki.org/index.php/DF2014:Map_legend

So when it becomes available to create a map tileset it shouldn't be that hard for people to whip one up, at least a rough draft.
« Last Edit: September 16, 2014, 09:25:06 pm by LeoCean »
Logged
Pages: 1 ... 63 64 [65] 66 67 ... 185