Advertisement
Guest User

Untitled

a guest
Feb 21st, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.96 KB | None | 0 0
  1.  
  2. List<Color> GO_LCD_TextCol = new List<Color>() {
  3.     new Color(255,0,0),
  4.     new Color(0,255,0),
  5.     new Color(255,255,0),
  6.     new Color(255,0,255)
  7. };
  8.  
  9.  
  10. public Program()
  11. {
  12.   Runtime.UpdateFrequency = UpdateFrequency.Update1 | UpdateFrequency.Update100;
  13. }
  14. long lCount=0;
  15.  
  16. public void Main(string argument,UpdateType ut) {
  17.  
  18.  
  19.     Echo(ut.ToString());
  20.     Echo(argument);
  21.     if ((ut & (UpdateType.Update1 | UpdateType.Update10 | UpdateType.Update100)) > 0)
  22.     lCount++;
  23.     Echo(lCount.ToString());
  24.     Echo("Before=" + Runtime.UpdateFrequency.ToString());
  25.     doshiz("AirVent03");
  26.     if ((ut & (UpdateType.Terminal | UpdateType.Trigger)) > 0)
  27.     {
  28.                 if (argument == "1")
  29.                 {
  30.                     Runtime.UpdateFrequency |= UpdateFrequency.Update1;
  31.                     Echo("Turn On Update1");
  32.                 }
  33.                 else if (argument == "10")
  34.                 {
  35.                     Runtime.UpdateFrequency |= UpdateFrequency.Update10;
  36.                     Echo("Turn On Update10");
  37.                 }
  38.                 else if (argument == "100")
  39.                 {
  40.                     Runtime.UpdateFrequency |= UpdateFrequency.Update100;
  41.                     Echo("Turn On Update100");
  42.                 }
  43.                 else if (argument == "once")
  44.                 {
  45.                     Runtime.UpdateFrequency |= UpdateFrequency.Once;
  46.                     Echo("Turn On Once");
  47.                 }
  48.                 else if (argument == "none")
  49.                 {
  50.                     Runtime.UpdateFrequency = UpdateFrequency.None;
  51.                     Echo("Set None");
  52.                 }
  53.  
  54.                 else if (argument == "!1")
  55.                 {
  56.                     Runtime.UpdateFrequency &= ~UpdateFrequency.Update1;
  57.                     Echo("Turn Off Update1");
  58.                 }
  59.                 else if (argument == "!10")
  60.                 {
  61.                     Runtime.UpdateFrequency &= ~UpdateFrequency.Update10;
  62.                     Echo("Turn Off Update10");
  63.                 }
  64.                 else if (argument == "!100")
  65.                 {
  66.                     Runtime.UpdateFrequency &= ~UpdateFrequency.Update100;
  67.                     Echo("Turn Off Update100");
  68.                 }
  69.                 else if (argument == "!once")
  70.                 {
  71.                     Runtime.UpdateFrequency &= ~UpdateFrequency.Once;
  72.                     Echo("Turn Off Once");
  73.                 }
  74.  
  75.         Echo("After=" + Runtime.UpdateFrequency.ToString());
  76.     }
  77.  
  78.  
  79. }
  80.  
  81.  
  82. /*
  83. *   Set
  84. */
  85. public bool doshiz(string whichvent) {
  86.  var vent = GridTerminalSystem.GetBlockWithName( whichvent ) as IMyAirVent;
  87.     var lcd = GridTerminalSystem.GetBlockWithName( "TESTLCD1" ) as IMyTextPanel;
  88.    VentStatus myvent;
  89.    myvent=vent.Status;
  90. Echo (myvent.ToString());
  91.     if( vent != null & lcd != null ) {
  92.        
  93.        
  94. string outstr;
  95. outstr=vent.CustomName +" 0utput: "+ (100 * vent.GetOxygenLevel() ).ToString( "#0.00" ) +"%" +"\n Atmosphere: "+ myvent.ToString() ;      
  96. outstr+="\nPSi: "+ ((100 * vent.GetOxygenLevel()) / 6.79).ToString("#0.00");
  97.  SetLCD2( "TESTLCD1", outstr );
  98.  SetLCD2( "TESTLCD2", outstr );
  99.  
  100.         Echo( "LCD Set" );
  101.  
  102.     } else {
  103.         Echo( "Block Not Found. Check Names" );
  104.     }
  105.  
  106.     return false;
  107. }
  108.  
  109.  
  110. public bool SetLCD2(string mylcd, string mystr) {
  111. IMyTextSurface surface = GridTerminalSystem.GetBlockWithName(mylcd) as IMyTextSurface;
  112. if (surface != null)
  113. {
  114.     Echo("Surface panel found");
  115.  
  116.     surface.ContentType = ContentType.SCRIPT;
  117.     using (var frame = surface.DrawFrame())
  118.     {
  119.         MySprite test = MySprite.CreateText(mystr, mystr, new Color(1.0f), 1.3f, TextAlignment.CENTER);
  120.  
  121.         frame.Add(test);
  122.     }
  123. }
  124. else
  125. {
  126.     Echo("No surface panel found");
  127. }
  128. return true;
  129. }
  130.  
  131. public bool SetLCD3(string mylcd, string mystr) {
  132. var console = GridTerminalSystem.GetBlockWithName(mylcd) as IMyTextPanel;
  133.     if (console != null)
  134.     console.WriteText("someWords");
  135. return true;
  136. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement