我已经与朋友电子表格对游戏进行了猜测,我想隐藏我从编辑器中编写的代码
我在网上阅读了很多有关此内容的信息,似乎最好的选择是将我的代码制作为附件,所以我尝试了一下并完成了that guide said的所有操作,将附件添加到我的电子表格,但是代码不起作用,不是onEdit而不是Trigger(设置为每小时工作一次)。在chrome网上商店,我认为我做的一切都很好(再次使用该指南),其状态为"draft"或"Published to Testers"没什么区别,its not working!尝试了几个小时才能使其正常工作,但我做不到,我对编码很陌生,并且该项目的规模超出了我的预期,我必须隐藏该代码,不胜感激任何帮助!
这是我的代码:
var colMin = 7;
var minRow = 3;
function onEdit(){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
var range = sheet.getActiveRange();
var currRow = range.getRow();
var currCol = range.getColumn();
if(sheet.getName() == "Bets") {
if(currCol >= colMin && currCol <= getLastCol("Bets") && currRow >= minRow) {
betingRange(sheet, ss, currRow, currCol);
} else if (currCol == 5 && currRow >= minRow) {
dataValBuilder(currRow, sheet.getRange(currRow, 5).getValue());
}
}
if(sheet.getName() == "Players") {
if(currCol == 3) {
.............................. etc...................
..............using some Protection and named ranged commands........
SpreadsheetApp.getActiveSpreadsheet().setNamedRange(player.gamesLogNR, gamesLogSheet.getRange(3,lastColgamesLog+3,1000));
SpreadsheetApp.getActiveSpreadsheet().addEditor(player.email);
var protection = rangePro.protect().setDescription(player.name+" betting area, player id: "+player.id);
protection.setRangeName(player.betsNR);
protection.removeEditors(protection.getEditors());
if (player.email.length > 5) {
protection.addEditor(player.email);
}
}
.......... etc...........
.......timesup is the Trigger function (works hourly)............
function timesUp() {
var betsScore = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("betsScoreHolder");
var listsSheet = .......ETC........
} else {
SpreadsheetApp.getActiveSpreadsheet().setNamedRange("rowsBlock", betsSheet.getRange(3, 7, (n+1)-3, betsLastCol-6));
}
}
break;
}
}
}
同样,带有我的代码的附加组件已经安装到电子表格中,但是它的行为不像脚本编辑器中的代码,这意味着它根本无法正常工作。
请帮助。