Jump to content

[WIP](New Version Jun 28/15) ModActions: Control mods via action groups.


Diazo

Recommended Posts

This mod will allow you to control other mods via pre-configuring the action groups.

Version 0.5 now has multiple actions present and if no more issues are reported, this will be the official release version.

List of supported mods here.

I plan to get quite ambitious with this mod, I'm already planning to implement MechJeb and TAC Fuel Balancer support.

For now, there has been quite a lot of interest expressed in even just the Thrust Limiter setting so I am releasing this with only that action enabled to get feedback, especially on the GUI.

This is licensed under the GPL 3 license.

Module Manager is a required dependancy and must be present, Version 2.5.13 or later is required.

Download Version 0.5 here.

smTmovf.png

To use:

1) Go to the Action Editor mode in the Editor and click the Mod Acts button (will appear on the toolbar mod if installed, otherwise on the stock toolbar). Note that this mod will not show except on the actions editor screen in the editor and that in both the editor and in flight, the mod is hidden by default and will not show until the ModActs button is clicked.

2) Select your part to edit actions on.

- Directly click the part in the 3D editor game space.

Or, if you are not sure which parts can be controlled by which mod, make sure no parts are selected and select a mod to see all parts that can be edited for that mod. The selected mod's button with turn green and all parts that mod can control will be indicated by the purple circles. Click on the desired part in the 3D editor game space to select a part.

3) An unassigned action will have a "Click to select" button. When in this state, the action is hidden from the action group editor and if you somehow manage to activate it, it will do nothing.

Click the "Click to select" button to view a list of mods that can be controlled from this part and select the desired one. The "Clear Action" button is always present and when selected deletes the action and returns it to the "Click to select" state. When a mod is selected, the first action in that mod will be chosen to fill the fields in this action in. At this point, the action will become visible in the action selector to add it to an action group.

4) Keep narrowing down your selection in the third and fourth columns (Thrust Limit and Thrust Limit#:). While each column only has a single selection at the moment, once larger mods are implemented they will be grouped and filtered by these columns.

5) Enter the desired percentage for the thrust limiter in the right-most column. The value is in percent, so a value of 50 will set the engine thrust limiter to 50%.

6) Enter an appropriate description in the left-most field. This is a free-text field that you can use as you desire to remember what the action does. The text that shows here will be the text visible as the action name when adding the action to an action group. Note that this field resets any time the fourth column changes because that means the action in this slot has changed and so your old description is no longer valid.

7) Click the Mod Acts button again to hide this window and go to the action group editor to assign your Thrust Limiting actions to an action group to be usable in flight.

Note: This mod adds new actions to a part's available actions list. You must still select the action and assign it to an action group as you do with any other action.

Feedback request:

The biggest thing I need feedback on is the GUI. That is going to make or break this mod and I need to know what you players think. Notably how wide it is. I've scrunched things up due to worries about screen size, could I go wider without any issues on your screens?

Any other feedback is also appreciated, including suggestions on what other mods you want to see in this mod.

D.

Edited by Diazo
Link to comment
Share on other sites

Working with KSP in 1280x720 and the width is fine. My first reaction would be to increase the height a bit - thinking it would be on screen only while I'm using it but might change my mind after playing with it awhile.

Did notice two things

1) the stock toolbar button didn't load properly - was a white square.

2) when I highlighted the engine and clicking "Click to select" I got a single "Clear Action" button in the upper left corner.

Sorry - can't seem to imbed an image - think insert image may be link instead of imbed.

One thing I would like to see added is "Activate" and "Deactivate" actions for things that only have "Toggle" - like RCS, intakes and landing leg lock. This would be useful for when something is in an unknown state and you want to set it to a know state.

Thanks for all the work on these mods - KSP is a great game but the mods take it to the next level.

OK - just set to minimum resolution (1024x768) and the width was about half the screen but the stock action group editor wasn't much less.

Edited by wasml
update
Link to comment
Share on other sites

Supported Mods:

Vertical Velocity Control

FAR: Pitch/Yaw/Roll settings on control surfaces only

Supported Stock Actions:

Set/Change Main Throttle (Found on the Command button)

Directly set, or change, the main throttle percentage. (Use a negative number to reduce the throttle.)

Set/Change Engine Thrust Limit

Directly Set or Change an engine's Thrust Limiter.

Control From Here in right-click menu (ModuleDockingNode, ModuleCommand)

-Control From Here: This will shift vessel control to the part this action lives on, the same as right-clicking the part and selecting Control From Here from the right-click menu in flight.

Lock/Unlock control directions on wings (ModuleControlSurface for default, FARControllableSurface if FAR is installed)

-Toggle Pitch: Does this wing attempt to control in the named direction?

-Enable Pitch

-Disable Pitch

-Toggle Yaw

-Enable Yaw

-Disable Yaw

-Toggle Roll

-Enable Roll

-Disable Roll

Go on Eva (part CrewCapacity >= 1)

-Go on EVA: Each part with a crew capacity will have this action available. When activated, it sends the first Kerbal in the pod on EVA. Each time it is activated it will send the next kerbal in the pod out. When there are no kerbals left it will print a message to the screen saying so. It will not search other parts on the vessel, it will only send kerbals in the part with the action on EVA.

Crossfeed (all parts in your GameData folder, including mods)

-Toggle Crossfeed: See caution below about Resources Lock and Crossfeeding.

-Enable Crossfeed

-Disable Crossfeed

Lock Resource level on Part (all parts with resources)

-Toggle Resource: See caution below about Resources Lock and Crossfeeding.

-Allow Resource

-Lock Resource

Lock Electricity level on Part (all parts with electricity)

-Toggle Electricity: See caution below about Resources Lock and Crossfeeding.

-Allow Electricity

-Lock Electricity

Add/Remove brakes from braking action (B key) (ModuleWheel)

-Add/Rem Brakes: These actions add or remove the wheel the action is attached to from the Brakes action group. (B key by default.) It does not actually activate/deactivate the brakes itself.

-Add Brakes

-Remove Brakes

Crossfeed and Resource Lock Caution

Crossfeeding and Resource Locking have a couple of particulars you need to know about.

Electric Charge is a resource and follows the rules for Resource Locking, but as it is a special case I gave it it's own set of actions separate from the general Resource Actions. (Enabling the Resource Lock will not Lock Electric Charge.)

Edited by Diazo
Link to comment
Share on other sites

Test Download Version 0.2

This release fixes a bunch of bugs and the mod should now work as advertised.

Download here.

The engines thrust limiter action is still the only action available. If it does not show for you, check the game log (Alt-F2) when you first reach the main menu, the Mod will list the loaded actions and there should be a "ModAction 3 ModuleEngines Stock Engines Thrust Limit Limit%: 0 float" line in the log to show the action has loaded. If this line is not there, check that the KSP\GameData\Diazo\ModActions\StockEngines.actions file exists as it could not be found.

If the action has loaded (shows in the main menu log) but is still not selectable, please let me know (with as many details as possible) so I can track down why things aren't working.

Thanks for all the feedback,

D.

Link to comment
Share on other sites

OK - here goes...

Downloaded and installed your 0.2 build

Resumed a Sandbox game (no other mods installed but there had been previously)

Made a three part craft and opened the debug display

Went to action groups - debug looked ok - last entry was adding engine. MOD ACT button is fixed - not blank anymore.

Clicked the MOD ACTS button and debug menu started scrolling errors and the popped into the MOD ACT window - closing the MOD ACT window and the debug window returned.

Errors all seem to be the following:

[Log]: ModActs DrawWin Fail 5 System.ArgumentOutOfRangeException: Argument is out of range.

Parameter name: index

at System.Collections.Generic.List`1[system.String].get_Item (Int32 index) [0x00000] in <filename unknown>:0

at System.Linq.Enumerable.ElementAt[string] (IEnumerable`1 source, Int32 index) [0x00000] in <filename unknown>:0

at ModActions.MainGUIWindow.DrawMainWindow (Int32 WindowID) [0x00000] in <filename unknown>:0

[Error]: GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced)

The first time I tried ths the engine was highlighted and there was a purple circle on it. The MOD ACT window had a 1: through 5: down the left side and corresponding "Click to select" buttons.

Clicking the top "Click to select" button - on the 1: row - gave a single "Clear Action" button in the top left corner of the MOD ACT window. There was a scroll bar to the right but scrolled to the end and there wasn't anything else in the window.

Created a fresh KSP folder (1.0.2 by the way)

Installed your 0.2 build

Started a Sandbox game

Made same craft

Opened debug window

Went to action groups

Got same errors

This time I was unable to move the MOD ACT window and the purple circle didn't appear on the engine when selected - though it was highlighted.

Wiped the KSP folder and reloaded

Installed your 0.2 build

Started a Sandbox game

Made same craft

Did not open the debug window

Went to action groups

Was unable to move the MOD ACT window and the purple circle didn't appear on the engine when selected - though it was highlighted.

Went back to the Mod Acts 0.2 only but had previous mods added and deleted - was getting the circle on the engine when selected in the action group window.

Saved log files for all but the first try though they appear to be just a series of the error listed above. If they would be of any use I can find a way to get them to you.

Edited by wasml
Link to comment
Share on other sites

