Closed M0nkey5ee closed 5 months ago
My support could for example look like this, without having coordinated with you so just out of the blue, the idea of the mentioned scenatio in one-shot code:
Script: beerFest.js javascript Copy code // Global variables to hold data and state let beerFestData; // Data about beer fest activities and restroom scenarios let bladderLevel = 0; // Track bladder pressure
// Function to setup the beer fest environment function beerFestSetup() { getjson("locations/beerFest", beerFestJsonSetup); return { "visit": [beerFestVisit, "Visit the beer fest"], "group": 1, "visited": -1, } }
// Initialize data from JSON function beerFestJsonSetup(json) { beerFestData = json; }
// Main function for visiting the beer fest function beerFestVisit() { let curtext = printList([], "Welcome to the Beer Fest! Choose your beer:"); curtext = appendBeerChoices(curtext); sayText(curtext); setUpListeners(); }
// Append beer choices to the text function appendBeerChoices(curtext) { curtext.push("1. Light Beer"); curtext.push("2. Strong Beer"); return curtext; }
// Set up listeners for beer choices function setUpListeners() { cListener([chooseBeer, "Light Beer"], "lightBeer"); cListener([chooseBeer, "Strong Beer"], "strongBeer"); }
// Handle beer choice function chooseBeer(beerType) { let increaseRate = beerType === "Light Beer" ? 5 : 10; bladderLevel += increaseRate; checkBladder(); }
// Check bladder status and handle bathroom visit function checkBladder() { if (bladderLevel >= 20) { attemptToUseRestroom(); } }
// Attempt to use the restroom function attemptToUseRestroom() { if (Math.random() < 0.5) { sayText("Restroom is available."); bladderLevel = 0; // Reset bladder level after using the restroom } else { sayText("Restroom is not available. Choose an alternative:"); offerRestroomAlternatives(); } }
// Offer alternatives when the restroom is not available function offerRestroomAlternatives() { cListener([useStaffRestroom, "Use Staff Restroom"], "staffRestroom"); cListener([useNearbyCafeRestroom, "Use Nearby Cafe Restroom"], "cafeRestroom"); }
// Using the staff restroom function useStaffRestroom() { if (tryPersuasion()) { sayText("You managed to use the staff restroom."); bladderLevel = 0; } else { sayText("You couldn't convince the staff to let you use their restroom."); } }
// Using the restroom at a nearby cafe function useNearbyCafeRestroom() { sayText("You walk to the nearby cafe and use the restroom."); bladderLevel = 0; }
// Attempt to persuade the staff function tryPersuasion() { return Math.random() < 0.5; // 50% chance to succeed in persuasion }
// Function to print the current scenario text function sayText(text) { console.log(text); } Explanation Global Variables: Tracks data and bladder level. Setup Functions: Initializes and fetches data. Event Handling: Manages beer selection and the consequences on bladder pressure. Restroom Logic: Checks availability and handles alternative options when the main restroom is not accessible.
Looking forward to your answer, cheers!
Hi, so there are few things to address here.
If people want to work on this they are free to do so, I'm willing to review prs, but I can't code for you. I'm willing to help people out if they are stuck trying to understand the code or implement something. And people are free to give ideas on what they would like to see in issues (yk like the font size thing) and I'll see what I do with it. But beyond that I don't think there's much I can do with this.
Makes sense, thanks for your transparent assessment. I will try stuff out on my own then and see what I learn on the way because right now it seems as if I cannot add anything useful combined with what you want to offer, what I can understand completely.
I will reach out if/when I have some more to work with, have a good one and thanks again for your work!
Closing this as this isn't an issue and I think fits more in discussions? for the future
Hi there @Forget-About-Me2,
sorry for the trouble, wanted to clone your repo and got a bit confused as it seems.
Now I have a few Ideas about how to make the game a bit more "enjoyable" / enhance the quality of life I hope:
More like this:
Thanks for your work, looking forward to your reply! Cheers