Space Engineers

Space Engineers

Share Your Creations
Find and download player-created worlds and mods, or create your own and upload them directly to Steam Workshop.
了解更多
Jack Schitt 38 2023 年 9 月 6 日 下午 12:51
Add an action slot command?
When we're in a control seat or cockpit and press G then right-click on a block a menu appears with commands we're able to select. How would I add a new command to that menu?
< >
正在显示第 1 - 15 条,共 25 条留言
ShadedMJ 3 2023 年 9 月 6 日 下午 5:18 
I bumped into this kind of related post (from 6 years ago...). Applying actions to blocks appears to be kind of fluid.
https://psteamcommunity.yuanyoumao.com/app/244850/discussions/0/2906376154318799643/
Jack Schitt 38 2023 年 9 月 6 日 下午 11:30 
hmm. That info seems outdated. Even if one of the examples in that discussion still works I'm baffled as to what the action name would be displayed as in the menu. I'd like to add a Start/Stop or enabled/disabled toggle to some blocks as additional option besides on/off.

Some mods have a separate start and stop button or an enable/disable checkbox in their control panel additional to the On and Off buttons, and those same options are usually in the action slot right-click menu.

Where's the documentation they learned how to add a button to the control panel from?
If adding an action command for a hotbar button option is different....same question:
Where'd they learn how to to that?

This seems like it might be leading me on the right path:
https://github.com/malware-dev/MDK-SE/wiki/Terminal-Properties-and-Actions
but I haven't found where it says how to create a new/custom action command or a button in the control panel like I'm curious about.
ShadedMJ 3 2023 年 9 月 7 日 上午 5:50 
I was intending to edit my previous post if there wasn't anything added here.

You might want to pick apart the Nanobot Build and Repair mod since it has a lot of actions. I don't see other mods that use more than the basics.
You'll have to do programming that is more involved than scripts. There needs to be a recognition of the action name and linking that to the internal code in the block. That really can't be added after the fact. There can't be a Rotor.ApplyAction("OppositePosition") without completely rebuilding the Rotor code.

I'm focusing on the action names from something like the timer block interface, not the display in the terminal window and I consider these two completely different things. There are action names that don't have buttons on the terminal window when they really should. The first one I found was "Attach" and "Detach" for a piston.
最后由 ShadedMJ 编辑于; 2023 年 9 月 7 日 上午 5:54
Jack Schitt 38 2023 年 9 月 7 日 上午 10:54 
Thanks, ShadeMJ!
Yes, I agree. The GUI of the terminal and the action commands are different things but they're kind of tied together. I think you get what I'm looking for, to add if it's possible, but to explain it more; if you're familiar with Easy Automation we can use that to get a list of actions and properties available for each block. In my opinion some of the blocks are missing actions I think would be helpful for them to have. Like a Start/Stop action ("command") for refineries and assemblers.

If I'd want to add a Start/Stop command to refineries and assemblers I'd have to rebuild the code and terminal UI completely? It can't just be added?
ShadedMJ 3 2023 年 9 月 7 日 下午 4:38 
I'm assuming your Start/Stop action is not the same as the existing On/Off action. There'd have to be existing Refinery.Start() in code somewhere and then the Refinery.ApplyAction("Start") linked to that.

I posted my own code to display actions just over a year ago, and have a similar one for properties.
https://psteamcommunity.yuanyoumao.com/app/244850/discussions/0/3409804428998926106/#c3409804428999550512
I used it on a piston and found action "Add Top Part" that isn't in the terminal interface.

That may have been a little off-topic. So you have some blocks that are missing actions you thing would be helpful. Fine. Where's the code to implement those actions? In order for those actions to work, there has to be existing code to make them work and that already coded by Keen. If you want a piston action called "GoToMiddle", there will have to be code somewhere in the game to do that process.

If there is an action in Easy Automation, I bet it isn't using that action as-is on the block but running its own part of a script to do the same thing, just like I would with a script.
Jack Schitt 38 2023 年 9 月 7 日 下午 5:52 
That might be perfectly what I need for other blocks, such as the AutoMiner V2 (mod) that has a Start and Stop button in the control panel! Thanks!

public void DisplayBlockActions(IMyTerminalBlock BlockToCheck) { List<Sandbox.ModAPI.Interfaces.ITerminalAction> ActionList=new List<Sandbox.ModAPI.Interfaces.ITerminalAction>(); BlockToCheck.GetActions(ActionList); Echo("ActionName = Action Description"); foreach (Sandbox.ModAPI.Interfaces.ITerminalAction A in ActionList) Echo(A.Id+" = "+A.Name.ToString()); }

How to run it? Make a .cs file, load it into a programmable block, click the run button in the programmable block?

Where does it post the data it finds?
How do we tell it what block to check?
ShadedMJ 3 2023 年 9 月 7 日 下午 6:18 
I've made scripts for you before.
Inside of the Main() use
IMyTerminalBlock Block=GridTerminalSystem.GetBlockWithName("Your block name");
DisplayBlockActions(Block);

It displays in the programmable block. I can change it to be a LCD or something if you wish.

Edit : Here's a better wrapper:
public void Main(string argument, UpdateType updateSource) {
IMyTerminalBlock Block=GridTerminalSystem.GetBlockWithName("Your block name");
DisplayBlockActions(Block); }

public void DisplayBlockActions(IMyTerminalBlock BlockToCheck) {
List<Sandbox.ModAPI.Interfaces.ITerminalAction> ActionList=new List<Sandbox.ModAPI.Interfaces.ITerminalAction>();
BlockToCheck.GetActions(ActionList);
Echo("ActionName = Action Description");
foreach (Sandbox.ModAPI.Interfaces.ITerminalAction A in ActionList)
Echo(A.Id+" = "+A.Name.ToString()); }
最后由 ShadedMJ 编辑于; 2023 年 9 月 7 日 下午 6:31
Jack Schitt 38 2023 年 9 月 7 日 下午 6:52 
I wish I wasn't but I'm clueless with C# code. I can't make any sense of it.
Thanks a ton!

