Space Engineers

Space Engineers

Not enough ratings
ingame Script "Multi Lcd Config" manual
By Twotwinbrothers
This is the manuel for "Multi Lcd Config" by Twotwinbrothers
   
Award
Favorite
Favorited
Unfavorite
Introduction
This Script is a manual for a Ingame Script:
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=591992801

This Script allow you to change between Text, texture, font color, font size, etc.
In this Manual i try to explain how to adjust every slider on a text panel with the programmable block ,timers and how to run an other programmable block whit Argument

A little knowledge of scripting is useful, This is not a plug en play script
You have to modify it to youre needs.

Code are marked like this
Thing to change in code are Underlined

enjoy.

Twotwinbrother
Getting started
This is a line where you can change the name for "argument."

arg = abbreviation for "argument"

void Main(string arg){

Next part of code is for adding/remove a item name to all connected block (exp. blocks that have not the same ownership) This will prevent that two block with the same name on separate grids when connected will act as one.

Example:

Two seperate grids that can be connected.( ship and station)
One has a block called "door".
Second has a block also called "door" .
Wen conected you dont want that both doors to open at the same time

  • Disconnect connector
  • Change "[STATION] " in how you wand to name your item
  • Wen jou run this script with argument "install" it will add "[STATION] " to all connected blocks
  • Wen jou run this script with argument "uninstall" it will remove "[STATION] " to all connected blocks when it is part of its name
string itemname = "[STATION] "; // station/ship name. if you don't wan to use, remove everyting between Qoutes // instal Itemname List<IMyTerminalBlock> listl = new List<IMyTerminalBlock >(); GridTerminalSystem.GetBlocksOfType<IMyTerminalBlock>(listl); for(int i = 0; i < listl.Count; i++){ IMyTerminalBlock term = listl as IMyTerminalBlock;

if(arg == "instal"){
if(!term.CustomName.Contains(itemname) ){
term.CustomName =(itemname + term.CustomName);
Echo (term + " installed");
}}
if(arg == "uninstal"){
if(term.CustomName.Contains(itemname) ){
term.CustomName = (term.CustomName.Replace (itemname,"" ));
Echo (term + " uninstalled");
}}}

How do you build you code
There are two way to cal a lcd
  1. Whit a tag.use "Cal lcd whit tag" code
  2. Whit its full name. use "Cal lcd whit name" (This wil limets the things you can change, but is easyer to use)
whit tag i call my lcd this way :
lcd [0] [1]
lcd [0] [2]
lcd [0] [3]
"lcd" you can change to everything. Can be same so long there is a diference in the tag thay have

[0] tag can be use wen you want to change te same thing on all the lcd. don't use it to change the name.
other tag are only for the lcd that have the tag
Cal Block with tag
  • Change "list" in:
    "list0" for tag [0]
    "list1" for tag [1]
  • Change "IMyTextPanel" in :
    "IMyTimerBlock" for Timers
    "IMyProgrammableBlock" for PB
  • Change "lcd"
  • Between " " is the tag
