Macros in cdda? Recording inputs


#1

So, the idea of adding macros to cdda popped in: What's happening in YOUR randomly generated apocalypse? Part 2!.

I really like this idea and started planning out how to implement a macro (engine?/ editor?/menu?.. i’ll go with menu for now) but, I have never worked with cdda’s inputs before…

First a quick summary of my plan:

  • The macro-menu and a small-ish number of macro “slots” will be added to the keybinding menu.
    • More macros will be activatible from the macro-menu in the same manner as the inventory (select or invlet)
  • From the macro-menu you have the basic options: execute, rename, delete, etc.
    • Ideally you should be able to edit the macros but that’s gonna have to wait till version 2.0 as there is a big ui/ action representation issue here.
  • To create a new macro, you select “create new” give it a name hit start. From here you can use the macro-menu’s bound key to switch between the game where, your actions will get recorded or, the macro-menu where you can save/discard the macro or, select some player actions/ predefined scripts to que. (so you don’t need to craft 500 batches of ammo for your followers or, redo your “park and unload” macro because you changed death-mobiles)

Now the issues:

  1. What would be the best thing to actually record? input_event? actions? I know how to capture/que activities and handle multiple types in a que but cdda uses its own window/ input system so i’m not entirely sure… I think actions would be safer but I believe they use coordinates making it difficult to reuse them. input_events also run into problems if you change the key bindings.

  2. What’s the best way to handle macro failures? I was thinking that if it detects somethings wrong, the macro should abort and the player should get a popup…

  3. The macros should be interruptible. In order to catch errors and what not, rather than adding the macro’s action queue to the player’s, it would be much better to just add a whole bunch of calls to the macro which would then call the appropriate action. How would one go about making the macro detect a key press since it’s last call?


#2

I’m not interested in having a macro system. In games that have one, there’s a tendency to keep around terrible UI and just say you need to set up macros for automating things, where what really needs to happen is that feature should be baked into the game.

For example, if creating two-by-fours is a time sink, we need to fix that in the game, not paper over it only for some players with a macro system.


#3

That’s fair but, there are some things that I really wish could be automated… maybe rather than adding a macro system in the game, add a menu that lets you run a few predefined scripts that handle common but tedious tasks?

I’ll take a bit of time and properly come up with some examples of what i’m thinking about.


#4

If you’re automating commonly performed tasks, you need to automate them within the game. The only way a macro or scripting system is worthwhile is if people are automating wildly different use cases and everyone ends up with unique scripts.

Again, automation within the game is just great, but I don’t see a use for either a general purpose or a limited scripting/macro system. If the scripts are predefined, don’t make them scripts, build them into the interface instead. If they have to be entered by the user it’s an incredibly user-hostile interface.


#5

I must say if I found some odd case that suggested to me that I write a macro for it, I’d use one of the many available general purpose macro tools that already exist (like gnee for *nix systems). Writing a new one and bolting it into the game seems superfluous.


#6

If you want to automate things within the game, then giving an option to cut a tree down & directly into either logs or planks would be nice. Or to dig/fill a deep hole without having to go into the same menu and repeat the same action twice. Or to jackhammer a reinforced concrete wall and then use a circular saw to cut through the rebar all at once.

Just hitting E to activate the various steps for this stuff would be enough if you dont want to turn them into single actions.

And keeping the eat menu open after eating something so you don’t have to keep re-opening it.

These were all things I had in mind when I initially inquired about macros in the other thread.