if (window.stats.sceneName == scene) { //Is the button pressed the current scene's button?
Change that line to:
if (window.stats.sceneName == "choicescript_stats") { //Is the button pressed the main stats screen/can we return to game?
That will make it so clicking the first button WHILE on the first page will return to the game, but clicking buttons 2 and 3 won’t do anything except move to that page - it won’t close them if you click it again while on that page.
Basically, I’m looking for a method to make it so that if I click my stats screen button in the main game to enter the stats screen, then click the stats screen button again while in the stats screen, I’ll remain in the stats screen, instead of returning to the ingame scene I had entered the stats screen from.
It might be less confusing if I just said I wanted a particular menu button’s function disabled while I was on the corresponding page.
EDIT: Wait, I just commented out that section governing bit of functionality. That won’t come to bite me in the ass later, will it?
I’m guessing it’s a problem if, when you start your index, it’s loading infinitely? My guess: I did something wrong. It also says, before I allow it, that internet explorer has restricted this page from running scripts or ActiveX controls. Then…yeah, infinity loading. Oh, and where you had ‘choicescript_stats 2’ I have ‘choicescript_stats King Relations’ because of the name I gave the file. Also, when we edited FootPrinter (don’t know what to call it), I was on line 165, not 168.
So, any thoughts on the problem at hand (and, preferably, how to fix it)?
function showStats(scene) {
if (window.stats.sceneName == "choicescript_stats") {
if (window.stats.sceneName == scene) { //Is the button pressed the current scene's button?
window.stats.scene = window.stats.scene.originalScene; //If it is, return to game.
clear Screen (loadAndRestoreGame) ;
return;
}
}
//Else, in any other case: Load selected stat screen.
var currentScene = window.stats.scene;
var scene = new Scene(scene, window.stats, this.nav);
scene.originalScene = currentScene;
main.innerHTML = "<div id='text'></div>";
scene.execute();
}
Lines 54 to 68.
function printFooter() {
// var footer = document.getElementById('footer');
// We could put anything we want in the footer here, but perhaps we should avoid it.
/* var statsButton = document.getElementById("statsButton");
if (statsButton) {
if (window.stats.sceneName == "choicescript_stats") {
statsButton.innerHTML = "Return to the Game";
} else {
statsButton.innerHTML = "Show Stats";
}
} */
setTimeout(function() {callIos("curl");}, 0);
}
Lines 176 to 188
// *finish
// halt the scene
Scene.prototype.finish = function finish(buttonName) {
this.paragraph();
this.finished = true;
var self = this;
if (this.name == "choicescript_stats" && this.originalScene) || "choicescript_stats King Relations" && this.originalScene) {
printButton(buttonName || "Next", main, false,
function() {
window.stats.scene = self.originalScene;
clearScreen(loadAndRestoreGame);
}
From looking at the code I can’t see anything else wrong, but since there’s no error message - I don’t have a lot to go on.
It may not even be a problem with this, you may have mistyped a variable in mygame.js or something.
Is the game online? If it is PM me a link and I can take a closer look.
I’m using the demo/template and I’m getting an error message telling me that “title” is non-existant command. That makes sense, but I’m not sure how to fix it.
@initdoby5@adjppm1227
There’s only so much I can guess at when provided with limited information, unless you can get me an actual error message or (better) give me a copy of your game, I can only guess at what’s wrong - which would leave us here for days.
As for your “title” thing, that’s not an error with this mod, that’s something to do with raw choicescript - *title is a new command, maybe you have an old version of CS?
…and it doesn’t make sense. It says that the mistake is one line 742, but my index only goes to 105.
So I tried playing my game again, and, for some reason, it says, “This is an example game. This game requires JavaScript; please enable JavaScript and refresh the page.”
So thus, I have a question. How do you enable JavaScript?