List<IMyTerminalBlock> list = new List<IMyTerminalBlock>(); GridTerminalSystem.GetBlocksOfType<IMyTextPanel>(list); for(int i = 0; i < list.Count; i++){ IMyTextPanel lcd = list as IMyTextPanel;

if(lcd.CustomName.Contains(itemname)){ //"itemname" is specified on top of script
if(lcd.CustomName.Contains("[0]")){ [/code]
Cal Block with name
  • Change "lcd" in:
    Pb for Programmeble Block
  • put the full name of the block between " "
  • Change "IMyTextPanel" in:
    "IMyTimerBlock" for Timers
    "IMyProgrammableBlock" for PB
  • In the argument list, use a "?" After lcd, this will prevent script crash when block is missing.
IMyTextPanel lcd = GridTerminalSystem.GetBlockWithName(itemname+"Center [LCD]") as IMyTextPanel; if (lcd == null){Echo(No +itemname+"Center [LCD]");} //this will check of the block is there lcd?.ApplyAction("OnOff_On");

Lot of the code line cannot be used wen you cannot change te name,
keep that in mind wen u use this one
how to make arg list
  • First arg line begins whit "if" the next "else if"
  • "1" = the arg you put under youre butten.
  • "1" = after "Echo" is argument name this will be shown "DetailedInfo" box in the terminal menu
if( "1".Equals(arg) ){ lcd.WritePublicTitle("power"); Pb?.TryRun("') // add "?" if you use "Call Block with name" this prevent script crash Echo("1"); } <-------------------------------------------- dont forget to close else if( "2".Equals(arg) ){ Echo("2"); }

Function for Terminal Block
OnOff | OnOff_0n | OnOff_0ff
  • "term" = Change name in how it will called in script
  • change: OnOff
    action name
    explanation
    "OnOff"
    will turn on wen off en off wen on
    "OnOff_On"
    will turn on
    "OnOff_Off"
    will turn off
term.ApplyAction("OnOff");

Show in Terminal
  • "term" = Change name in how it will called in script
  • change: true
    action name
    explanation
    true
    ShowInTerminal on
    false
    ShowInTerminal off
term.ShowInTerminal=true;
ShowInInventory
ShowInInventory only exist if block have an inventory

  • "term" = Change name in how it will called in script
  • change: true
    action name
    explanation
    true
    ShowInInventory on
    false
    ShowInInventory off
term.ShowInInventory=true;
ShowInToolbarConfig
  • "term" = Change name in how it will called in script
  • change: true
    action name
    explanation
    true
    ShowInToolbarConfig on
    false
    ShowInToolbarConfig off
term.ShowInToolbarConfig=true;
Change Name
  • "name" can be change to everything
  • after the name are the tags

lcd.CustomName = (itemname +"name [0] [1] [LCD]");

This way you can remove a tag and replaced it.
It is sometimes necessary to turn off a script on a LCD

This code will not work wen you use "Cal lcd whit name" code, because it wil change the name of lcd
ShowOnHUD
  • "term" = Change name in how it will called in script
  • change: true
    action name
    explanation
    true
    ShowOnHUD on
    false
    ShowOnHUD off
term.ShowOnHUD=true;
Write CustomData
Write CustomData

  • "Me" = Change name in how it will called in script
  • center power \n Power; Powertime; = This is the text that the script write in you text panel customdata box.
  • " \n " = End Command And/or Enter ( next line)
  • "; " = End Command

Me.CustomData = ("center power \n Power; Powertime; ");

Add to CustomData

  • "Me" = Change name in how it will called in script
  • "text" = text that you want to add

Me.CustomData = (Me.CustomData+"text ");


Replace / Remove to CustomData

  • "Me" = Change name in how it will called in script
  • "text 1" = text to replace/remove.
  • "text 2" = text to replace/remove in. remove everthing between quotes to remove

Me.CustomData.Replace("text 1 ", "text 2 ");


I use it al lot whit "MMaster Configurable Automatic LCDs V.2
Extra Function for PB
Run Agument
  • "PBalert" = Change name in how it will called in script
    "PBalert" in "Me" = to run the programmeble where this script is running on
  • "Green" = Place here the arg
PBalert.TryRun("green");
Run PB without Timer
Add code
Program(){ Runtime.UpdateFrequency=UpdateFrequency.Update1;}
Before
void Main(string arg){ }
Exrta function for Timer
start | stop | TriggerNow | IncreaseTriggerDelay | DecreaseTriggerDelay
  • "Tsaver" = Change name in how it will called in script
  • change:
    action name
    explanation
    "Start"
    will start after set time
    "Stop"
    will stop
    "TriggerNow"
    will trigger
    "IncreaseTriggerDelay"
    Increase Delay
    "DecreaseTriggerDelay"
    Decrease Delay
Tsaver.ApplyAction("Start");

TriggerDelay
  • "Tsaver" = Change name in how it will called in script
  • "10f" = Place a number between 1f t/m 3600f
    1f = 1 sec.
    60f = 1 min.
    3600f = 1 hour. [max time whit Vannilla)
Tsaver.SetValue("TriggerDelay", 10f );
Exrta function for Textpanel / LCD
Write Public Title
  • "lcd" = Change name in how it will called in script
  • "Power" = This is the command that the script write in
    you text panel Public Title box.
    I use it al lot whit "MMaster Configurable Automatic LCDs V. 1"

lcd.WritePublicTitle("Power");


will not work whit "MMaster Configurable Automatic LCDs V.2"
because i will only use "customdata"
Write Public Text
  • "lcd" = Change name in how it will called in script
  • "hello bye" = This is the text that the script write in you text panel Public text box.
    can not use it whit "MMaster Configurable Automatic LCDs" on remove "LCD" tag
  • "\n" = next line

lcd.WritePublicText("hello \n bye");

write PublicText whit CustomData
  • "lcd" = Change name in how it will called in script
  • "Me" = make it "lcd" if you want it to take it from Customdata of the same lcd
    "Me" wil take from this Programmeble block

lcd.WritePublicText(Me.CustomData);

can not use it whit "MMaster Configurable Automatic LCDs" on,
Remove [LCD] tag first whit "Change Name" code
Show text to picture
  • "lcd" = Change name in how it will called in script
  • ShowTextureOnScreen() Change:
    Public text = ShowPublicTextOnScreen();
    textures = ShowTextureOnScreen();
lcd.ShowTextureOnScreen();
can not use it whit "MMaster Configurable Automatic LCDs" on, it wil simple overwrite it
Remove [LCD] tag first whit "Change Name" code
Font
  • "lcd" = Change name in how it will called in script
  • "Monospace" = Change name to Font name
lcd.Font="Monospace" );

Font Size
  • "lcd" = Change name in how it will called in script
  • "1.0f" = Change Font size 0.1 t/m 10.0
lcd.FontSize=1.0f ;

Font Color
  • "lcd" = Change name in how it will called in script
  • "255, 255, 255" = Change Font color 0 - 255
    Wit = 255, 255, 255
    Bleu = 0, 0, 255
    Red = 255, 0, 0
    Green = 0, 255, 0
    Bleu = 0, 0, 255
lcd.FontColor=new Color(255, 255, 255);

BackGround Color
  • "lcd" = Change name in how it will called in script
  • "255, 255, 255" = Change Font color 0 - 255
    Black = 0, 0, 0
    Wit = 255, 255, 255

lcd.BackgroundColor=new Color(255, 255, 255);

Add image to selection
  1. place all the textures above: "void Main(string arg)" like: string[] arrow = {"Arrow", "Cross" };

    • "textures" = Chance name of the string.
    • "Arrow" = first texture that will be shown
    • place comma space ", " between the two texture names
    • "Cross" = second Texture
    string[] textures = {"Arrow", "Cross" }; void Main(string arg){ }


    // Vannila Texture list string[] Online = {"Online"}; string[] Offline = {"Offline"}; string[] Arrow = {"Arrow"}; string[] Cross = {"Cross"}; string[] Danger = {"Danger"}; string[] NoEntry = {"No Entry"}; string[] Construction = {"Construction"}; string[] Whitescreen = {"White screen"};

  2. place in arg list. ( these line can be put in the "[0]" tag so it will be done to all the lcd.)
    lcd.ClearImagesFromSelection(); <-- Removes al the Textures lcd.SetShowOnScreen(Sandbox.Common.ObjectBuilders.ShowTextOnScreenFlag.NONE); lcd.SetValue("ChangeIntervalSlider", 0.1f ); <-- will change the Interval time

    Don't put the following lines in Tag that are used in more then one lcd (example "[0]" tag )

    lcd.SetCustomName("Left [0] [1]"); <-- dont forget remove the [LCD] tag
    • "arrow" = Place the String name
    • "false" = dont change in "true" give a lot of problems like:
      Interval freese
      Remove of texture wen thay alreade are there
    • "lcd" = Change name in how it will called in script
    target = new List <string>(arrow); lcd.AddImagesToSelection(target, false);
Remove all image
  • "lcd" = Change name in how it will called in script
lcd.ClearImagesFromSelection();
Live Camera Feeds
There is a mod :
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=611332581
it make camera textures,
there i s a little problem whit it, that is that the id is so long that you can see the whole name.

so if you want to change between feeds there is a work around:
  1. place the textures manuely in textpanel
  2. make two buttens:
    Button 1 : Run PB multi whit arg " 6 " (without quotes)
    Button 2 : Run PB multi whit arg " 7 " (without quotes)
  • arg "6" will change interval time to 2 sec.
  • arg "7" will change interval time to 0 sec. ( there is no interval.)
Wen the feed you want to see is there you puch on the butten whit arg "7".
then it wil stay on that feed.
// lcd whit tag = [Cam] List<IMyTerminalBlock> listcam = new List<IMyTerminalBlock>(); GridTerminalSystem.GetBlocksOfType<IMyTextPanel>(listcam); for(int i = 0; i < listcam.Count; i++){ IMyTextPanel lcd = listcam as IMyTextPanel;

if(lcd.CustomName.Contains(itemname)){
if(pblcd.CustomName.Contains("[cam]")){

if( "6".Equals(arg) ){
lcd.SetValue("ChangeIntervalSlider", 2.0f );
}
else if( "7".Equals(arg) ){
lcd.SetValue("ChangeIntervalSlider", 0.0f );
}
}}