Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 183 184 [185]

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

tnuhnivad

  • Bay Watcher
  • <dorf> has been possessed!
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #2760 on: May 20, 2024, 06:30:26 am »


The black screen bug on the main map with TWBT when exiting some menus such as Status (z) or Stockpile settings (s) seems to have been around for years, especially when calculation FPS dips down to or below graphics FPS.

This is the autohotkey script I use to deal with it. It basically sends "F12" a short time after you press ESC (1/10 of a sec), which forces a redraw of the main window just after the game exits the menu.

;---begin code---

#UseHook
#MaxHotkeysPerInterval 200

~Esc::
sleep, 100
Send {F12}
return

;---end code---

Has anyone found an updated way to handle this? This solution works but I'd rather not have to use a 3rd party program. I love my multi lvl ASCII 47.05 but this black screen issue is driving me nuts. Doesn't happn with TWBT_Legacy but, that cause some other issues for me.

Copy the script lethosor wrote above into a lua file, I called it install-twbt-refresh.lua
Save to hack\scripts\install-twbt-refresh.lua
Open dfhack-config\init\onMapLoad.init
Add one line at the bottom
Code: [Select]
install-twbt-refresh
exit & save

Thank you! I will definitely give this a try!
Logged

tnuhnivad

  • Bay Watcher
  • <dorf> has been possessed!
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #2761 on: May 23, 2024, 07:25:03 am »

From what I remember, GFPS actually can't drop below FPS, due to how they are synchronized (although the number displayed in the FPS counter is calculated differently and smoothed, so you might sometimes see cases where GFPS is 1 above FPS, for instance).

Anyway, it's good to know that low FPS could be a cause of this. I think a more robust fix would be to detect viewscreen changes with an onStateChange event handler (watching for SC_VIEWSCREEN_CHANGED), because it wouldn't require changing keybindings or using external utilities. Something like this might work, if I'm understanding the issue correctly (it assumes the issue occurs when switching back to the fortress mode screen):
Code: [Select]
dfhack.onStateChange.twbt_rerender = function(event)
    if event == SC_VIEWSCREEN_CHANGED and df.viewscreen_dwarfmodest:is_instance(dfhack.gui.getCurViewscreen()) then
        dfhack.timeout(5, 'frames', function()
            dfhack.screen.zoom(df.zoom_commands.zoom_resetgrid)
        end)
    end
end
Copy the script lethosor wrote above into a lua file, I called it install-twbt-refresh.lua
Save to hack\scripts\install-twbt-refresh.lua
Open dfhack-config\init\onMapLoad.init
Add one line at the bottom
Code: [Select]
install-twbt-refresh
exit & save

Thank you so much, blitz4, for the explanation on implementing the code into a .lua! My apologies, sometimes the code talk goes right over my dome piece. I didn't realize that is what I needed to do with the code provided by lethosor. I actually decreased the frame delay to 1 frame and it feels perfect. This solved the black screening while using TWBT multi lvl view and returning to the world overview which drove me absolutely mad for the longest time!
« Last Edit: May 23, 2024, 07:30:41 am by tnuhnivad »
Logged
Pages: 1 ... 183 184 [185]