Welcome to Keen Software House Forums! Log in or Sign up to interact with the KSH community.
  1. You are currently browsing our forum as a guest. Create your own forum account to access all forum functionality.

API or example script for the new LCD?

Discussion in 'Programming (In-game)' started by whiskeyfur, Apr 9, 2019.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. whiskeyfur Trainee Engineer

    With the new update, 6 different possible LCD's in cockpits, 2 on the programmable blocks... heck knows how many more are out there.

    So the question is how to access each of them?

    For example, I want to set up one of the LCD's in a friendly fighter to list the heading/pitch change to point to the nearest enemy, as locked onto by one of it's turrets.

    I'm not asking for the turret to LCD code, I'm asking for the actual code that references the LCD itself in the cockpit.
    --- Automerge ---
    And I'm a total block head.. I just had to explore the API a bit thanks to an autogenerated API listing.

    List<IMyTerminalBlock> blocks = new List<IMyTerminalBlock>();
    IMyTextSurfaceProvider c = blocks[0] as IMyCockpit;
    for (int x = 0; x < c.SurfaceCount; x++) {

    Thank you Malware at https://github.com/malware-dev/MDK-SE/wiki/Api-Index
  2. DMOrigin Trainee Engineer

    Also you can use sprites to draw text. Inside the namespace VRage.Game.GUI.TextPanel you find the class MySprite. With the method MySprite.CreateText it is possible to create a sprite that contain a string. Simple example:

    IMyTextSurface surface = GridTerminalSystem.GetBlockWithName("TestPanel") as IMyTextSurface;
    if (surface != null)
    	Echo("Surface panel found");
    	surface.ContentType = ContentType.SCRIPT;
    	using (var frame = surface.DrawFrame())
    		MySprite test = MySprite.CreateText("Test", "Debug", new Color(1f), 2f, TextAlignment.CENTER);
    	Echo("No surface panel found");

    Also it is possible to use predefined sprites. The following example places an Arrow in the middle of the screen.
    MySprite icon = new MySprite(SpriteType.TEXTURE, "Arrow", size: new Vector2(50f, 50f), color: new Color(1f));
    icon.Position = surface.TextureSize / 2f + (new Vector2(50f) / 2f);
    If the type of a sprite is set to TEXTURE instead of TEXT the Data property contain a path to a dds file. In the directory "steamapps\common\SpaceEngineers\Content\Textures\Sprites\" there are some predefined sprites. But I miss the option to place my own sprites inside a script. Is there a way to do it?
  3. Menjira Trainee Engineer

    Does anyone else have problems with the new Displays on Dedicated Servers? I cant get them to update.
    In Singleplayer i can use them just like a normal LCD, but if im using the Cockpit Displays, i need to rejoin the Server to see the new message. Same for 2 friends im playing with.
    I can read the new texts with GetText(), but i cant see them in World until i rejoin.
    Is this a server config problem or is there a problem with the Displays?

    (sorry for my bad english)
  4. shortybsd Trainee Engineer

    Yes and still is an issue in Multiplayer, 3 months later ;)
  5. Steamzhou Trainee Engineer

    Hi, do you guys know where I can find those .dds file for Sprites? I could on find them in this folder:"%steam%\steamapps\common\SpaceEngineers\Content\Textures\Sprites\" but some of the sprites such as "IconOxygen" or "IconTemperature" are not there.
Thread Status:
This last post in this thread was made more than 31 days old.