PsyOps

LvzControl

Jan 20th, 2013
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.97 KB | None | 0 0
  1.         private string BaseCommand = "*objset ";
  2.  
  3.         public string BZBux_LVZ(double newscore, double oldscore)
  4.         {
  5.             string LvzCommand = BaseCommand;
  6.             int[] display = new int[] {0,10,20,30,40,50,60,70,80};
  7.  
  8.             int new_score = (int)(newscore * 100);
  9.             int old_score = (int)(oldscore * 100);
  10.  
  11.             char[] converted = (new_score.ToString().PadLeft(9,'0')).ToCharArray();
  12.             char[] old_converted = (old_score.ToString().PadLeft(9, '0')).ToCharArray();
  13.  
  14.             for (int i = 0; i < 9; i++)
  15.             {
  16.                 int old_digit = (display[i] + int.Parse(old_converted[i].ToString()));
  17.                 int new_digit = (display[i] + int.Parse(converted[i].ToString()));
  18.  
  19.                 if (old_digit != new_digit)
  20.                 {
  21.                     LvzCommand = LvzCommand + "+" + new_digit + ",-" + old_digit + ",";
  22.                 }
  23.             }
  24.  
  25.             return LvzCommand;
  26.         }
Advertisement
Add Comment
Please, Sign In to add comment