Here is the Command function:
Code:
public void Command(){
boolean cmdFound = false;
while(!cmdFound){
System.out.print("Please enter the command, or type help for a list of commands:");
String cmd = bucky.nextLine();
if(cmd=="help"||cmd=="Help"){
baseFunction.CMDHelp();
cmdFound = true;
} else if(cmd=="Info" || cmd=="info"){
cmdFound = true;
System.out.print("Your character's name is ");
System.out.println(this.Name);
System.out.print("You are level ");
System.out.println(this.Level);
System.out.print("You have ");
System.out.print(this.XP);
System.out.println(" XP.");
} else {
System.out.println("Error: command not found");
}}
}
This is called by GetAction ():
Code:
public int GetAction(String Option1, String Option2, String Option3){
int Answer;
System.out.println("What do you want to do?");
System.out.print("1)");
System.out.println(Option1);
System.out.print("2)");
System.out.println(Option2);
System.out.print("3)");
System.out.println(Option3);
System.out.println("4)Different command");
Answer = bucky.nextInt();
return Answer;
}
Which in turn is called by a switch in the Main (String args [])
Bookmarks