diff --git a/NEWS b/NEWS index 04819a438..065c08aa8 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,8 @@ DFHack Future + New Scripts + hotkey-notes: print key, name, and jump position of hotkeys + Removed + needs_porting/* diff --git a/Readme.rst b/Readme.rst index 609a98dcd..5d2d86dee 100644 --- a/Readme.rst +++ b/Readme.rst @@ -2394,6 +2394,10 @@ is "hfs-pit 1 0 0", ie single-tile wide with no walls or stairs. First example is a four-across pit with stairs but no walls; second is a two-across pit with stairs but no walls. +hotkey-notes +============ +Lists the key, name, and jump position of your hotkeys. + lever ===== Allow manipulation of in-game levers from the dfhack console. diff --git a/scripts/hotkey-notes.lua b/scripts/hotkey-notes.lua index 30654911e..c8b9b9606 100644 --- a/scripts/hotkey-notes.lua +++ b/scripts/hotkey-notes.lua @@ -1,20 +1,12 @@ -- prints info on assigned hotkeys to the console --- A work in progress, hoping for some help! --- A different approach might be needed depending on internal structures, --- but this gets the idea across. - -local hotkeys = {'F1 ', 'F2 ', 'F3 ', 'F4 ', 'F5 ', 'F6 ', - 'F7 ', 'F8 ', 'F9 ', 'F10', 'F11', 'F12'} - -for i=1, #hotkeys do - local hk = hotkeys[i] - hk = {id=hk} - -- PLACEHOLDER PROPERTIES ONLY! - hk.name = '_name' - hk.x = df.global.window_x - hk.y = df.global.window_y - hk.z = df.global.window_z - - print(hk.id..' '..hk.name..' X= '..hk.x..', Y= '..hk.y..', Z= '..hk.z) -end \ No newline at end of file +local h_list = {'F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8', + 'Shift+F1', 'Shift+F2', 'Shift+F3', 'Shift+F4', + 'Shift+F5', 'Shift+F6', 'Shift+F7', 'Shift+F8'} + +for i=1, #df.global.ui.main.hotkeys do + local hk = df.global.ui.main.hotkeys[i-1] + if hk.cmd ~= -1 then + print(h_list[i]..': '..hk.name..': x='..hk.x..' y='..hk.y..' z='..hk.z) + end +end