If this helps me Start an Autominer (the mod), an assembler and refinery when they're idle that's what I'm after to do. I'd like to be able to set starting those things when they're idle to a button panel or wall button, or a hotbar action instead of having to go into the control panel or dig through the inventory screen to swap stuff around to make them get going.

If there's some kind of "Start" action for them Easy Automation doesn't list I think I can probably still use Easy Auto to run the action as long as there's one there to run.
If there isn't one to run my OP question....still....
最后由 Jack Schitt 编辑于; 2023 年 9 月 7 日 下午 6:55
Jack Schitt 38 2023 年 9 月 7 日 下午 8:57 
No "Start" action listed for an assembler, refinery, or the AutoMiner V2 block. I didn't question your info ShadedMJ but it proves the buttons in the control panel UI are completely separate. I thought maybe they would call on the same action from the same place.

So how do I set up a button or hotbar slot to start these things when they're on but idle?
Where does the script above get the data it lists from? Is it not in a text file somewhere?
Whether that helps me with this task or not I'm curious.
ShadedMJ 3 2023 年 9 月 7 日 下午 10:11 
That's what I didn't like about your "Start" action. Your "Start" is called "OnOff_On" and your "Stop" is called "OnOff_Off". I thought you were meaning something else.

First thing I did when looking at actions years ago was to understand Keen's list which isn't great but at least it was a start.
https://www.spaceengineerswiki.com/Programming_Guide/Action_List
最后由 ShadedMJ 编辑于; 2023 年 9 月 7 日 下午 10:15
Jack Schitt 38 2023 年 9 月 7 日 下午 10:15 
For some blocks there's an OnOff_On / OnOff_Off and an additional Start/Stop action. That's what I mean. Turning them on doesn't make them start _working_ it only makes them use power. I'd like to make them start and stop working.
....via a button on a panel, timer block, or the hotbar.
最后由 Jack Schitt 编辑于; 2023 年 9 月 7 日 下午 10:34
ShadedMJ 3 2023 年 9 月 7 日 下午 10:55 
Standard blocks have the OnOff actions. No vanilla blocks have Start/Stop that I know of, so I think Start/Stop is in a mod. So that depends on the definition of Start/Stop from the mod maker which may be different than your definition. What is "Start" from the mod makers perspective?
Jack Schitt 38 2023 年 9 月 8 日 上午 2:08 
The definition of every word I ever type can be found in Merriam-Webster's dictionary.
Start: Transitive Verb 7.a[www.merriam-webster.com]
to cause to move, act, or operate

Stop: Intransitive Verb 1.a[www.merriam-webster.com]
to cease activity or operation

I have no idea what the mod author might assume they mean but that's what the buttons in the UI do.
最后由 Jack Schitt 编辑于; 2023 年 9 月 8 日 上午 2:18
ShadedMJ 3 2023 年 9 月 8 日 上午 5:49 
I subscribed to [VSI] Autominer mod which may be different than the one you are using. That mod has terminal block options for ore selection, radius, depth, start button, and stop button, so I'm using that as a point of reference.

Small text wall here. Go to the TLDR section at the end.

I can understand your frustration and I don't think I'm antagonizing you, but it also seems you are venting at me a bit....

Mod works as I would have expected. A little clunky. It is created in a power-off state and stop button activated. Doing a power-on for the block enables that start button but does not start the automining process yet. The player _appears_ to be needing to select the ore and radius and depth and then press the start button, since that is the order of buttons. Mod mines ore and that's about it.

Now I looked at the actions. I see actions about fonts and text padding, and nothing about start buttons, stop buttons. Not surprising. Every mod block has to start its mod life based on another block from Keen. Mod weapons blocks start from vanilla weapon blocks to get inventory and firing commands. This one appears based off a text panel or LCD since it has fonts and text padding. Its a mod makers choice.

TLDR : The author of this mod did not devote time/effort into setting up actions for the mod block. The player must press the start and stop buttons and those buttons cannot be used by scripts or timer blocks because those buttons are not set up as actions in the block.

As I stated before, Block.ApplyAction("Start") needs to be interpreted by the block and go to the section of code for the start button. This must be done by the mod author and cannot be done by a player.

I use the Nanobot Build and Repair mod. The action list on that is extensive because the mod author went through the effort to have many settings available to script writers.
最后由 ShadedMJ 编辑于; 2023 年 9 月 8 日 上午 5:53
Jack Schitt 38 2023 年 9 月 8 日 上午 10:35 
I appreciate the help! My intention was to be clear, prevent any confusion. Nothing negative intended.

Those text actions and properties are in almost every block regardless of what the block is or whether it makes sense for that block to have text adjustment options or not. That's one of the reasons I'm curious where reports like the script you shared and Easy Automation are getting that data from. I did a Windows File Explorer Search for "OnOff" and several other property and action names. Results didn't come up with anything. So...where's the data scripts like the one you kindly shared here getting the info they share from? A .dll?

Anyone capable can post modified versions of existing mods. An example is Nanobot Build and Repair system. Look at all of the different, modified, versions there are of it:

https://psteamcommunity.yuanyoumao.com/workshop/browse/?appid=244850&searchtext=build+and+repair&childpublishedfileid=0&browsesort=textsearch&section=

I see Forty Seven different versions of it as of page 4.
As long as the original author doesn't have an issue with their mod being modded it's all good.
< >
正在显示第 1 - 15 条,共 25 条留言
每页显示数: 1530 50