@wasml: Thank you for the report. I think I know what is happening, but can you check at the main menu if the "ModAction 3 ModuleEngines Stock Engines Thrust Limit Limit%: 0 float" line shows in the log? That will help me track down the 'why' on this error. (I'm talking about when the game first loads before you even click the "Start Game" button.)

@Probus: No, this will not do that. For reference, I am the "AGX guy" referred to in that thread and I have not forgotten about the staging mod linked in that thread either.

D.

Link to comment
Share on other sites

I didn't find that line anywhere in the log - Here's a extract of the section I think your referring to:

[WRN 10:20:45.398] [HighLogic]: =========================== Scene Change : From LOADING to MAINMENU =====================

[LOG 10:20:46.294] AddonLoader: Instantiating addon 'ModActionsMainMenu' from assembly 'ModActions'

[LOG 10:20:46.348] ModActions Ver. 0.1 Starting.....

[LOG 10:20:50.828] ExperienceSystem: Found 0 trait types

[LOG 10:20:50.831] ExperienceSystem: Found 9 effect types

[LOG 10:20:53.940] ScenarioTypes: List Created 12 scenario types loaded from 2 loaded assemblies.

[WRN 10:20:53.965] [HighLogic]: =========================== Scene Change : From MAINMENU to SPACECENTER (Async) =====================

I did double check that I'd loaded ver 0.2 even though the log says ver 0.1

The only other references were loading the assembly, loading some textures, the config @PART

[*] line and one when I exited the game.

Hope this helps

Link to comment
Share on other sites

That is the correct place, it should have appeared immediately after the "ModActions Ver 0.1 Starting" line.

Which means the action never loads, so there is nothing to show in the editor.

But no error is thrown either.

Are you on Linux? I'm on Windows so capitilisation doesn't matter but on linux it does. Can you tell me where the StockEngines.actions file lives exactly, including capitlisation, please? This could be something as simple as the directory being "Gamedata" on your system while the mod is looking for "GameData". On windows those would be the same directory while on Linux they are different: d vs. D on the data.

If you are on windows I'm not sure, I'll have to dig into it some more.

And Test download 0.2 saying it is version 0.1 in the log is correct, I missed incrementing that number last night when I released it.

D.

edit: Note to self, add actions to set main throttle, not just the engine thrust limiter.

Edited by Diazo
Link to comment
Share on other sites

@drtedastro: Can you report how things work for you and what OS you are on? I'm trying to narrow down what is going on with the issue wasml reported.

@wasml: Alright, so it's not that.

I'll dig into it and see what I can figure out.

Thanks again for the help on this.

D.

Link to comment
Share on other sites

Just for grins I dug out SysInternals Process Monitor to see what I could see - KSP opens StockEngines.actions and does a number of successful reads until it gets a EOF after 218 bytes - same as the file size.

Link to comment
Share on other sites

Version 0.3

Download here.

-Fix GUI to not break when no actions present

-Change Actions loading method.

@wasml: The issues you are having were a combination of two things. The GUI would break when no actions were loaded and I have positively fixed that issue. The issue with the actions not loading however I'm less certain about as I was unable to replicate it. I've tweaked how the loading works to hopefully fix the issue, but I've also added a lot of logging that will show me what is happening if this doesn't fix it. Even if everything works correctly, you are going to see 20 to 30 lines of logging in the game log when the actions load at the main menu.

Still only the one action in this version, once I can actually get actions loading for other people I will start adding more. No point in doing so until then however. :/

D.

Link to comment
Share on other sites

Installed 0.3, created a three piece rocket, went to action groups and opened ModActs. There was a grey "Stock Engines" button in the top left corner and when I clicked on the engine it turned green and a circle appeared on the engine. Clicking the green "Stock Engine" button didn't seem to have any effect. Here are the relevant (I think) sections from the log:

[WRN 20:29:22.971] [HighLogic]: =========================== Scene Change : From LOADING to MAINMENU =====================

[LOG 20:29:23.571] AddonLoader: Instantiating addon 'ModActionsMainMenu' from assembly 'ModActions'

[LOG 20:29:23.625] ModActions Ver. 0.3 Starting.....

[LOG 20:29:23.626] Stock

[LOG 20:29:23.627] Assembly name match

[LOG 20:29:23.627] Stock Engines

[LOG 20:29:23.628] ModuleEngines

[LOG 20:29:23.628] Node Found

[LOG 20:29:23.629] Thrust Limit

[LOG 20:29:23.629] Action Found

[LOG 20:29:23.630] 3|Limit%:|0|float

[LOG 20:29:23.630] gibberishToPreventThisFileFromLoadingTwice

[LOG 20:29:23.633] ModAction 3 ModuleEngines Stock Engines Thrust Limit Limit%: 0 float

[LOG 20:29:29.478] ExperienceSystem: Found 0 trait types

...

[WRN 20:29:40.167] [HighLogic]: =========================== Scene Change : From SPACECENTER to EDITOR (Async) =====================

[LOG 20:29:41.771] No Input Locks in effect right now

[LOG 20:29:41.997] AddonLoader: Instantiating addon 'ModActionsEditor' from assembly 'ModActions'

[LOG 20:29:42.027] ------------------- initializing editor mode... ------------------

[LOG 20:29:42.027] editor started

[LOG 20:29:42.057] IconLoader awake

[WRN 20:29:42.187] [RDTechTree]: No tech node found called

[WRN 20:29:42.188] [RDTechTree]: No tech node found called

...

[WRN 20:31:47.815] [HighLogic]: =========================== Scene Change : From SPACECENTER to MAINMENU (Async) =====================

[LOG 20:31:49.849] AddonLoader: Instantiating addon 'ModActionsMainMenu' from assembly 'ModActions'

[LOG 20:31:49.874] ModActions Ver. 0.3 Starting.....

<EOF>

Edited by wasml
Link to comment
Share on other sites

Alright, the good news is that everything loaded correctly this time.

Now, the new issue you are seeing I'm not sure if that is a bug (code not working as designed), or a bad UI design (buttons doing something else then you expect). Your description in your last post seems to describe two different use paths into one.

The two ways I expected the mod to be used:

1) Player knows which part the action is on:

-Click on the part, ModActs window will show the rows of programable actions, they will all say "Click to Select".

-Click on an action, it will show a list of Mods this part supports, if is an engine, clicking Stock Engines will choose that action. (The screen should now look almost identical to the picture in my first post.)

