Same as title. I followed the instructions in the ‘Introduction to ChoiceScript’ section on the main site, and I click on run-server.batch. It opens a popup and then throws up this:
The code section looks like this:
Is my issue in where my Node.js is installed? I believe it just went to program files. Or is it something else? Am I even clicking the right batch file?
Someone please get Dan on this.
People say there’s an issue in one of the files (serve.js I think ) and that you need to remove a certain bit of code from there, but there has to be a reason for that code to be there in the first place so I’m not 100% convinced just removing it is actually a good thing.
I’m going to work on this today! My sincerest apologies
This issue occurred to me also. The current github link for choicescript is broken.
- Go to serve.js in the choicescript-main folder
Replace this part of the code:
const requestHandler = (request, response) => {
//console.log(request.url);
const requestUrl = new URL(request.url, base);
const requestPath = requestUrl.pathname;
let requestFile = path.normalize(`${dir}/${requestPath}`);
if (!requestFile.startsWith(dir)) {
response.statusCode = 400;
response.end();
return;
} else if (requestFile.endsWith(path.sep)) {
requestFile += 'index.html';
} else if (requestFile.endsWith('mygame.js')) {
const gameDir = path.basename(path.dirname(requestFile));
const mygame = child_process.execSync('node mygamegenerator.js ${gameDir}', {encoding: 'utf8'});
fs.writeFileSync(`${dir}/web/${gameDir}/mygame.js`, mygame, 'utf8');
}
With this:
const requestHandler = (request, response) => {
//console.log(request.url);
const requestUrl = new URL(request.url, base);
const requestPath = requestUrl.pathname;
let requestFile = path.normalize(`${dir}/${requestPath}`);
if (!requestFile.startsWith(dir)) {
response.statusCode = 400;
response.end();
return;
} else if (requestFile.endsWith(path.sep)) {
requestFile += 'index.html';
}
Or just delete the 2nd else if statement.
Hope this gets fixed soon, or people will have trouble making new games.
You don’t know what that bit of code you removed was meant to do. Don’t just remove code willy-nilly you don’t know if it isn’t loadbearing
I know what the problem is. The programmer did not use backticks ` and instead used single quotes ’
I’m not sure what the purpose of the 2nd else if is, but clearly every other CS game including WIPs before this year have been using the old version.
It’s fixed in the latest ChoiceScript on Github. Download that copy, move your scenes files into it, and run the server. It should work.
Sorry it took me so long to fix it.
Wonderful! It was a speedy response as far as I’m concerned. Thank you very much!