I kinda forgot what I did here.

This commit is contained in:
Raktbastr 2025-02-25 17:36:33 -06:00
parent e413a5dea4
commit 25efc4f9f9
4 changed files with 29 additions and 10 deletions

View file

@ -1,3 +1,5 @@
# Lonesome Road # Lonesome Road
## Run "npm install readline-sync" before running! It is needed for user input!
## NPM Dependencies
* readline-sync

View file

@ -3,7 +3,6 @@ const variables = require("./variables.js");
const shops = require("./shops"); const shops = require("./shops");
const readline = require('node:readline'); const readline = require('node:readline');
console.clear(); console.clear();
console.log("__________________________________________________________________________________________________________________________________"); console.log("__________________________________________________________________________________________________________________________________");
console.log(" _____ _ ____ "); console.log(" _____ _ ____ ");
@ -25,11 +24,14 @@ var mainMenuInput = variables.userInput("Enter: ")
switch(mainMenuInput) { switch(mainMenuInput) {
case "1": case "1":
startGame(); startGame();
break;
case "2": case "2":
showManual(); while (true) { console.log(variables.randomNumber(10,15)); }
break;
case "3": case "3":
console.log("Quitting Game..."); console.log("Quitting Game...");
variables.sleep(1000); variables.sleep(1000);
break;
} }
function startGame() { // So far what I have is filler and testing, feel free to change. function startGame() { // So far what I have is filler and testing, feel free to change.
@ -46,4 +48,5 @@ function startGame() { // So far what I have is filler and testing, feel free to
console.clear(); console.clear();
variables.prewarmoney = 500; variables.prewarmoney = 500;
shops.trader();
} }

View file

@ -14,9 +14,7 @@ var rrInv = [];
var vt0Inv = []; var vt0Inv = [];
var vegasInv = []; // A mix of gunrunners, mick&ralphs, and followers var vegasInv = []; // A mix of gunrunners, mick&ralphs, and followers
var eurInv = []; var eurInv = [];
var trader1Inv = []; var traderInv = ["gun", "stimpak", "radx"];
var trader2Inv = [];
var trader3Inv = [];
function ravenRock() { function ravenRock() {
// purchasing code // purchasing code
@ -35,5 +33,11 @@ function eureka() {
} }
function trader() { // One of the 3 trader inventories, chosen randomly function trader() { // One of the 3 trader inventories, chosen randomly
// purchasing code var tempTraderInv = [];
for (var a = 0; a <= 2; a++) {
let randomPick = Math.m
tempTraderInv.push(traderInv[1]);
console.log(randomPick);
}
console.log(tempTraderInv);
} }

View file

@ -24,6 +24,7 @@ module.exports = { // Lets variables and functions be used in other files
sleep, sleep,
checkLose, checkLose,
userInput, userInput,
randomNumber
}; };
var name = ''; var name = '';
@ -34,7 +35,9 @@ var caps = 0; // Used everywhere
var day = 0; // Should we add a definite end? 365 Days? var day = 0; // Should we add a definite end? 365 Days?
var location = 0; // Location in the world, 0 is Raven Rock, 200 is CTE. var location = 0; // Location in the world, 0 is Raven Rock, 255 is New Vegas
var locationA = 0; // Location on path A,
var locationB = 0; // Location on path B, 225 is Navarro
var ammo = 0; // Used in encounters and hunting, No cap :) var ammo = 0; // Used in encounters and hunting, No cap :)
@ -107,8 +110,7 @@ function checkLose() { // Checks to see if any lose conditions have been met
} }
} }
function calcLocation() { // Calculates your location in the world using location points. function calcLocation() { // Calculates your location in the world using location points, You move your move speed per day, but 3/4 of it if you are sick
// You move your move speed per day, but 3/4 of it if you are sick
if (travelSpeed == 1) { if (travelSpeed == 1) {
if (isSick == true) { if (isSick == true) {
location = location+0.75; location = location+0.75;
@ -135,4 +137,12 @@ function calcLocation() { // Calculates your location in the world using locatio
function userInput(question) { // Basic user input functions, takes in the question to be asked. function userInput(question) { // Basic user input functions, takes in the question to be asked.
let answer = readline.question(question); let answer = readline.question(question);
return(answer); return(answer);
}
function randomNumber(min, max) { // Takes in two parameters, min and max, and returns a random number between those boundries.
while (true) {
var randNum = Math.floor(Math.random() * (max+1))
if (randNum >= min) { break; }
}
return randNum;
} }