-You can now tweak the action (and once more actions are added, pick them here.)

2) Player does not know which parts the mod to control is on: (Vessel control mods not attached to a part most likely.)

-Make sure no parts are selected, either upon first entering the editor or by clicking the "Clear Selection" button.

-A list of all loaded mods will appear on buttons. Clicking a mod will turn that mod's button green and all parts that support the highlighted mod will be indicated by a purple circle. (Clicking on a green button does nothing, clicking another mod's button changes the green button to that mod and shows the associated parts.)

-Player clicks on the part desired and now knows the part needed, goto use case 1 above.

The way I read your previous post is that neither of these happened. Rather something like the following:

-Get to the Actions Editor and open the ModActs window.

-Click on the engine directly, no interactions yet with the ModActs window.

-ModActs window changes to show the list of mods installed with the Stock Engines mod highlighted in green (as if no parts were selected in case 2 above) instead of the list of actions on the part that it is supposed to show (a column of Click to Select) buttons.

This should not be happening because for the list of all mods to show, no parts can be selected. As you have selected the engine part, you clearly have a part selected.

I'll dig into it.

D.

edit: Quick youtube of how things are supposed to work. First half is how I think you are trying to use the mod by click on the engine first. Second half (after the mouse circles the clear selection button) shows the list of all mods and how you can highlight associated parts. Vertical Vel. is the second mod I'm adding that uses control pods, so it's purple circle shows on the pod.

Edited by Diazo
Link to comment
Share on other sites

Here's a click by click - did it two different ways:

Build craft with two engines

Try 1:

1) Go to Action Groups editor

2) Click MOD ACTS button

- Mod Acts window comes up with grey "Stock Engines"

3) Click "Stock Engines" button in Mod Act window

- Mod Act "Stock Engines" turns green and a circle appears on both engines

4) Click one of the engines

- Engine gets highlight tint and stock actions appear in stock window

- Mod Act window has not changed - Showing green "Stock Engines" button.

Try 2:

1) Go to Action Groups editor

2) Click one of the engines

- Engine gets highlight tint and stock actions appear in stock window

3) Click MOD ACTS button

- Mod Acts window comes up with grey "Stock Engines"

4) Click "Stock Engines" button in Mod Act window

- Mod Act "Stock Engines" turns green and a circle appears on both engines

At no point did I see the list of "Click to select" buttons from the video.

Link to comment
Share on other sites

Found something though I can't seem to get it to repeat.

I started with a fresh install, built a craft and went into the action group editor and selected an action group before opening Mod Acts and I saw all the right buttons including the thrust limit input box. Tried this again with a fresh install and I think I repeated the same sequence (though probably not) but couldn't get it to repeat.

Link to comment
Share on other sites

I have been poking at this and I am currently stumped. The fact that selecting an action group make it work once is a promising lead I will follow up though.

I may have to simply rewrite that part of the mod to work differently. :/

I'll have something regardless in the next few days.

D.

Link to comment
Share on other sites

I may have found the problem - after realizing one of the lines in the log file looked like a ModualManager line I added MM and the GUI seems to work now. When I was testing I didn't want any conflicting mods to cloud the results so started with a fresh install and only your mod - nothing else. If I've overlooked some install instructions I apologize. I now see the cfg files in the dll directory - that should have clued me in too.

Link to comment
Share on other sites

@wasml: Yes, Module manager is required, and no I had not actually indicated that anywhere. (Oops.)

It's always present in my dev environment because all my mods require it so I'd actually forgotten I needed to note the dependancy on it when I first posted the download.

Sorry about that. :/

I should have a version that actually supports other actions up early next week so I can actually start showing off the potential (I hope) this mod has.

D.

Link to comment
Share on other sites

  • 2 weeks later...

hm, i don´t understand how i activate vertical velocity.

In the ActionGroup Menue i can choice vertical velocity and the Button change to green. But whats the next step? I don´t see any action in the menues of the parts.

Edit: OK, now it works. ;)

Edited by Cheesecake
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...