Space Engineers

Space Engineers

Not enough ratings
SMS v1.3 Guide
By BelaOkuma
The guide for my script SMS version 1.3
   
Award
Favorite
Favorited
Unfavorite
script modus
After the script is loaded into the Programmable Block it runs without a timer.
There are 3 modes in which the script can run.

Modes
Restrictions
Recommendation
SHIP
Only the grid of the ship is displayed
Suitable for ships
SHIP_PLUS
Grid of the ship and the ships docked at docking ports are displayed
Suitable for ships with docking facilities (carrier)
STATION
All grids are displayed
Suitable for stations

Currently the script searches for the optimal mode itself.
// runningmodes: enum ScriptMode {AUTO,SHIP,SHIP_PLUS,STATION}; ScriptMode s_mode=ScriptMode.AUTO;
But you can also force a certain mode:
ScriptMode s_mode=ScriptMode.SHIP;
ScriptMode s_mode=ScriptMode.SHIP_PLUS;
ScriptMode s_mode=ScriptMode.STATION;
Terminals

Terminals are used to display different information with the buttonpanel via a context-sensitive menu
can be influenced. Several terminals can be distributed on the base of the
such as for the landing pads and/or engine room, bearings etc.
This makes it easy to quickly call up the information you need.

Setup:

To define the LCD as a terminal, the name
expand with:

... (sms,terminal:A1)

A1 is the ID of the terminal and should not occur twice.
It consists of a letter and a digit and is
required in order to assign the function keys (buttonpanel)
to the terminals.

To avoid duplicate IDs it is best to enter "sms,terminal" in the search field.
Now all terminals that already exist will be displayed.


Setting up the buttonpanel:

Configure the buttons on the buttonpanel as follows:
  • Button 1 -> Programmable block where SMS runs -> execute
    A1:1
  • Button 2 -> Programmable block where SMS runs -> execute
    A1:2
  • Button 3 -> Programmable block where SMS runs -> execute
    A1:3
  • Button 4 -> Programmable block where SMS runs -> execute
    A1:4

After a certain time (default is 120s) the terminal returns to the main menu.
This time can be changed for all terminals in the script itself:

... // time to return to the mainmenu (global) in sec. // 0 = never return const int KEEPMENU=120; ...

or for each terminal separately in the name:
... (sms,terminal:A1,keepmenu:60)

A value of '0' never allows the terminal to return.
This applies to both variants.

Header and main menu text can now be globally used for all terminals.
can also be adapted in the script itself:

... // terminal headline const string tHeadLine="@maingridname,,Welcome to SMS v1.1h,,@time,/,@date"; // terminal mainpage const string tMainPage="\ninvman(sort,style 3)"; ...

LCDs
So that SMS can display info on the Lcd extend the name with :

... (sms,infolcd)

The visible number of lines is determined and changed dynamically.
You can also use "lines:x" to specify a fixed number of lines.

... (sms,infolcd,lines:15)

you want to extend the display to a second and third Lcd
add the name of the Lcds below with :

... (sms,linklcd)

The LCDs should be placed directly below each other and can only be linked vertically and not horizontally.

What should be displayed (commands) is then written in CustomData
Displays
All displays from the vanilla blocks can be controlled.

For the blocks with only one display the setup is the same as for the LCDs.
For example the flight seat and the control seat.


For blocks with several displays the setup must be done completely in CustomData.
The setup starts with :
@display (sms,infolcd:x)
and ends with:
@enddisplay

All lines in between are then the commands.

"x" indicates the number of the display. It is the same as the list in the "K" menu of the block, but starts with "0". Otherwise you know the syntax from the LCDs. You can also use the "lines:xx" option here.

Here is an example for the second display on which the command "thrust" is to be executed:

@display (sms,infolcd:1) thrust(style 1) @enddisplay

To show all displays in an InfoLcd that are controlled by SMS, there is now a command.

displays


The number is the instructions needed to create the current image.
commands
The commands are written in CustomData of the LCD.

Syntax:

command [filter] (options)

For filters see section "Filter".

The individual commands are:

batterys
reactors
tanks
Hydrogen- und Oxygentanks
refinerys
oreprio
Displays the priorities in ore processing
resources
Displays ores and ingots more clearly.
assemblers
airvents
jumpdrives
gasgenerators
Oxygengenerators
cargocontainers
connectors
inventory
oxygen
hydrogen
solar
wind
cargo
invman
Information about containers to be sorted by SMS
energy
energy_p
for pruducer only
energy_r
Shows how long the energy reserves will last, similar to "powertime" from MMaster
dockings
Information about docked ships
displays
Information about all controlled LCDs.
damage
damage_b
Information about damaged grids or blocks.
speed
Shows the speed of the ship, if desired also in KmH and Mph. (style 1-4,kmh,mph)
mass
Indicates the mass of the ship (style 1-4)
gravity
Shows the current gravity (style 1-4)


The commands can be influenced with options.
filter []
A filter can be used to display only certain blocks or items.
This is written in square brackets directly after the command

batterys
shows all batteries.
batterys[ * ]
the same, all batteries are displayed.

Multiple filters are separated by commas.
with leading '-' they are omitted.

Examples:
All batteries except "Battery 5a".
batterys[*,-5a]

All arc furnaces and the "Refinery 5"
refinerys[Arc,Refinery 5]

All refineries that have "base" in their name
refinerys[Base]

It is also possible to display blocks or items of a docked ship:
batterys[dock:Alpha]

...or...
inventory[dock:Alpha](all,block)
options ()
Options must be placed in round brackets.
Several options must be separated by commas.

For example:

batterys(gridname,noline,style 3)

general:

gridname
Groups the displayed elements by Grids

maingrid
Displays only elements on the grid of the Programmable Block on which the SMS script is running.

lcdgrid
Displays only items on the LCD grid.

noline
Hides the lines

noheadline
Hides the headline

nomessage
Hides the warningmessages

noerror
Hides the errormessages

notitle
Hides the Title

sort
Sorted in ascending order by name

sort back
Sorted in descending order by name

sort amount
Sorted in ascending order by quantity (inventory and oreprio only)

sort amountback
Sorted in descending order by quantity (inventory and oreprio only)

sort mass
Sorts in ascending order by mass (Inventory only)

sort massback
Sorts descending by mass (Inventory only)

sort volume
Sorts ascending by volume (Inventory only)

sort volumeback
Sorts in descending order by volume (Inventory only)

style x
Various display templates
x=1-4
Standard is 2

col x
Number of columns
x=1-4
Default is 1, for Inventory 2

for tanks:

hydrogen oxygen
What type of tanks should be displayed
"inventory"
The following options are available for inventory:

ore ingot component h-bottle o-bottle tools weapons kits datapads cash ammo

If you want to display the items of the DailyNeedsSurvivalMod.

food

You have to unlock the mod at the beginning of the script.

With these you determine which items should be displayed.

Or you want to show everything, then there is the option "all".

inventory(all)


If you want to exclude items just put a '-' in front of it.
For example everything except ores and ingots:
inventory(all,-ore,-ingot)


Several options are also possible.
The order of the options is decisive.

For example:
inventory(ore,ingot)
...or...
inventory(ingot,ore)
That would work too, even if it doesn't make sense.
inventory(cash,cash,cash)

If you do not want the grouping of the individual items
there is the option "block":
block

An example, with and without "block" option:

inventory(h-bottle,o-bottle)
inventory(h-bottle,o-bottle,block)

You can also take one of the new macro options:

All bottles:
inventory(bottles)

Includes tools, bottles, datapads and kits (Med and Power)
inventory(utils)

The options "fillbar" and "zero" offer another way of display.

inventory(component,fillbar,zero)


This gives you a better overview of the inventory of components and allows you to quickly
when something runs out. But it also works with ores and bars etc.

If you want to know which components and how much is currently being produced
you can display this with the "assembly" option. The prerequisite is that my script PIM is running on the same grid.

The display can be influenced more precisely via the "table" option.
Then only fields are displayed which are in the options.

Possible fields are:
  • name
  • fillable
  • ratio
  • amount
  • max
  • volume
  • mass
  • assembly

Here is an example for components:
"energy", "energy_p" and "energy_r"
With "energy" (everything) and "energy_p" (producer only) you can display information about the energy budget.

energy energy_p

There are 4 types of items here:
Tag
Description
stored
Energy that has been stored
available
theoretically maximum available energy
output
Energy output of producers
consumption
Energy consumption of consumers

Difference between "available" and "output:

