Author Topic: Replace Tool  (Read 1041 times)

Yulgalminakf

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Replace Tool
« on: June 25, 2015, 07:11:03 PM »
I have another idea: Replace Tool. This tool, in the designs tab, would select a subsystem on the left and when you click on a subsystem on the right, it replaces the entire subsystem with the one you have selected.

-It would have to be able to select a subsystem (I can copy that from the paint tool).

-It needs to be able to find all the hexes of the subsystem.

Again, any help would be appreciated. Please and thank you! :)

Yulgalminakf

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Replace Tool
« Reply #1 on: June 25, 2015, 08:08:28 PM »
I'm kinda at a roadblock...

All I'm doing is adding
Code: [Select]
DESIGN_TOOL_REPLACE: R

under

Code: [Select]
Group: DesignEditor

And then copy-paste "keybinds.txt" into mods/(MyMod)/data/. But whenever I do that, it gives me a crap-ton of nonhelpful errors:

Code: [Select]

  Error: Failed in call to function 'RegisterEnumValue' with 'Keybind' and 'KB_DESIGN_DUPLICATE' (Code: -13)
  Error: Failed in call to function 'RegisterEnumValue' with 'Keybind' and 'KB_DESIGN_UNDO' (Code: -13)
  Error: Failed in call to function 'RegisterEnumValue' with 'Keybind' and 'KB_DESIGN_REDO' (Code: -13)
  Error: Failed in call to function 'RegisterEnumValue' with 'Keybind' and 'KB_DESIGN_TOOL_PAINT' (Code: -13)
  Error: Failed in call to function 'RegisterEnumValue' with 'Keybind' and 'KB_DESIGN_TOOL_MOVE' (Code: -13)
  Error: Failed in call to function 'RegisterEnumValue' with 'Keybind' and 'KB_DESIGN_TOOL_DROP' (Code: -13)
  Error: Failed in call to function 'RegisterEnumValue' with 'Keybind' and 'KB_DESIGN_SAVE' (Code: -13)
  Error: Failed in call to function 'RegisterEnumValue' with 'Keybind' and 'KB_DESIGN_SAVE_CLOSE' (Code: -13)
  Error: Failed in call to function 'RegisterEnumValue' with 'Keybind' and 'KB_DESIGN_EXPORT' (Code: -13)
Property:
  Error (1:16): Name conflict. 'DesignEditor' is a global property.
:
  Error: Failed in call to function 'RegisterGlobalProperty' with '::KeybindGroup DesignEditor' (Code: -9)
  Error: Invalid configuration. Verify the registered application interface.
ERROR: Failed to build module 'saving' in manager 'menu' (code -17).
  Error: Invalid configuration. Verify the registered application interface.
ERROR: Failed to build module 'icons' in manager 'menu' (code -17).
  Error: Invalid configuration. Verify the registered application interface.
ERROR: Failed to build module 'util.formatting' in manager 'menu' (code -17).
  Error: Invalid configuration. Verify the registered application interface.
ERROR: Failed to build module 'elements.Alignment' in manager 'menu' (code -17).
  Error: Invalid configuration. Verify the registered application interface.
ERROR: Failed to build module 'elements.IGuiElement' in manager 'menu' (code -17).
  Error: Invalid configuration. Verify the registered application interface.
ERROR: Failed to build module 'elements.WordWrap' in manager 'menu' (code -17).
  Error: Invalid configuration. Verify the registered application interface.
ERROR: Failed to build module 'dialogue' in manager 'menu' (code -17).
  Error: Invalid configuration. Verify the registered application interface.
ERROR: Failed to build module 'orders' in manager 'menu' (code -17).
  Error: Invalid configuration. Verify the registered application interface.
ERROR: Failed to build module 'systems' in manager 'menu' (code -17).
  Error: Invalid configuration. Verify the registered application interface.
ERROR: Failed to build module 'ship_groups' in manager 'menu' (code -17).
  Error: Invalid configuration. Verify the registered application interface.
ERROR: Failed to build module 'campaign' in manager 'menu' (code -17).
  Error: Invalid configuration. Verify the registered application interface.
ERROR: Failed to build module 'version' in manager 'menu' (code -17).
  Error: Invalid configuration. Verify the registered application interface.
ERROR: Failed to build module 'civilians' in manager 'menu' (code -17).
  Error: Invalid configuration. Verify the registered application interface.
ERROR: Failed to build module 'cloud_mods' in manager 'menu' (code -17).
  Error: Invalid configuration. Verify the registered application interface.
ERROR: Failed to build module 'design_settings' in manager 'menu' (code -17).
  Error: Invalid configuration. Verify the registered application interface.
ERROR: Failed to build module 'designs' in manager 'menu' (code -17).
  Error: Invalid configuration. Verify the registered application interface.
ERROR: Failed to build module 'elements.GuiBlueprint' in manager 'menu' (code -17).
  Error: Invalid configuration. Verify the registered application interface.
ERROR: Failed to build module 'elements.GuiCargoDisplay' in manager 'menu' (code -17).
  Error: Invalid configuration. Verify the registered application interface.
ERROR: Failed to build module 'elements.Gu♥♥♥♥♥♥List' in manager 'menu' (code -17).
  Error: Invalid configuration. Verify the registered application interface.
ERROR: Failed to build module 'elements.GuiStatusBox' in manager 'menu' (code -17).
  Error: Invalid configuration. Verify the registered application interface.
