Space Engineers Programming 101 - Sleepless OS - Part 4

preview_player
Показать описание
Welcome to a new programming series on Space Engineers! In these videos I hope to explain & learn how to create some cool scripts using the programmable block in Space Engineers, I hope you all enjoy it! :)

Steam Script Download Links:

You can get the game on from its website below or from Steam

Disclaimer:
Space Engineers is property of Keen Software House
Рекомендации по теме
Комментарии
Автор

Well probably easiest way to make scrolling is to change blockItems from string to List<String> and add each line to it separatly, then make an int skipLines variable and put it as initial value for for loop that prints the list to screen. Update skipLines using "Up" and "Down" button and/or timer.

wsgthebg
Автор

Scrolling can get weird on the logic side of things. Depending on if you want the data to auto roll over at the end, scroll forward backward etc. Then there is the part of what if the data changes and new lines are added?

I'm getting the amount of lines on the screen based on the font size, then dividing 17.6 by the font size and casting it as an int. 17.6 is the magic number for the current font used in SE.
[code]
float fltFontSize =
int intLinesPerScreen = (int)(17.6/fltFontSize);
[/code]

I'm doing scrollers looped and non looped that blindly take data updates. I split the data to be displayed, by new lines \n, into an array. Then check the length of the array vs the lines per screen. I keep a counter outside of the method to keep track of what line I'm on, then have it reset that counter when the scroll is complete.
[code]
string[] arrData = strData.Split('\n');
int intDataLength = arrData.Length;
[/code]


With that class you can do something like the following, and copy and paste the class which will add the "Welcome To SleeplessOS v0.01" to the top then allow you to create two buttons with the arguments scrollup and scrolldown.

ClapYoFace CYF = new ClapYoFace(true);
const string DISPLAYNAME = "LCD Panel";
void Main(string argument)
{
    if(!CYF.SetDisplay(DISPLAYNAME, return;}
    CYF.SetDisplayConfig();
    string strDataToBeDisplayed = LoremIpsum(); // Add your string that gets displayed here
    strDataToBeDisplayed =
    if
        strDataToBeDisplayed = CYF.Scroll(strDataToBeDisplayed, -1, CYF.AlignCenter("Welcome To SleeplessOS v0.01"));
    else
        strDataToBeDisplayed = CYF.Scroll(strDataToBeDisplayed, 1, CYF.AlignCenter("Welcome To SleeplessOS v0.01"));
    else
        strDataToBeDisplayed = CYF.Scroll(strDataToBeDisplayed, 0, CYF.AlignCenter("Welcome To SleeplessOS v0.01"));
  
}

thephil
Автор

Do you need a 6.4 bit system because I'm having problems with my computer even if I have 3GB of space and I have a graphic card and windows 7 it just crashes or it exits PLZ HELP

paulkinky