|
SO I get these errors, and yes I have imported it in the commands and server
Thanks in AdvancedCode:src\server\model\players\TriviaBot.java:58: error: '}' expected {"<shad=255>[Trivia] Which NPC sells magic gear"Zaff"}, ^ src\server\model\players\TriviaBot.java:58: error: unclosed string literal {"<shad=255>[Trivia] Which NPC sells magic gear"Zaff"}, ^ src\server\model\players\TriviaBot.java:59: error: not a statement {"<shad=255>[Trivia] What is the highest rank in the game?", "Owner"}, ^ src\server\model\players\TriviaBot.java:59: error: ';' expected {"<shad=255>[Trivia] What is the highest rank in the game?", "Owner"}, ^ src\server\model\players\TriviaBot.java:59: error: illegal start of type {"<shad=255>[Trivia] What is the highest rank in the game?", "Owner"}, ^ src\server\model\players\TriviaBot.java:59: error: ';' expected {"<shad=255>[Trivia] What is the highest rank in the game?", "Owner"}, ^ 6 errors Press any key to continue . . .
Probably gonna be something so simple... Ive been at this server files for 3 days now. close my eyes and I see ******* code....Code:src\server\model\players\TriviaBot.java:58: error: '}' expected {"<shad=255>[Trivia] Which NPC sells magic gear"Zaff"}, ^ src\server\model\players\TriviaBot.java:58: error: unclosed string literal {"<shad=255>[Trivia] Which NPC sells magic gear"Zaff"}, ^ src\server\model\players\TriviaBot.java:59: error: not a statement {"<shad=255>[Trivia] What is the highest rank in the game?", "Owner"}, ^ src\server\model\players\TriviaBot.java:59: error: ';' expected {"<shad=255>[Trivia] What is the highest rank in the game?", "Owner"}, ^ src\server\model\players\TriviaBot.java:59: error: illegal start of type {"<shad=255>[Trivia] What is the highest rank in the game?", "Owner"}, ^ src\server\model\players\TriviaBot.java:59: error: ';' expected {"<shad=255>[Trivia] What is the highest rank in the game?", "Owner"}, ^ 6 errors Press any key to continue . . .
Just compare these two here:
{"<shad=255>[Trivia] Which NPC sells magic gear"Zaff"},
{"<shad=255>[Trivia] What is the highest rank in the game?", "Owner"},
You forgot a simple "," between the question string and the answer string.
Code:{"<shad=255>[Trivia] Which NPC sells magic gear", Zaff"},
Edit:
My dude Mr.Classic was faster![]()
You are a godsend my fellow much thanks. Told you it'd be simple, i couldnt even copy paste trivia bot. I think its break time.
Code:package server.model.minigames; import server.event.Event; import server.event.EventContainer; import server.event.EventManager; import server.model.players.Player; import server.model.players.PlayerHandler; import server.util.Misc; import server.model.players.Client; public class TriviaBot { public static void startup() { EventManager.getSingleton().addEvent(new Event() { @Override public void execute(EventContainer e) { if (getPlayerCount() > 0) { askQuestion(); } } }, 900000); } public static void attemptAnswer(Player p, String attempt) { if (!currentQuestion.equals("") && attempt.replaceAll("_", " ").equalsIgnoreCase(currentAnswer)) { currentQuestion = ""; p.pkPoints++; sendServerMessage("<shad=255>Well done! "+p.playerName + " has quessed the question correctly and earned 1 Trivia Point!"); } } public static boolean acceptingQuestion() { return !currentQuestion.equals(""); } public static void askQuestion() { final int random = Misc.random(TRIVIA_DATA.length - 1); currentQuestion = TRIVIA_DATA[random][0]; currentAnswer = TRIVIA_DATA[random][1]; sendServerMessage(currentQuestion); } private static int getPlayerCount() { int players = 0; for (Player p : PlayerHandler.players) { if (p != null) players++; } return players; } private static void sendServerMessage(String message) { for (Player p : PlayerHandler.players) { if (p != null) { ((Client)p).sendMessage(message); } } } private static final String[][] TRIVIA_DATA = { {"<shad=255>[Trivia] What is the highest combat level in the game?", "126"}, {"<shad=255>[Trivia] What is the highest leveled NPC in the game?", "Corporal Beast"}, {"<shad=255>[Trivia] Who created the server originally?", "InsidiaX"}, {"<shad=255>[Trivia] Which NPC sells magic gear"Zaff"}, {"<shad=255>[Trivia] What is the highest rank in the game?", "Owner"}, }; private static String currentQuestion; private static String currentAnswer; }
New errors, Im stuck and so tired, gonna post them, head to bed, wake up, try to fix, if I cant I'll look here. lol
Code:src\server\model\players\packets\Commands.java:14: error: cannot find symbol import server.model.players.TriviaBot; ^ symbol: class TriviaBot location: package server.model.players src\server\Server.java:20: error: cannot find symbol import server.model.players.TriviaBot; ^ symbol: class TriviaBot location: package server.model.players src\server\model\players\packets\Commands.java:143: error: cannot find symbol if(TriviaBot.acceptingQuestion()){ ^ symbol: variable TriviaBot location: class Commands src\server\model\players\packets\Commands.java:144: error: cannot find symbol TriviaBot.attemptAnswer(c, triviaAnswer); ^ symbol: variable TriviaBot location: class Commands Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 4 errors Press any key to continue . . .
« Insanityx 317Pi Base | Ascend Saving Character Files Help » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |