Space Engineers

Space Engineers

145 个评价
Terminal Block Manager
2
   
奖励
收藏
已收藏
取消收藏
标签: other_script
文件大小
发表于
更新日期
521.038 KB
2018 年 1 月 23 日 上午 5:17
2023 年 10 月 2 日 上午 9:22
19 项改动说明 ( 查看 )

订阅以下载
Terminal Block Manager

描述
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:
  1. Open needed block in the terminal
  2. Click 'Custom data' button
  3. 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.

  1. 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.

  2. Logical expressions
    Available comparison symbols:
    • equals: '=',
    • not equals: '!=',
    • less: '<',
    • greater: '>',
    • less or equal: '<=',
    • greater or equal: '>='.
    Simple logical expression structure: <property> <comparison symbol> <value>.
    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
  3. 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.
  4. 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.
  5. 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[drive.google.com]
    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
  6. '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
  7. 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.
  8. 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[www.spaceengineerswiki.com],
list of additional properties here[drive.google.com].
Source code here[drive.google.com].
热门讨论 查看全部(2)
43
2021 年 3 月 30 日 上午 3:14
Bug reports
Handagotes
7
2020 年 7 月 27 日 上午 8:09
Share your script with others
Handagotes
99 条留言
Lyr4nx 2023 年 11 月 5 日 下午 12:51 
A big thank you for this script!
Handagotes  [作者] 2023 年 10 月 2 日 下午 5:52 
My bad. Now it's fixed.
john72934 2023 年 10 月 1 日 下午 6:08 
Still getting the same error as Rust Droid
(IMyTextPannel not contain "ShowText")
Handagotes  [作者] 2023 年 9 月 25 日 上午 10:12 
Sorry for delay, the Issue should be fixed now.
Rusted Droid 2023 年 9 月 15 日 上午 8:12 
Just heads up for Recent SE change that make script to error with
(IMyTextPannel not contain "ShowText")
Delphin_1 2022 年 10 月 8 日 下午 4:29 
this is awsome!
Rusted Droid 2022 年 9 月 17 日 上午 2:38 
Do this update make handling arguments to programing block more easy?
Zaƒlow 2022 年 9 月 16 日 下午 9:27 
This is a great idea!
Tronix 2022 年 2 月 19 日 上午 6:59 
I love u man!!! :D :D :D Working fine! BIG TY!
Handagotes  [作者] 2022 年 2 月 19 日 上午 3:06 
@Tronix I made fixes for argument handling in the last update. Now you need to enclose argument with ` symbol, like this: FOR Computer_[3D_Map] DO RUN `NEXT_PLANET 3`