我正在创建一个棋盘游戏,为此我决定选择 Google 表格。我已将我的问题简化为一个由一张纸和一个脚本组成的最小示例。
以下几点参考我的骰子表:
DICEFACES应用于范围E2:I2和E10:I10的函数的结果。
DICEFACES是我在Code.gs与样式表关联的文件中的脚本编辑器中创建的自定义函数。它返回与提供范围内的骰子对应的骰子面矩阵。它的身体如下:
function DICEFACES(unused_ref_to_range_containing_dices)
{
var app = SpreadsheetApp;
var spr = app.getActiveSheet();
// In the end this array will hold the dice faces. For example two
// 1d6 dices would result in …Run Code Online (Sandbox Code Playgroud)google-sheets google-apps-script custom-function google-sheets-formula