Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Mod feasability : Quick groups on hotkey (STR Style)  (Read 325 times)

seelebrn

  • Escaped Lunatic
    • View Profile
Mod feasability : Quick groups on hotkey (STR Style)
« on: August 07, 2023, 02:05:49 pm »

Hello everyone !
I'd just like to ask a little thing.
During my discovery of DF, I was often bugged by the fact that I can't seem to "bookmark" a unit. I'm thinking of a system coming from STRs, where, for example, CTRL-1, 2, 3 and so on would bookmark a person and Alt-1, 2, 3 etc. would make the camera jump to the current position of that unit.
I was wondering :
1) If any existing mod has such a feature (looking through DFHack documentation and mods here makes me think it's not the case - but I might have overlooked someting)
2) If it does seem feasible as a new mod.

Of course, I'm more than willing to give it a try, but I'd like your opinions first, since I'm an amateur moddeur but that would be my first time with DF.

Thanks in advance !
Logged

0x517A5D

  • Bay Watcher
  • Hex Editor‬‬
    • View Profile
Re: Mod feasability : Quick groups on hotkey (STR Style)
« Reply #1 on: August 07, 2023, 06:14:09 pm »

It's just about in reach of a DFHack Lua script, yes.  It could be done as a script inside a mod or as a separate script added to dfhack-config/scripts.  A script inside a mod could auto-execute, so that might be best in the end, but for development you should use a separate script.

Some relevant Lua variables are:
    df.global.window_x
    df.global.window_y
    df.global.window_z
    df.global.plotinfo.follow_unit
    df.global.plotinfo.follow_item

I happen to know that my mayor, Ral Īgametur, is unit.id 10200.

I tried this DFHack console command:
    keybinding set Alt-1@dwarfmode/Default ":lua df.global.plotinfo.follow_unit=10200"
and now Alt-1 sets DF to follow him.

So it looks possible.

I don't know how to manipulate DFHack keybindings from DFHack Lua scripts; you can ask the experts when you get that far.

(Add:) The gui/gm-editor command is invaluable for figuring out what variables exist.
    gui/gm-editor world
    gui/gm-editor df.global
    gui/gm-editor df.global.plotinfo
    gui/gm-editor df.global.game
« Last Edit: August 07, 2023, 06:17:41 pm by 0x517A5D »
Logged

seelebrn

  • Escaped Lunatic
    • View Profile
Re: Mod feasability : Quick groups on hotkey (STR Style)
« Reply #2 on: August 09, 2023, 02:00:35 am »

Thank you so much !
I'll experiment based on that and report if I manage it.
Have a great day,
Logged