Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[Tool] SmartAoE Script Generator

July 06 (2 years ago)

Edited August 08 (2 years ago)

Hello awesome people!

I have created a SmartAoE Script Generator in Google Sheets to automate the task of creating scripts for spells. Just fill out the options (the help text on the right side auto updates and will check for the majority of conflicts with settings), and click the Generate button and you're done! This was mainly created to simplify the process of creating a SmartAoE and to make it easier for newcomers to get up and running more quickly.

>> Link to the Original SmartAoE Thread <<

Step 1:
>> SmartAoE Script Generator Sheet <<
Click the link ^, then create a copy of the sheet. This is under File >> Make a copy

Step 2:
The script below needs to be added to the copied sheet in order to format the output text properly (and for the Generate button to work). This is done by selecting "Extensions" >> "Apps Script".
Then copy/paste the following:

function updateCodeSheet() {
  var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
 
  // Get the sheets
  var cleanSheet = spreadsheet.getSheetByName("Clean");
  var codeSheet = spreadsheet.getSheetByName("Code");
 
  // Get the data
  var cleanData = cleanSheet.getRange("W:W").getValues();
  var codeData = codeSheet.getRange("A:A").getValues();
 
  // Array to hold the new data for the Code sheet
  var newData = [];
 
  // Loop through the data in the Clean sheet
  for (var i = 0; i < cleanData.length; i++) {
    if (cleanData[i][0] === "  --dc|{selected|spell_save_dc}" || cleanData[i][0].startsWith("  --radius|")) {
      // Add a blank cell before the matched cell to newData array
      newData.push([""]);
      newData.push([cleanData[i][0]]);
    } else if (cleanData[i][0] !== "") {
      // Add non-blank and non-matched cells to newData array
      newData.push([cleanData[i][0]]);
    }
  }

  // Clear old data from the Code sheet starting from row 3
  codeSheet.getRange(3, 1, codeData.length - 2, 1).clearContent();

  // Add the new data to the Code sheet starting from row 3
  codeSheet.getRange(3, 1, newData.length, 1).setValues(newData);
}

Step 3:
You'll then need to right click the generate button, select the 3 dots on the side and click "Assign script". The name of the script to assign should be "updateCodeSheet" without the quotes. See graphic below for more info!


Gif instructions for Step 3

Step 4:
Fill out the data you'd like to include on the Clean sheet, and click the Generate button. Your code will appear on the Code sheet. Then just copy/pasta into roll20 and you're done!

There a few things on the to do list for this: Most of the options that support HTML are currently hardcoded instead of offering options (because there are a lot of possibilities). This will be updated to allow for greater specificity as soon as I get a little more free time. Please let me know if anything is busted - I should have 95%+ of the bugs worked out.

Thank you David M. for your amazing SmartAoE script! 
-Xen

July 22 (2 years ago)

Bold of you to think that you'll ever remove all the bugs from something. But I appreciate the effort you seem to have put into this.

August 02 (2 years ago)


Dyanosis said:

Bold of you to think that you'll ever remove all the bugs from something. But I appreciate the effort you seem to have put into this.


It's very true xD I'll do my best though, and thank you! Def appreciate that!

August 07 (2 years ago)

Hi Xen, thanks for the script, i have a question regarding the step 3. Would you please clarify with photos as to how and where to click as I can't seem to get around how to deploy the script.

August 08 (2 years ago)

Edited August 08 (2 years ago)


TinDM said:

Hi Xen, thanks for the script, i have a question regarding the step 3. Would you please clarify with photos as to how and where to click as I can't seem to get around how to deploy the script.

Hey there! Sorry that was confusing, but I uploaded a Gif of me performing that step - hope it helps! Please let me know if there's anything else I can help with! 

EDIT: https://gifyu.com/image/ScVId <- here's the link I edited my post above with :)