What I’m trying to do
I am trying to automate a template for an RPG where the templae will generate 6 random numbers (Stats). I have followed the documentation but I keep getting the error ‘Template parsing error, aborting See console for more information’ however nothing dispalys inthe console
Hers is the script (traveller_stats2.js)
function traveller_stats(tp) {
console.log(“traveller_stats script has been called!”); // Debug line
function roll2d6() {
return (Math.floor(Math.random() * 6) + 1) + (Math.floor(Math.random() * 6) + 1);
}
return {
STR: roll2d6(),
DEX: roll2d6(),
END: roll2d6(),
INT: roll2d6(),
EDU: roll2d6(),
SOC: roll2d6(),
DEBUG: "Script was called!" // Optional: Add a debug field to the returned object
};
}
module.exports = traveller_stats;
And here is the code in the template
<%*
const stats = await tp.user.traveller_stats2();
%>
| <%=stats.STR %> | <%=stats.DEX %> | <%=stats.END %> | <%=stats.INT %> | <%=stats.EDU %> | <%=stats.SOC %> |
Things I have tried
I am stuck and really am not sure what to try at this point. Can anyone see a flaw in the script?