OK, you sent the source, which showed the problem. You left out a semicolon “;” at the end of one part, and then followed that up with a second part that began with a left parentheses “(”, and so JavaScript interpreted that second part as an attempt to call a function on the previous part. Adding in a semicolon fixed the problem.
It didn’t have anything to do with my “health bar” code.
Here's the corrected JavaScript: (click the arrow on the left)
/* twine-user-script #1: "Characters.js" */
State.variables.characters = {
player: {
firstName: '',
surname: '',
health: {
curHP: 59,
maxHP: 60
},
energy: {
curEN: 100,
maxEN: 100
},
lust: {
curLT: 20,
maxLT: 100
},
experience: {
curEX: 30,
maxEX: 100
},
inventory: []
},
isabella: {
firstName: "Isabella",
surname: ''
},
miles: {
firstName: "Miles",
surname: ''
}
};
/* twine-user-script #2: "init_js.js" */
/* JS Game Init */
(function () {
const $actBar = jQuery(document.createDocumentFragment()).append('<div id="action_menu"></div>');
jQuery("#story").prepend($actBar);
$(document).on(':passagedisplay', function() {
setPageElement('action_menu', 'ActionMenu');
});
})();
importStyles("gameStyles.css");
setup.Clock = function(d) {
let minutes = d.getMinutes();
let hours = d.getHours();
//let years = d.getYear();
const weekDays = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
var day = weekDays[d.getDay()];
if (d.getHours() < 10) { hours = "0" + hours; }
if (d.getMinutes() < 10) { minutes = "0" + minutes; }
State.variables.day = day;
State.variables.hours = hours;
State.variables.minutes = minutes;
let printDate = "$day <br> $hours : $minutes";
return printDate;
};
/*
Macro.add("Menu_Options", {
tags : null,
handler : function() {
if (this.args[0] === 'general') {
try {
for (let i = 0; i < 15; i++) {
}
} catch (err) {
}
}
}
});
*/
/* Status bar JS */
Config.ui.updateStoryElements = false;
$(document).on(":passageend", function() {
$("#charname").empty().wiki("$mcName $mcSurname<hr>");
statusBar(State.variables.characters.player.health.curHP, State.variables.characters.player.health.maxHP, "statusBase1");
statusBar(State.variables.characters.player.energy.curEN, State.variables.characters.player.energy.maxEN, "statusBase2");
statusBar(State.variables.characters.player.lust.curLT, State.variables.characters.player.lust.maxLT, "statusBase3");
statusBar(State.variables.characters.player.experience.curEX, State.variables.characters.player.experience.maxEX, "statusBase4");
});
window.statusBar = function(CurST, MaxST, BarID) {
var ST = parseInt((CurST / MaxST) * 100);
if (ST < 0) { ST = 0; }
else if (ST > 100) { ST = 100; }
let BarElement = $(document).find("#" + BarID);
BarElement.css( { width : ST + "%" } );
BarElement.attr("title", CurST + "/" + MaxST + " EN");
$(document).find("." + BarID + "Base").attr("title", CurST + "/" + MaxST + " ST");
};
/* twine-user-script #3: "map_sys.js" */
setup.Maps = {
intro_map : {
'0x2' : { icon: "hallway", desc: "Road" },
'0x1' : { icon: "hallway", desc: "Road" },
'0x0' : { icon: "bedroom", desc: "Carriage" },
'0x-1' : { icon: "hallway", desc: "Road" },
'0x-2' : { icon: "hallway", desc: "Road" },
initial_pos : "0x0",
pos : [0, 0],
get_actPos : function() {
return this.pos[0] + "x" + this.pos[1];
}
}
};
There are a few other minor fixes in there, and I commented out the part where you define the “years” variable, since you never use that variable.
You can see now why I couldn’t solve the problem without actually seeing your code.
Have fun!