I'm not much of a coder, so I had AI write my code for Script Cards. I read the update on AI, and didn't see a prohibition about using it for macros, but if this isn't allowed, please let me know. on("ready", function() { // Define the names of your rollable tables const table1Name = "Roomshape"; const table2Name = "Directions"; const table3Name = "Cavern-Features"; const table4Name = "Investigation-Results"; // Retrieve the list of items from each rollable table const table1 = findObjs({ type: "rollabletable", name: table1Name })[0]; const table2 = findObjs({ type: "rollabletable", name: table2Name })[0]; const table3 = findObjs({ type: "rollabletable", name: table3Name })[0]; const table4 = findObjs({ type: "rollabletable", name: table4Name })[0]; // Create arrays to keep track of used results for each table let usedResults1 = []; let usedResults2 = []; let usedResults3 = []; let usedResults4 = []; // Function to roll on a rollable table and retrieve a result function rollOnTable(table, usedResults) { // Retrieve the list of items from the rollable table const tableItems = findObjs({ type: "tableitem", _rollabletableid: table.get("_id") }); // Filter out items that haven't been used yet const availableItems = tableItems.filter(item => !usedResults.includes(item.get("name"))); // If all items have been used, reset the usedResults array if (availableItems.length === 0) { usedResults = []; } // Randomly select an item from the available items const randomIndex = Math.floor(Math.random() * availableItems.length); const selectedItem = availableItems[randomIndex]; // Add the selected item to the usedResults array usedResults.push(selectedItem.get("name")); // Return the selected item return selectedItem.get("name"); } // Roll on each table and retrieve a result const result1 = rollOnTable(table1, usedResults1); const result2 = rollOnTable(table2, usedResults2); const result3 = rollOnTable(table3, usedResults3); const result4 = rollOnTable(table4, usedResults4); // Output the results in the Roll20 chat sendChat("Roll20", `&{template:default} {{Roomshape: ${result1}}} {{Directions: ${result2}}} {{Cavern-Features: ${result3}}} {{Investigation-Results: ${result4}}}`); }); This was my output on("ready", function() { // Define the names of your rollable tables const table1Name = "Roomshape"; const table2Name = "Directions"; const table3Name = "Cavern-Features"; const table4Name = "Investigation-Results"; (GM): // Retrieve the list of items from each rollable table const table1 = findObjs({ type: "rollabletable", name: table1Name })[0]; const table2 = findObjs({ type: "rollabletable", name: table2Name })[0]; const table3 = findObjs({ type: "rollabletable", name: table3Name })[0]; const table4 = findObjs({ type: "rollabletable", name: table4Name })[0]; // Create arrays to keep track of used results for each table (GM): let usedResults1 = []; let usedResults2 = []; let usedResults3 = []; let usedResults4 = []; // Function to roll on a rollable table and retrieve a result function rollOnTable(table, usedResults) { (GM): // Retrieve the list of items from the rollable table const tableItems = findObjs({ type: "tableitem", _rollabletableid: table.get("_id") }); // Filter out items that haven't been used yet const availableItems = tableItems.filter(item => !usedResults.includes(item.get("name"))); // If all items have been used, reset the usedResults array if (availableItems.length === 0) { (GM): usedResults = []; } // Randomly select an item from the available items const randomIndex = Math.floor(Math.random() * availableItems.length); const selectedItem = availableItems[randomIndex]; // Add the selected item to the usedResults array (GM): usedResults.push(selectedItem.get("name")); // Return the selected item return selectedItem.get("name"); } // Roll on each table and retrieve a result const result1 = rollOnTable(table1, usedResults1); (GM): const result2 = rollOnTable(table2, usedResults2); const result3 = rollOnTable(table3, usedResults3); const result4 = rollOnTable(table4, usedResults4); // Output the results in the Roll20 chat Roomshape: ${result1} Directions: ${result2} Cavern-Features: ${result3} Investigation-Results: ${result4} }); Can someone help me?