public class StoryTeller { int userInput = 1; //set to 1 so that the program starts properly String newText; int windOpinion, hardKnockOpinion, blueBloodOpinion, uraOpinion; int room; //what room the player is in int scene; //what scene it is int largestChoice = 4; public StoryTeller(int currentScene, int currentRoom, int newWindOpinion, int newHardKnockOpinion, int newBlueBloodOpinion, int newUraOpinion) { scene = currentScene; room = currentRoom; windOpinion = newWindOpinion; hardKnockOpinion = newHardKnockOpinion; blueBloodOpinion = newBlueBloodOpinion; uraOpinion = newUraOpinion; } /** * method for reading user choice input and error checking that input opinion * @param input the input from the main program GUI * @param largestChoice * @return true if the input is valid and false if the input is not */ public boolean readInput(String input) { try { userInput = Integer.parseInt(input); } catch(Exception e) { userInput = 9999; } if (userInput <= largestChoice) { return true; } else { return false; } } //returns the full story public String continueStory(String story, Story aStory) { String text = story + "\n" + aStory.returnNewText(userInput); largestChoice = aStory.getLargestChoice(); return text; } }