Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.10 KB | None | 0 0
  1. var ss = SpreadsheetApp.getActiveSpreadsheet();
  2.  
  3. function resetList() {
  4. var todoSheet = ss.getSheetByName("todo list");
  5. var today = new Date();
  6. var todoList = [
  7.  
  8. new Array(new Array(0, 1, 2, 3, 4, 5, 6),
  9. new Array("Check AH stuff", "SOLDIERDREAM")),
  10.  
  11. // TEMPLATE
  12. // new Array(new Array(0, 1, 2, 3, 4, 5, 6),
  13. // new Array("Check AH stuff", "SOLDIERDREAM")),
  14. // Copy the above for each new item you want to add to the to do list.
  15. // Each number corresponds to a day of the week you want the item to appear.
  16. // The first item on the second line, "Check AH Stuff", in the example, will be added to the left column.
  17. // Any following items in that array will be written on the right column next to that task.
  18. // Remember to follow the structure strictly and put commas and quotation marks where appropriate.
  19.  
  20. ];
  21.  
  22. todoSheet.getRange('A1:B'+todoSheet.getMaxRows()).setValue("");
  23. var row = 1;
  24. for (var i=0; i<todoList.length; i++){
  25. var doToday = false;
  26. for (var j=0; j<todoList[i][0].length; j++){
  27. if (todoList[i][0][j]==today.getDay()){
  28. doToday = true;
  29. }
  30. }
  31. if (doToday){
  32. todoSheet.getRange('A'+row).setValue(todoList[i][1][0]); //Event
  33. for (var k=1; k<todoList[i][1].length; k++){
  34. todoSheet.getRange('B'+row).setValue(todoList[i][1][k]);
  35. row++;
  36. }
  37. }
  38. }
  39. }
  40.  
  41.  
  42. function countHells() {
  43. var hellSheet = ss.getSheetByName("hell log");
  44. var row = 5;
  45. var column = 'A';
  46. var hellCount = 0;
  47. var epicCount = 0;
  48. var orbCount = 0;
  49. var hellTotal = 0;
  50. var epicTotal = 0;
  51. var orbTotal = 0;
  52. while (hellSheet.getRange(column + '1').getValue()!=''){
  53. while (hellSheet.getRange(column+row).getValue()!=''){
  54. if (hellSheet.getRange(column+row).getValue()=='.'){
  55. row++;
  56. hellCount++;
  57. continue;
  58. }
  59. if (hellSheet.getRange(column+row).getValue()=='orb'){
  60. row++;
  61. hellCount++;
  62. orbCount++;
  63. continue;
  64. }
  65. row++;
  66. hellCount++;
  67. epicCount++;
  68. }
  69. hellSheet.getRange(column + '2').setValue(hellCount + " hells");
  70. hellSheet.getRange(column + '3').setValue(epicCount + " epics");
  71. hellSheet.getRange(column + '4').setValue(orbCount + " orbs");
  72. row = 5;
  73. column = nextChar(column);
  74. hellTotal = hellTotal + hellCount;
  75. epicTotal = epicTotal + epicCount;
  76. orbTotal = orbTotal + orbCount;
  77. hellCount = 0;
  78. epicCount = 0;
  79. orbCount = 0;
  80. }
  81. hellSheet.getRange(column+'2').setValue("Total");
  82. column = nextChar(column);
  83. hellSheet.getRange(column+'2').setValue("Runs: " + hellTotal);
  84. hellSheet.getRange(column+'3').setValue("Epics: " + epicTotal);
  85. hellSheet.getRange(column+'4').setValue("Orbs: " + orbTotal);
  86. column = nextChar(column);
  87. hellSheet.getRange(column+'3').setValue(epicTotal / hellTotal * 100 + '%');
  88. hellSheet.getRange(column+'4').setValue(orbTotal / hellTotal * 100 + '%');
  89.  
  90. }
  91.  
  92. function nextChar(c) {
  93. return String.fromCharCode(c.charCodeAt(0) + 1);
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement