Terminal Block Manager
Изображение 1 из 2. Материалы автора из Steam Workshop.
О материале
«Terminal Block Manager» — материал мастерской Space Engineers. Моды, чертежи кораблей, скрипты и миры для Space Engineers. Для установки откройте оригинал в Steam Workshop, проверьте требования автора и подпишитесь. Совместимость с версией игры редакцией не проверена.
Описание автора
Introducing
Terminal Block Manager is an ingame script that allows non-programmer players write their own scripts for terminal blocks in a very simple and easy to learn language.
Writing Terminal Block Manager Language script
When TBM script is set up in the programmable block do the next steps:
-
Open needed block in the terminal
-
Click 'Custom data' button
-
Write '[tbm script]' in a first line
Done! Now you can start writing your first script! Read the text below to learn how to do it.
- Script structure
* Single asterisk symbol starts a comment.
* TBML script represents just a list of conditions and
* action lists, like this script for piston block:
WHEN currentPosition = upperLimit DO * Anything below this line is an action list,
SET velocity TO -5 * except the next 'WHEN' block.
when currentPosition = lowerLimit do * All keywords and names are case-insensitive
onoff_off * To execute a terminal action just type its name
* in a new line.
-
Logical expressions Available comparison symbols:
-
equals: '=',
-
not equals: '!=',
-
less: '<',
-
greater: '>',
-
less or equal: '<=',
-
greater or equal: '>='.
-
Simple logical expression structure: .
WHEN radius = 50000 DO
onoff_on
Complex logical expressions are supported too:
WHEN (angle >= upperLimit AND velocity > 0) OR, * Comma symbol allows to complete
(angle <= lowerLimit AND velocity < 0) DO * a long expression in a new line.
SET rotorLock TO TRUE
SET shareInertiaTensor TO TRUE
WHEN (angle < upperLimit AND velocity > 0) OR,
(angle > lowerLimit AND velocity < 0) DO
SET rotorLock TO FALSE
SET shareInertiaTensor TO FALSE
-
Property types There are 4 types of properties in TBML:
-
floating-point number,
-
boolean,
-
rgb color,
-
status.
-
* Comparison floating-point properties:
WHEN angle = 90 DO
SET torque TO 1234.56 * <-- Setting floating-point value
* To check and set boolean properties use 'TRUE' and 'FALSE' keywords:
WHEN handBrake = TRUE DO
SET handBrake TO FALSE * <-- Setting boolean value
WHEN backgroundColor = 0 0 0 DO
SET fontColor TO 255 140 105 * <-- Setting rgb color value
* ^ ^ ^
* | | |
* R G B
* Each color value must be in range from 0 to 255.
* Some blocks have an additional status property,
* like the laser antenna block:
WHEN status = idle DO * Available statuses for this block: 'connected', 'connecting',
connectgps * 'idle', 'outofrange', 'rotatingtotarget',
* 'searchingtargetforantenna'.
* Status property is not available for changing.
- Actions with another blocks/block groups
* If the block/block group name has spaces, type '_' symbol instead.
WHEN DISABLED rotor_1 DO * <-- Checks if block is disabled. There is also similar keyword 'ENABLED'.
ENABLE rotor_1 * <-- Turning on terminal block.
DISABLE spotlights * <-- Turning off block group.
SWITCH interior_lights * <-- Turns on when is disabled and
* turns off when is enabled.
WHEN angle OF rotor_1 >= upperLimit OF rotor_1 DO * 'OF' keyword allows to get
* property from another block.
DISABLE rotorLock
reverse
FOR rotor_1 DO SET rotorLock TO TRUE * 'FOR' keyword executes action
FOR rotor_1 DO resetVelocity * for another block or block group.
FOR interior_lights DO onoff_on * You can execute action or set
FOR interior_lights DO SET intensity TO 5 * property for block group if at
* least one block of this group has
* the specified action/property.
- Additional properties and 'WAIT' command Sometimes it is necessary to get non-terminal property from block for example, current stored power from the battery block. For such cases, there are additional properties for certain blocks. Full list of additional properties you can get here
WHEN currentStoredPower = maxStoredPower DO ONCE
ENABLE interior_light_1
* 'status' is an additional enumerable property for door block.
WHEN status = opening DO * Its value can be 'closed', 'closing', 'opening', 'open'.
ENABLE interior_light_2
WAIT 2.5 * Action list after 'WAIT' command will be
* executed after the specified time.
open_off * <-- closes the door
DISABLE interior_light_2
- 'ONCE' keyword Action list after 'WHEN' block executes each program tick while logical expression is true. If you want these actions to be executed only once time, when condition become true, use 'ONCE' keyword after 'DO' keyword.
WHEN status = extended DO ONCE
FOR rotor_2 DO reverse
-
Checking script for errors To find out if your script has errors, press 'OK' button in custom data editing window. Then press 'Custom data' button again, and in the end of the script you'll see the error log.
-
List of keywords
WHEN <logical expression> DO [[ ONCE ]]
<action list>
<property name> OF <block name>
ENABLED <block name>
DISABLED <block name>
<condition_1> AND <condition_2>
<condition_1> OR <condition_2>
ENABLE <block/block group name>
DISABLE <block/block group name>
SWITCH <block/block group name>
SET <property name> TO <value>
FOR <block/block group name> DO <action>
WAIT <time in seconds>
<action name> [[ `parameter 1` `parameter 2` `parameter 3` `...` ]]
Static mode
In static mode TBML scripts are handling faster. Turn this mode on when all your TBML scripts are ready and don't have errors. NOTE: When this mode is turned on, deleting scripted blocks from grid may cause an error in the programmable block.
Useful links
List of terminal properties and actions you can get here, list of additional properties here. Source code here.
Как установить и запустить
Откройте оригинальную страницу в Steam Workshop, проверьте версию игры, зависимости и порядок загрузки в описании автора. Нажмите «Подписаться» и дождитесь загрузки Steam. Включите материал в меню модификаций или контента игры, если это требуется. Совместимость и запуск редакцией не проверены.