ERROR: Failed to build module 'gui_zoom' in manager 'menu' (code -17).
  Error: Invalid configuration. Verify the registered application interface.
ERROR: Failed to build module 'movement' in manager 'menu' (code -17).
  Error: Invalid configuration. Verify the registered application interface.
ERROR: Failed to build module 'oddities' in manager 'menu' (code -17).
  Error: Invalid configuration. Verify the registered application interface.
ERROR: Failed to build module 'planet_loyalty' in manager 'menu' (code -17).
  Error: Invalid configuration. Verify the registered application interface.
ERROR: Failed to build module 'theme' in manager 'menu' (code -17).
  Error: Invalid configuration. Verify the registered application interface.
ERROR: Failed to build module 'util.convar' in manager 'menu' (code -17).
  Error: Invalid configuration. Verify the registered application interface.
ERROR: Failed to build module 'util.map_tools' in manager 'menu' (code -17).

When the game loads up, NONE of the ui is loaded, it's just a black screan. The menus don't load properly. What am I doing wrong? How can I replace the keybinds and/or add my own keybinds?
« Last Edit: June 25, 2015, 08:14:34 PM by Yulgalminakf »

Yulgalminakf

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Replace Tool
« Reply #2 on: June 26, 2015, 04:14:52 PM »
So, I figured everything out but the keybinds. Whatever I do, the keybinds.txt file being overridden causes many errors. However, everything else works exactly like I want to. Replacing the subsystem type was actually really easy. The difficult part was figuring out the undo/redo stuff, but I did and it works perfectly.

I'll attach the mod to this post (the only script I modified was DesignEditorTab.as). If anyone wants to take a look at it, you're welcome to it. If have you have any questions, I'll be glad to answer them. And if anyone finds any bugs LET ME KNOW PLEASE!

dalolorn

  • Sentient
  • **
  • Posts: 199
  • Karma: +7/-0
  • ABEM Developer
    • View Profile
Re: Replace Tool
« Reply #3 on: June 27, 2015, 05:11:31 AM »
I posted a response in your Steam thread that might contain the solution. Did you try that?

Edit: Okay, I've added the keybinds and put in a reference in your script to call those keybinds. (Also, gotten rid of the boatloads of extraneous localization and added some you overlooked.) Testing as soon as the game comes up.

Re-edit: Intriguing. It would seem that the game does not take kindly to attempting to redefine an enum that has already been defined. My tests yesterday worked, but I modified the base file directly instead of using mods.

I'd bring this to Lucas' attention in the IRC (if he and Reaper haven't already noticed the two threads you opened on the topic, that is :)), as it sounds like a bug. (Or, if not a bug, then something that needs some expert guidance from a dev to figure out.)

In the meantime, I have these observations to make:

1. You do not need to override locales/ui.txt. You can make a locales/ToolMod_ui.txt and put your locale keys (DESIGN_REPLACE_TOOL and KB_DESIGN_TOOL_REPLACE are needed, with the latter being modeled after KB_DESIGN_TOOL_# in locales/options.txt) in that file.

2. Once you define your keybinds correctly, you will need to make sure the design editor knows what to do with those keybinds. You probably already noticed that and left it out because you couldn't get the keybinds working, but I'm mentioning it just in case. :P
« Last Edit: June 27, 2015, 05:43:46 AM by dalolorn »

GGLucas

  • Dr. Evil
  • BMS Staff
  • Delusional
  • *
  • Posts: 1877
  • Karma: +300/-6
    • View Profile
Re: Replace Tool
« Reply #4 on: June 27, 2015, 07:12:33 AM »
Keybind loading is a little weird in mods, it loads the base game's file and the mod's file, which causes duplicated binds/bind groups. Originally the intent was for the mod to have only its new keybinds in its file (so you don't have to rebind the keybindings for every mod), but because this was one of the engine's earlier systems it ended up not working quite right over time with keybind groups. Unfortunately there's no way for mods to add to an existing keybind group, so you'd have to add it either as a global keybind, or create an entirely new group (and since you can only set one group per gui element, this creates some problems).

dalolorn

  • Sentient
  • **
  • Posts: 199
  • Karma: +7/-0
  • ABEM Developer
    • View Profile
Re: Replace Tool
« Reply #5 on: June 27, 2015, 02:55:42 PM »
Because of various UI issues like having duplicate keybind groups to work with, one of which would serve no purpose, I'd strongly recommend you add it globally.

Yulgalminakf

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Replace Tool
« Reply #6 on: June 27, 2015, 07:03:12 PM »
Yeah, I tried making my own keybind group and ran into the problems Lucas suggested. Since the button press function only passes in an enum (basically an int in disguise) it passes in 0 for my keybind and goes to a previously defined tool's keybind. The only way to solve this is to re-work how most of the gui for the tabs works... I think not having a keybind for my tool isn't that big of a deal. Thanks for your help! :)

dalolorn

  • Sentient
  • **
  • Posts: 199
  • Karma: +7/-0
  • ABEM Developer
    • View Profile
Re: Replace Tool
« Reply #7 on: July 29, 2015, 05:32:55 AM »
Hmm, perhaps it would be possible to use the AddBind() function, as demonstrated in client/input.as and http://data.glacicle.org/sr2/api_documentation/client.class.KeybindGroup.html. Sadly, I can't guarantee that it'll work, because I can't find any scripts regulating keybinds (which means they're probably in the binaries, not something we can touch), but it's worth a shot.