Skip to content
Snippets Groups Projects
Commit df26b068 authored by Eric Oulashin's avatar Eric Oulashin Committed by Rob Swindell
Browse files

This is a new trivia door, Good Time Trivia, written in JavaScript

parent ee5f1e62
Branches
Tags
No related merge requests found
[NC

 
 
HW40 40 40 4040 40 40
NB7H4NB7HW0 NB7H4NB7HW0 NB7H4NB7HW0 NB7H4NB7HW0NB7HW0 NB7H4NB7HW0 NB7H4NB7HW0
4 0 NB7H4NB7HW0NB7HW0 NB7H4NB7HW0 NB7H4NB7HW0NB7HW0 NB7H4NB7HW0 NB7H4NB7HW0NB7HW0
7NB7HWNB7H4NB7HW40 7NB7H4NB7HWNB7H4NB7HWNB70HW 7NB7H4NB7HWNB7H4NB7HW0
7NB707HWNB7H4NB707HWNB7H4NB70HW7NB7H4NB70HW7NB7HWNB7H4NB70HW7NB7H4NB7HWNB7HW0
7NB7HWNB7HWNB7HWNB7HWNB7HWNB7HWNB7HWNB7HWNB7HW0
7 NB70W47 B     0
WB74 W7 BW0B7  W0 4B7W40 7 BW0 7 B 0
7 W4B7W47 BW0B7  W0 B7W0 7 BW0 7 B 0
[BEHAVIOR]
numQuestionsPerPlay=30
numTriesPerQuestion=4
maxNumPlayerScoresToDisplay=10
[COLORS]
error=YH
triviaCategoryHdr=MH
triviaCategoryListNumbers=CH
triviaCategoryListSeparator=GH
triviaCategoryName=C
categoryNumPrompt=C
categoryNumPromptSeparator=GH
categoryNumInput=CH
questionHdr=M
questionHdrNum=CH
question=BH
answerPrompt=C
answerPromptSep=GH
answerInput=CH
userScore=CH
scoreSoFarText=C
clueHdr=RH
clue=GH
answerAfterIncorrect=G
[CATEGORY_ARS]
dirty_minds=AGE 18
\ No newline at end of file
This diff is collapsed.
Name: Good Times Trivia
Desc: A question and answer based trivia game. Supports multiple trivia categories.
By: Nightfox -at- digitaldistortionbbs.com (or digdist.synchro.net)
Cats: Games
Subs: Trivia, JavaScript
Inst: $Id: install-xtrn.ini,v 1.1 2022/11/17 15:48:20 nightfox Exp $
[prog:GTTRIVIA]
cmd = ?gttrivia.js
settings = XTRN_MULTIUSER
required = true
\ No newline at end of file
require("sbbsdefs.js", "K_NOCRLF");
var inputFilename = "/mnt/data/SharedMedia/triviaQuestions/music_and_movies.txt";
var outputFilename = inputFilename + "-converted.txt";
print("");
print("Converting " + inputFilename);
print("Output: " + outputFilename);
print("");
var inFile = new File(inputFilename);
var outFile = new File(outputFilename);
if (inFile.open("r"))
{
if (outFile.open("w"))
{
var question = "";
var answer = "";
var questionLimit = 0; // Temporary
var numWritten = 0; // Temporary
while (!inFile.eof /*&& (questionLimit > 0 && numWritten < questionLimit)*/)
{
var fileLine = inFile.readln(4096);
// I've seen some cases where readln() doesn't return a string
if (typeof(fileLine) !== "string")
continue;
fileLine = fileLine.trim();
if (fileLine.length == 0)
continue;
/*
//print(fileLine); // Temporary
if (fileLine.indexOf("Trivia Question:") == 0)
{
question = fileLine.substr(16).trim();
//print("- Here 1 - question:" + question + ":"); // Temporary
}
else if (fileLine.indexOf("Answer:") == 0)
{
answer = fileLine.substr(7).trim();
//print("- Here 2 - answer:" + answer + ":"); // Temporary
}
else // Assume it's part of the question
{
question += " " + fileLine;
//print("- Here 3 - question:" + question + ":"); // Temporary
}
*/
//print(fileLine); // Temporary
if (fileLine.indexOf("Answer:") == 0)
{
answer = fileLine.substr(7).trim();
//print("- Here 2 - answer:" + answer + ":"); // Temporary
}
else
{
question = fileLine;
// Search for and remove the number (and period) at the beginning of the question
var dotIdx = question.indexOf(".");
if (dotIdx >= 0)
question = question.substr(dotIdx+1).trim();
//print("- Here 3 - question:" + question + ":"); // Temporary
}
/*
// Temporary
print("");
print("Question length: " + question.length);
print("Answer length: " + answer.length);
print("");
// End Temporary
*/
if (question.length > 0 && answer.length > 0)
{
/*
// Temporary
print("- Writing:");
print(question);
print(answer);
print("");
// End Temporary
*/
outFile.writeln(question);
outFile.writeln(answer);
outFile.writeln("10");
outFile.writeln("");
//++numWritten; // Temporary
question = "";
answer = "";
//numPoints = -1;
}
/*
if (question.length == 0)
question = fileLine;
else if (qnswer.length == 0)
qnswer = fileLine;
//else if (theNumPoints < 0)
// theNumPoints = +(fileLine);
*/
}
outFile.close();
print("Done.");
print("");
}
else
print("* Failed to open " + outputFilename + " for writing!");
inFile.close();
}
else
print("* Failed to open " + inputFilename + " for reading!");
////////////////////////////////////////////////////////////////////
// Functions
// QA object constructor
function QA(pQuestion, pAnswer, pNumPoints)
{
this.question = pQuestion;
this.answer = pAnswer;
this.numPoints = pNumPoints;
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This file lists all of the changes made for each release of Good Time Trivia.
Revision History (change log)
=============================
Version Date Description
------- ---- -----------
1.00 2022-11-18 Initial version/release
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment