Created
May 13, 2019 23:00
-
-
Save seronis/263ebdde6e1cc182b00381cdb629b42d to your computer and use it in GitHub Desktop.
Space Engineers Scripting Tutorial Scenario - Updated Code for 1st Tut
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// the '@' allows to assign a multiple line text between quotes to a string variable, | |
// you wont need it for a simple hello world! but it might be worth noting. | |
string myNewInstructions = @" | |
Part 1: (continuation) | |
-------------------- | |
Well done! | |
As you can see the existing script changed the text of this panel. | |
The door behind you is closed, to open it the console panel's text | |
has to contain exactly the following words in that order: Hello World! | |
Step 2: open the programmable block and click on 'Edit' then read/modify the existing | |
script to make that happen. | |
Step 3: Run the script again and go to Part 2. | |
"; | |
void Main() | |
{ | |
var console = GridTerminalSystem.GetBlockWithName("Wide LCD Panel") as IMyTextPanel; | |
if (console != null) | |
console.WriteText(myNewInstructions); | |
} | |
/*******************************************************************************************************\ | |
Additionnal notes: | |
Important points to note about the API: | |
The Main function has to be present in the script it is called every time your | |
script is runned this is your program entry point. | |
GridTerminalSystem is the object that allows you to get the blocks from your | |
terminal with different methods. | |
GetBlockWithName is one of these method and it will return the first block using | |
the given name. | |
The blocks are usually returned with a generic type and they have to be casted | |
to their proper type so that you can use them accordingly, IMyTextPanel is the | |
type you want to use for every LCD or text Panels for exemple. | |
Names to remember: | |
Main, GridTerminalSystem, GetBlockWithName, IMyTextPanel. | |
\*******************************************************************************************************/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment