### Install Dependencies and Watch for Changes Source: https://github.com/roll20/roll20-character-sheets/blob/master/Palladium Rifts by Grinning Gecko/AGENTS.md Install project dependencies and start a development server that automatically rebuilds the project on file changes. Ensure Node.js and npm are installed. ```bash npm install # Install dependencies npm run watch # Start development with auto-rebuild ``` -------------------------------- ### Initialize Setup on Sheet Open Source: https://github.com/roll20/roll20-character-sheets/blob/master/WTA5e/WTA5e.html Executes setup logic when the character sheet is opened if setup has not been completed. Logs messages to the console for debugging. ```javascript on('sheet:opened',function(){ getAttrs(["setupDone"], function(pvalue) { console.log("Greetings"); let SetupDone=parseInt(pvalue.setupDone); console.log("setupdone: "+SetupDone ); if (SetupDone==0){ console.log("do setup"); setAttrs({setupDone:1}); } }); }) ``` -------------------------------- ### Initialize Sheet Setup Source: https://github.com/roll20/roll20-character-sheets/blob/master/Black Powder and Brimstone/BPaB.html Handles initial setup logic when the sheet is opened, ensuring a setup flag is set. ```javascript var SpecialHasBeenParsedSoNoInfiniteLoop = 0; on("sheet:opened", function(eventInfo){ getAttrs(["setupDone"], function(pvalue) { console.log("Hello there"); let SetupDone=parseInt(pvalue.setupDone); console.log("setupdone: "+SetupDone ); SpecialHasBeenParsedSoNoInfiniteLoop = 0; if (SetupDone==0){ console.log("Do setup"); setAttrs({setupDone:1}); } }); }); ``` -------------------------------- ### Character Sheet Starting Setup Function Source: https://github.com/roll20/roll20-character-sheets/blob/master/D&D_3-5/charsheet_3-5.html The `StartingSetup` function is called when a character sheet is first opened or needs updating. It handles version checking and recalculates core attributes like ability scores and modifiers. Ensure `version`, `cversion`, and `calc` are correctly passed. ```javascript function StartingSetup(version, cversion, calc) { mod = version; console.log('/* ----------entering StartingSetup; sheetversion:' + version + ' cversion:' + cversion + ' calc:' + calc + '------------ */'); if ((version < cversion) || (isNaN(version)) || (calc == 1)) { mod = cversion; getAttrs([ "str", "str-mod", "str-base", "str-misc", "str-equi", "str-temp", "str-action", "encumbrstr", "dex", "dex-mod", "dex-base", "dex-misc", "dex-equi", "dex-temp", "dex-action", "con", "con-mod", "con-base", "con-misc", "con-equi", "con-temp", "con-action", "int", "int-mod", "int-base", "int-misc", "int-equi", "int-temp", "int-action", "wis", "wis-mod", "wis-base", "wis-misc", "wis-equi", "wis-temp", "wis-action", "cha", "cha-mod", "cha-base", "cha-misc", "cha-equi", "cha-temp", "cha-action" ], function(values){ // ... (rest of the function logic for attribute calculation) ... }); } } ``` -------------------------------- ### Install and Start Frontierscum-Roll20 Source: https://github.com/roll20/roll20-character-sheets/blob/master/Frontier Scum/README.md Run these commands to install dependencies and start the development server for the frontierscum-roll20 character sheet. ```bash $ npm install $ npm run start ``` -------------------------------- ### Initialize Sheet Setup Source: https://github.com/roll20/roll20-character-sheets/blob/master/under_the_neighborhood/source/scaffold/docs.html Placeholder function for initial character sheet setup. It logs a debug message indicating the start of the setup process. ```javascript const initialSetup = function(attributes,sections){ debug('Initial sheet setup'); }; ``` -------------------------------- ### Install Node.js and Run Development Commands Source: https://github.com/roll20/roll20-character-sheets/blob/master/Stars_Without_Number_Revised/ReadMe.md To contribute to the character sheet, you need to install Node.js. Then, navigate to the Stars_without_Number_Revised folder and run 'npm install' followed by 'npm run dev' to start watching for file changes and compiling. Use 'npm run build' for a one-time compilation. ```bash npm install npm run dev ``` ```bash npm run build ``` -------------------------------- ### Sheet Setup Logic Source: https://github.com/roll20/roll20-character-sheets/blob/master/Deathmatch Island/deathmatch_island.html Functions for performing first-time setup and generating dynamic roll queries. ```javascript function performFirstTimeSetup(attrs, setter) { fillEmptyRows("bonds", 4, setter); fillEmptyRows("injuries", 3, setter); fillEmptyRows("deeds", 10, setter); fillEmptyRows("destiny", 6, setter); fillRepeatingSectionFromData("strifedie", kInitialStrifeDice, setter); for (const name of kLabelAttributes) { attrs[`${name}_label`] = getTranslation(name); } } function setupOccupationQuery(attrs) { const kNameDice = "roll=[[@{name_die}[@{name_label}]"; const occupation_options = [ `${getTranslation("none")},${kNameDice}`, `@{occupation},occupation=@{occupation}${kDoubleBrace} {{${kNameDice} + @{occupation_die}[@{occupation_label}]`, ]; if (attrs[kExtraOccupationField] === "1") { const and = getTranslation("and"); occupation_options.push( ...[ `@{occupation_2},occupation=@{occupation_2}${kDoubleBrace} {{${kNameDice} + @{occupation_die}[@{occupation_label}]`, `@{occupation} ${and} @{occupation_2},occupation=@{occupation} ${and} @{occupation_2}${kDoubleBrace} {{${kNameDice} + 2@{occupation_die}[@{occupation_label}]`, ] ); } attrs["occupation_and_name_query"] = query("occupation_die", occupation_options); } function setupDomainQueries(attrs) { const multiplier = attrs[kPathosGivesTwoDiceField] === "1" ? "2" : ""; for (const capability of kDomains) { const query_entries = [ `${getTranslation("no")}, `, ...kDomains .filter ``` -------------------------------- ### Install dependencies with Bun Source: https://github.com/roll20/roll20-character-sheets/blob/master/contrib/sheet-pixie/README.md Run this command to install the project's required dependencies. ```bash bun install ``` -------------------------------- ### Install npm Packages Source: https://github.com/roll20/roll20-character-sheets/blob/master/Slugblaster/README.md Run this command to install all necessary npm packages for the project. ```sh # Install all of the npm packages $ npm install ``` -------------------------------- ### Install pug locally Source: https://github.com/roll20/roll20-character-sheets/blob/master/ADnD_2E_Revised/README.md Install pug into the project folder. Do not use the -g flag as global installation is not supported. ```bash $ npm install pug ``` -------------------------------- ### Install supports-color Source: https://github.com/roll20/roll20-character-sheets/blob/master/Shadowrun6th-German/node_modules/supports-color/readme.md Install the supports-color module using npm. ```bash $ npm install supports-color ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/roll20/roll20-character-sheets/blob/master/DEATH IN SPACE/README.md Run this command to install the necessary npm packages for the project. ```bash npm install ``` -------------------------------- ### Install color-convert using npm Source: https://github.com/roll20/roll20-character-sheets/blob/master/Shadowrun6th-German/node_modules/color-convert/README.md Standard command to install the color-convert library using npm. ```bash $ npm install color-convert ``` -------------------------------- ### Initialize Sheet Setup Source: https://github.com/roll20/roll20-character-sheets/blob/master/Thorgal/Thorgal.html Executes setup routines when the character sheet is opened if setup is not yet done. It increments skills and sets the setupDone attribute. ```javascript on("sheet:opened", function(eventInfo){ getAttrs(["setupDone"], function(pvalue) { console.log("Hello there"); let SetupDone=parseInt(pvalue.setupDone); console.log("setupdone: "+SetupDone ); if (SetupDone==0){ console.log("Do setup"); incSkill("repeating\_skills-left"," ",""); incSkill("repeating\_skills-left"," ",""); incSkill("repeating\_skills-left"," ",""); incSkill("repeating\_skills-right"," ",""); incSkill("repeating\_skills-right"," ",""); incSkill("repeating\_skills-right"," ",""); setAttrs({setupDone:1}); } }); }); ``` -------------------------------- ### Initialize Repeating Postags Change Event Source: https://github.com/roll20/roll20-character-sheets/blob/master/root/root.html Starts an event listener for changes to the repeating_postags1col1 section. ```javascript on("change:repeating_postags1col1:postags", function() { getAttrs([ "repeating_postags1col1_postags" ], function(v) { var valor = v.repeating_postags1col1_postags; co ``` -------------------------------- ### Set Item Property: Legend Reputation Track Source: https://github.com/roll20/roll20-character-sheets/blob/master/root/root.html This item has a Legend reputation track (15 boxes) equivalent to Prestige. It starts at Legend +1 and clears at 10 boxes. Reaching Legend +3 requires 15 boxes. Wielding it openly marks Legend on the item when aiding the favored faction and injuring the hated faction, instead of personal prestige/notoriety. Roll with item's Legend for Reputation moves. Clear 1 Legend box per session without marking, or reduce Legend by 1 if no boxes to clear. Applicable to anything. ```javascript if(valor == "50"){ setAttrs({ repeating_postags3col2_textpostags: "This item has its own reputation track, referred to as Legend, equivalent to 15 boxes of Prestige. It starts with Legend +1, and has no Legend boxes marked. To reach Legend +2, it would have to have 10 boxes of Legend marked, and then would clear its track. To reach Legend +3, it would have to have 15 boxes of Legend marked. This item also has a favored faction and a hated faction. Any time you wield this item openly, you do not mark prestige or notoriety at all. Instead, you mark Legend on this item when you aid the favored faction and injure the hated faction. For Reputation moves, roll with the item’s Legend instead of your own Reputation. Whenever any session goes by in which you did not mark any Legend on this item, clear 1 box of Legend from this item. If you have no boxes to clear, reduce its Legend by 1. (Anything)" }); } ``` -------------------------------- ### Perform First Time Setup Source: https://github.com/roll20/roll20-character-sheets/blob/master/Agon Official/agon.html Initializes repeating sections and populates label attributes with translated strings. ```javascript function performFirstTimeSetup(attrs, setter) { fillEmptyRows("bonds", 8, setter); fillEmptyRows("deeds", 4, setter); fillEmptyRows("destiny", 6, setter); fillRepeatingSectionFromData("strifedie", kInitialStrifeDice, setter); for (const name of kLabelAttributes) { attrs[`${name}_label`] = getTranslation(name); } } ``` -------------------------------- ### Setup Character Class Attributes Source: https://github.com/roll20/roll20-character-sheets/blob/master/Edge of the Verse/edgeoftheverse.html Initializes or updates various character attributes based on a provided class name, including descriptions, looks, and starting gear. This function is intended for initial character setup. ```javascript var setupClass = function(classname) { var update = {}; update['character_class'] = classNames[classname]; update['comp_name'] = classname; update['description'] = descriptions[classname]; update['look_example'] = look[classname]; update['tip_confirm_flag'] = 1; update['warning_flag'] = 1; update['tab-moves'] = classname; update['filter-' + classname.toLowerCase()] = "on"; var backgroundUpdate = {}; if(backgrounds[classname]) { backgroundUpdate = addRepeatingInfo(backgrounds[classname].options, 'background'); if(backgrounds[classname].preInfo) { backgroundUpdate.pre_background = backgrounds[classname].preInfo; } } var attr = startAttrs[classname]; var gear = addRepeatingInfo(startGear[classname].options, 'startgear'); gear.startgear_note_text = startGear[classname].note_text; gear.startgear_choose_text = startGear[classname].choose_text; var movesdata = addRepeatingInfo(moves[classname].filter(m => m.type=='start'), 'moves'); setAttrs({...commonStartAttrs, ...update, ...backgroundUpdate, ...attr, ...gear, ...movesdata}); }; ``` -------------------------------- ### Running the usage example Source: https://github.com/roll20/roll20-character-sheets/blob/master/Shadowrun6th-German/node_modules/has-flag/readme.md Example command to run the foo.js script with specific arguments to test the has-flag functionality. ```bash $ node foo.js -f --unicorn --foo=bar -- --rainbow ``` -------------------------------- ### Get Rung from Skill Pyramid Location Source: https://github.com/roll20/roll20-character-sheets/blob/master/Fate_Core/fate.html Determines the 'rung' (level) of a skill based on its starting string. It iterates through a predefined 'ladder' of skill levels. ```javascript function getRung(locationInPyramid) { if(locationInPyramid) { for(var rung of ladder) { if(locationInPyramid.startsWith(rung)) { return ladder.indexOf(rung); } } } return 0; } ``` -------------------------------- ### Initialize and Build ARC Character Sheet Source: https://github.com/roll20/roll20-character-sheets/blob/master/ARC/README.md Commands to navigate to the source directory, install dependencies, and start the Gulp watch process for automatic builds. ```bash # Go to the source for your sheet $ cd //roll20-character-sheets/ARC/source # Install all of the npm packages $ npm install # Run the build process $ npm run gulp:watch ``` -------------------------------- ### System Bootup Initialization Source: https://github.com/roll20/roll20-character-sheets/blob/master/Starfinder by Roll20/Starfinder.html Logs the character sheet version and initializes event handlers. ```javascript bootup = function(){ //Only purpose is to log the character sheet version in the console log at start version.replace(/(\d+\.\d{3})(.+)/,(match,ver,buildDate)=>{ TAS.log(`Starfinder Character Sheet v${ver}, build Date:${new Date(buildDate*1000)} loaded`); }); /*var selectItem = _.reduce(equipment,(m,e)=>{ return m+=''; },''; TAS.log(JSON.stringify(selectItem));*/ /*const newObj = {}; _.each(attributeObjs,(ak)=>{ newObj[(ak.repeating ? ak.repeating+'|' : '')+ak.attr]=ak; }); TAS.log(JSON.stringify(newObj));*/ }; ``` -------------------------------- ### Initialize M-Space Spaceship Attributes Source: https://github.com/roll20/roll20-character-sheets/blob/master/Mythras/archives/v2.7/Mythras.html Initializes default values for various M-Space spaceship attributes. This setup ensures that all relevant components have a starting value, preventing errors during calculations. ```javascript MSpace.Spaceship.init = function() { getAttrs([ "se_mod", "negative_hp_max_base", "location4_table_start", "location4_table_end", "location4_name", "location4_hp_max_base_mod", "location5_table_start", "location5_table_end", "location5_name", "location5_hp_max_base_mod", "location6_table_start", "location6_table_end", "location6_name", "location6_hp_max_base_mod", "location7_table_start", "location7_table_end", "location7_name", "location7_hp_max_base_mod", "location8_table_start", "location8_table_end", "location8_name", "location8_hp_max_base_mod", "location9_table_start", "location9_table_end", "location9_name", "location9_hp_max_base_mod", "location10_table_start", "location10_table_end", "location10_name", "location10_hp_max_base_mod", "location11_table_start", "location11_table_end", "location11_name", "location11_hp_max_base_mod", "location12_table_start", "location12_table_end", "location12_name", "location12_hp_max_base_mod", "location1_display", "location2_display", "location3_display", "location4_display", "location5_display", "location6_display", "location7_display", "location8_display", "location9_display", "location10_display", "location11_display", "location12_display", "location_notes_1_display", "location_notes_7_display", "location_notes_8_display", "location_notes_9_display", "location_notes_10_display" ], function(values) { setAttrs({ se_mod: values.se_mod, negative_hp_max_base: values.negative_hp_max_base, location4_table_start: values.location4_table_start, location4_table_end: values.location4_table_end, location4_name: values.location4_name, location4_hp_max_base_mod: values.location4_hp_max_base_mod, location5_table_start: values.location5_table_start, location5_table_end: values.location5_table_end, location5_name: values.location5_name, location5_hp_max_base_mod: values.location5_hp_max_base_mod, location6_table_start: values.location6_table_start, location6_table_end: values.location6_table_end, location6_name: values.location6_name, location6_hp_max_base_mod: values.location6_hp_max_base_mod, location7_table_start: values.location7_table_start, location7_table_end: values.location7_table_end, location7_name: values.location7_name, location7_hp_max_base_mod: values.location7_hp_max_base_mod, location8_table_start: values.location8_table_start, location8_table_end: values.location8_table_end, location8_name: values.location8_name, location8_hp_max_base_mod: values.location8_hp_max_base_mod, location9_table_start: values.location9_table_start, location9_table_end: values.location9_table_end, location9_name: values.location9_name, location9_hp_max_base_mod: values.location9_hp_max_base_mod, location10_table_start: values.location10_table_start, location10_table_end: values.location10_table_end, location10_name: values.location10_name, location10_hp_max_base_mod: values.location10_hp_max_base_mod, location11_table_start: values.location11_table_start, location11_table_end: values.location11_table_end, location11_name: values.location11_name, location11_hp_max_base_mod: values.location11_hp_max_base_mod, location12_table_start: values.location12_table_start, location12_table_end: values.location12_table_end, location12_name: values.location12_name, location12_hp_max_base_mod: values.location12_hp_max_base_mod, location1_display: values.location1_display, location2_display: values.location2_display, location3_display: values.location3_display, location4_display: values.location4_display, location5_display: values.location5_display, location6_display: values.location6_display, location7_display: values.location7_display, location8_display: values.location8_display, location9_display: values.location9_display, location10_display: values.location10_display, location11_display: values.location11_display, location12_display: values.location12_display, location_notes_1_display: values.location_notes_1_display, location_notes_7_display: values.location_notes_7_display, location_notes_8_display: values.location_notes_8_display, location_notes_9_display: values.location_notes_9_display, location_notes_10_display: values.location_notes_10_display }); }); }; ``` -------------------------------- ### Install npm packages and run build process Source: https://github.com/roll20/roll20-character-sheets/blob/master/Crossed-Fates/README.md Navigate to the sheet's source directory, install npm packages, and run the watch command to automatically build HTML and CSS files from Pug and Stylus. This command watches for changes and rebuilds as needed. ```bash # Go to the source for your sheet $ cd //roll20-character-sheets/Crossed-Fates/source # Install all of the npm packages $ npm install # Run the build process $ npm run gulp:watch ``` -------------------------------- ### Run the project with Bun Source: https://github.com/roll20/roll20-character-sheets/blob/master/contrib/sheet-pixie/README.md Execute the main entry point of the application using the Bun runtime. ```bash bun run index.ts ``` -------------------------------- ### Handle Start Gear Click Event Source: https://github.com/roll20/roll20-character-sheets/blob/master/Edge of the Verse/edgeoftheverse.html Listens for clicks on the 'get' button within the 'repeating_startgear' section. It either adds a new item to the inventory or appends details to the notes based on the gear type. ```javascript on(\`clicked:repeating_startgear:get\`, function() { getAttrs([ 'repeating_startgear_name', 'repeating_startgear_details', 'repeating_startgear_type' ], function(v) { if(v.repeating_startgear_type == 'item') { var newrowid = generateRowID(); var newItem = {} newItem[\`repeating_inventory_${newrowid}_inventory_simple\`] = v.repeating_startgear_name || ''; newItem[\`repeating_inventory_${newrowid}_inventory_details\`] = v.repeating_startgear_details || ''; setAttrs(newItem); } else { getAttrs(['notes'], (vv) => { setAttrs({ notes: vv.notes += `\n${v.repeating_startgear_name ? `${v.repeating_startgear_name}: ` : ''}${v.repeating_startgear_details}` }) }) } }); }); /* STARTGEAR SECTION END */ ``` -------------------------------- ### Initialize Sheet on Open Source: https://github.com/roll20/roll20-character-sheets/blob/master/Cottages and Cerberus/CottagesAndCerberus.html Executes setup logic when a character sheet is opened. It checks if setup is already done and logs messages accordingly. ```javascript on("sheet:opened", function(eventInfo){ getAttrs(["setupDone"], function(pvalue) { console.log("Hello there"); let SetupDone=parseInt(pvalue.setupDone); console.log("setupdone: "+SetupDone ); if (SetupDone==0){ console.log("Do setup"); } }); }); ``` -------------------------------- ### Roll20 Power Macro Example Source: https://github.com/roll20/roll20-character-sheets/blob/master/D&D_4E/D&D_4E.html This macro is used to roll an attack and damage for a power. It references character sheet attributes for attack bonus, defense, weapon dice, and damage. Ensure the attribute names match your sheet's setup. ```Roll20 Macro /me uses @{power-83-name} [[1d20+@{power-83-attack}]] vs @{power-83-def} Hit: [[(1*@{power-83-weapon-num-dice})d@{power-83-weapon-dice}+@{power-83-damage}]] Damage ``` ```Roll20 Macro /me uses @{power-84-name} [[1d20+@{power-84-attack}]] vs @{power-84-def} Hit: [[(1*@{power-84-weapon-num-dice})d@{power-84-weapon-dice}+@{power-84-damage}]] Damage ``` ```Roll20 Macro /me uses @{power-85-name} [[1d20+@{power-85-attack}]] vs @{power-85-def} Hit: [[(1*@{power-85-weapon-num-dice})d@{power-85-weapon-dice}+@{power-85-damage}]] Damage ``` -------------------------------- ### Complex task dependencies with async.auto Source: https://github.com/roll20/roll20-character-sheets/blob/master/Shadowrun6th-German/node_modules/async/README.md Illustrates a complex scenario using async.auto where tasks have multiple dependencies. Tasks run in parallel if their dependencies are met, and results are passed between them. This example shows defining tasks like getting data, making a folder, writing a file, and emailing a link. ```javascript async.auto({ get_data: function(callback){ console.log('in get_data'); // async code to get some data callback(null, 'data', 'converted to array'); }, make_folder: function(callback){ console.log('in make_folder'); // async code to create a directory to store a file in // this is run at the same time as getting the data callback(null, 'folder'); }, write_file: ['get_data', 'make_folder', function(callback, results){ console.log('in write_file', JSON.stringify(results)); // once there is some data and the directory exists, // write the data to a file in the directory callback(null, 'filename'); }], email_link: ['write_file', function(callback, results){ console.log('in email_link', JSON.stringify(results)); // once the file is written let's email a link to it... // results.write_file contains the filename returned by write_file. callback(null, {'file':results.write_file, 'email':'user@example.com'}); }] }, function(err, results) { console.log('err = ', err); console.log('results = ', results); }); ``` -------------------------------- ### Initialize Sheet Setup Source: https://github.com/roll20/roll20-character-sheets/blob/master/RolemasterUnified/Old and testing/sheet_RMU_v1_0.html Triggers the StartingSetup function when the sheet is opened or the skillcalc attribute changes. ```javascript on('sheet:opened change:skillcalc', function() { getAttrs(['sheetversion', 'currentsheetversion', 'skillcalc', 'languagesmoved'], function(values) { setAttrs({ sheetversion: StartingSetup(parseFloat(values.sheetversion), parseFloat(values.currentsheetversion), parseInt(values.skillcalc,10), parseInt(values.languagesmoved,10)) }); }); }); ``` -------------------------------- ### Roll20 Power Macro Example Source: https://github.com/roll20/roll20-character-sheets/blob/master/D&D_4E/D&D_4E.html This macro is used to roll an attack and damage for a specific power. It references attributes like power name, attack bonus, defense, weapon dice, and damage bonus. Ensure the attribute names match your character sheet's setup. ```Roll20 Macro /me uses @{power-65-name} [[1d20+@{power-65-attack}]] vs @{power-65-def} Hit: [[(1*@{power-65-weapon-num-dice})d@{power-65-weapon-dice}+@{power-65-damage}]] Damage ``` ```Roll20 Macro /me uses @{power-66-name} [[1d20+@{power-66-attack}]] vs @{power-66-def} Hit: [[(1*@{power-66-weapon-num-dice})d@{power-66-weapon-dice}+@{power-66-damage}]] Damage ``` ```Roll20 Macro /me uses @{power-67-name} [[1d20+@{power-67-attack}]] vs @{power-67-def} Hit: [[(1*@{power-67-weapon-num-dice})d@{power-67-weapon-dice}+@{power-67-damage}]] Damage ``` ```Roll20 Macro /me uses @{power-68-name} [[1d20+@{power-68-attack}]] vs @{power-68-def} Hit: [[(1*@{power-68-weapon-num-dice})d@{power-68-weapon-dice}+@{power-68-damage}]] Damage ``` -------------------------------- ### Get Character Type Default Skill Points Source: https://github.com/roll20/roll20-character-sheets/blob/master/D6pp_Modern/d6ppmodern.html Returns default skill points based on the character type. 'major_npc' gets 600, 'npc' gets 0, and other types get 60. ```javascript function getTypeDefaults(character_type) { if (character_type === "major_npc") { return { skill_points: 600 }; } if (character_type === "npc") { return { skill_points: 0 }; } return { skill_points: 60 }; } ``` -------------------------------- ### Initial Sheet Setup Source: https://github.com/roll20/roll20-character-sheets/blob/master/rapidfire_system/system.html Performs the initial setup for a character sheet. This is called when the sheet version is not detected. ```javascript const initialSetup = function(attributes,sections){ debug('Initial sheet setup'); }; ``` -------------------------------- ### Define Guided Mortar Gear Source: https://github.com/roll20/roll20-character-sheets/blob/master/Heavy Gear 4e/HeavyGear4e.html Defines the 'Guided Mortar' weapon, featuring AoE, Blast, and Guided traits. ```javascript case "GM": gearweapon = {type:"Guided Mortar", range :"120-360/720",size: sizeletter, l:7,m:8, h:9, traits:["AoE:15","Blast","Guided"], catagory:"I", slots:3, aux:2, location:"Shoulder,Torso", ammunition:1, pl:5, desc:""}; break; ``` -------------------------------- ### Initialize Character Sheet Setup Source: https://github.com/roll20/roll20-character-sheets/blob/master/Sengoku/Sengoku.html Executes when the character sheet is opened. If 'setupDone' attribute is 0, it adds a list of practical skills with default values and then sets 'setupDone' to 1. Requires 'getAttrs' and 'setAttrs' functions. ```javascript on('sheet:opened',function(){ getAttrs(["setupDone"], function(pvalue) { var SetupDone=parseInt(pvalue.setupDone); if (SetupDone==0){ addSkill("repeating\_PracticalSkills","Athletics","2","@{cur\_dex}"); addSkill("repeating\_PracticalSkills","Buddhism","2","@{cur\_int}"); addSkill("repeating\_PracticalSkills","Climbing","2","@{cur\_dex}"); addSkill("repeating\_PracticalSkills","Concentration","2","@{cur\_int}"); addSkill("repeating\_PracticalSkills","Confucianism","2","@{cur\_int}"); addSkill("repeating\_PracticalSkills","Conversation","2","@{cur\_pre}"); addSkill("repeating\_PracticalSkills","Dance (...)","2","@{cur\_dex}"); addSkill("repeating\_PracticalSkills","Deduction","2","@{cur\_int}"); addSkill("repeating\_PracticalSkills","Evade","2","@{cur\_dex}"); addSkill("repeating\_PracticalSkills","Folklore","2","@{cur\_int}"); addSkill("repeating\_PracticalSkills","General Knowledge","2","@{cur\_int}"); addSkill("repeating\_PracticalSkills","Language (native language)","2","@{cur\_int}"); addSkill("repeating\_PracticalSkills","Local Expert (home village/town)","2","@{cur\_int}"); addSkill("repeating\_PracticalSkills","Perception","2","@{cur\_int}"); addSkill("repeating\_PracticalSkills","Shintô","2","@{cur\_int}"); addSkill("repeating\_PracticalSkills","Stealth","2","@{cur\_dex}"); addSkill("repeating\_PracticalSkills","Teaching","2","@{cur\_pre}"); setAttrs({setupDone:"1"}); } }); }); ``` -------------------------------- ### Handle Setup Limit Source: https://github.com/roll20/roll20-character-sheets/blob/master/Valor/Valor Character Sheet.html Calculates the required turns for 'setup' limits and updates the summary. Use for limits that require a setup phase. ```javascript else if(limit.indexOf('setup') == 0 || limit.indexOf('set-up') == 0 || limit.indexOf('set up') == 0) { let turn = 1 + limitLevel; limitSummary += getTranslationByKey('desc-limits-setup').replace("{{0}}", turn); limitSt += limitLevel; } ``` -------------------------------- ### Initialize Sheet on Open Source: https://github.com/roll20/roll20-character-sheets/blob/master/HeroSystem6e/HeroSystem6e.html Performs initial setup when the character sheet is opened. This includes clearing debug attributes, synchronizing configuration settings, and calculating/setting various character attributes like stats, skills, and combat values. ```javascript setAttrs({ debug0 : "", debug1 : "", debug2 : "", debug3 : "", debug4 : "" }); setConfiguration(); setSTR(); setDEX(); setCON(); setINT(); setEGO(); setPRE(); setCharOCV(); setCharDCV(); setOMCV(); setDMCV(); setSPD(); setREC(); setEND(); setBODY(); setSTUN(); setPD(); setRPD(); setHitLocPD(); setHitLocRPD(); setED(); setRED(); setHitLocED(); setHitLocRED(); setMDEF(); setPDEF(); setFDEF(); setDamageDice(); setPowerEnhancements(); setEnduranceCosts(); setPowerFormulas(); setSkillLevels(); setSkillRolls(); calcSenses(); setManeuver(); setRange(); setCombatModifiers(); setCombatSkills(); setPenaltySkills(); setCombatValues(); ``` -------------------------------- ### Class Hierarchy Setup Source: https://github.com/roll20/roll20-character-sheets/blob/master/Eclipse Phase Alternate/ep-sheet.html Sets up class prototypes for inheritance, defining constructor and prototype chains. ```scala function Hm(){}Hm.prototype=new n;Hm.prototype.constructor=Hm;function Im(){}Im.prototype=Hm.prototype;Hm.prototype.Ka=function(){return hh(new ih,this.st())};function Jm(){}Jm.prototype=new n;Jm.prototype.constructor=Jm;function Km(){}Km.prototype=Jm.prototype; ``` -------------------------------- ### Install Chalk Source: https://github.com/roll20/roll20-character-sheets/blob/master/Shadowrun6th-German/node_modules/chalk/readme.md Install the package via npm. ```console $ npm install chalk ```