A wind turbine can theoretically deliver up to 400kW. Depending on its location (height above sea level and distance to other objects) it may only generate 330kW (available), i.e. 82.5%. The output is then the actual momentary energy input into the grid (e.g. 33kW of 330kW i.e. 10%).
Another example with batteries, 10 large batteries can supply up to 120MW of electricity. But if 2 of them are switched off "available" is only 96MW(80%). The final output of the batteries depends on the consumers.
So if the reactors are always off the "available" of reactors is always 0kW or 0%.
I hope I could explain this correctly why I have formed this classification.

Without options all 4 sections are always displayed.
line(*) energy(sort)

If you only want to have the consumers...
energy(sort,consumption)

...or output and stored energy:
energy(sort,output,stored)

You can also use the new "table" option for a better overview:
energy(style 4,sort,output,stored,table)

The "gridname" option works here too.
energy(style 3,sort,table,stored,available,output,gridname)

With the "energy_p" command only energy generators are displayed, additionally
with the overview "Total". And firmly sorted. Here I have orientated myself a bit at the "power"/"powerV" command of MMaster. Maybe one or the other finds this overview better.

energy_p(style 4)

Here, too, the tabular form is used:
energy_p(table)

Tip:
"style 3" and "style 4" with all sections are only suitable for wide LCDs, otherwise the table will not be displayed correctly.

With "energy_r" the range of the stored energy is displayed, similar to the "powertime" command of MMaster.
There are no options and only one line is displayed.
energy_r

You can also use "energy" as an option for the commands with physical blocks.
All energy options that the corresponding blocks have are displayed.
jumpdrives(energy)

batterys(energy)

However, you can also use the above "Type" options to display only certain types.
batterys(energy,consumption)

Additionally or also alone, the "onoff" option shows whether the block is on or off.
With energy option:
jumpdrives(energy,onoff)

"onoff" option alone:
refinerys(onoff)
"thrust", "trust_e" and "thrust_w"
With "thrust" the current thrust of the individual engine types is displayed.

thrust


The direction is the direction in which the engines fire. So "Downward" is then the lift. The abbreviation in square brackets can also be used in the "sort" option to re-sort the display or to display only certain ones. The abbreviations must be written directly after each other.

thrust(sort y-z+z-)

Blocks are displayed for each type of engine (Ion, Atmo etc.). With the option "summary" the thrust of all engines is summed up.

thrust(summary)

"thrust_e" shows the engine efficiency, the atmospheric engines for example only work in the atmosphere and the higher you get the lower the efficiency of the Atmos.

On planets, the engines can only keep the ship in the air up to a certain mass. To avoid missing the point where the ship is no longer in suspension, there is the "thrust_w" command. Here you can also use "sort xx" to influence the display.
The unit is kilogram and a percentage value greater than 100% indicates that the weight can be held in the corresponding direction.

thrust_e thrust_w


"speed"
With the command "speed" the speed of the ship is displayed.
speed
The type of display can be influenced with the "style" option.
In addition, the display can not only be in "m/s" but also in KmH.
speed(style 3,kmh)
As well as in miles per hour.
speed(style 3,mph)
This combination would also be possible:
speed(style 1,noline) speed(style 1,noline,kmh) speed(style 3,noline,mph)
All three units are then output here.
"writex" and "line"
With "writex" you can display your own text on the LCDs.
This text is written in round brackets and divided into segments.
These segments are separated by commas.
Segments containing only spaces are filled until the line is full.

An example:

writex(Links, ,Rechts)


The empty segments are always filled in equal parts.
This makes it easy to center text.

writex( ,<<< Zentrierter Text >>>, )


You can still include dynamic fields.
These fields have a name and start with "@".

Here is a list of the possible fields:
  • @maingridname
    The name of the grid on which the script is running.
  • @time
    Current real time.
  • @date
    Current date, American format.
  • @dateger
    Current date, German format

example:
writex(@time, ,@dateger) writex( ,Willkommen auf der,@maingridname, )


If you write only one character after "@" and then "(filled)" the Line padded with this character:

example:

writex(@=(filled),Reactors,@=(filled)) reactors(style 3)


You can also display the line only 70% of the width:
writex(,@=(70%),)

If you want to draw a continuous line there is the "line" command.
line

This creates a line with the minus char.
You can also use any other character:
line(*) line(=)
information about docked ships
With the command
dockings
you show all the docks. Which ship has docked and some more information.

The connectors that will act as dockports have to be prepared.
Add to the name of the connectors:

...(sms,dock:xxxx)

xxxx is a short name, for example "Pad Alpha".

You can also display the batteries and the inventory of the docked ship.
batterys[dock:Alpha] inventory[dock:Alpha](all,block)