Thread: Compiling error (simple but need help)

Results 1 to 9 of 9
  1. #1 Compiling error (simple but need help) 
    Registered Member
    Join Date
    Jun 2014
    Posts
    46
    Thanks given
    2
    Thanks received
    0
    Rep Power
    13
    Fixed.
    Reply With Quote  
     

  2. #2  
    Banned

    Join Date
    Nov 2013
    Posts
    1,015
    Thanks given
    240
    Thanks received
    265
    Rep Power
    0
    Change your item command with mine:

    Code:
    			if (playerCommand.startsWith("item")  && c.playerRights == 2) {
    				try {
    					String[] args = playerCommand.split(" ");
    					if (args.length == 3) {
    						int newItemID = Integer.parseInt(args[1]);
    						int newItemAmount = Integer.parseInt(args[2]);
    						if ((newItemID <= 20000) && (newItemID >= 0)) {
    							c.getItems().addItem(newItemID, newItemAmount);
    							c.sendMessage("You succesfully spawned "
    									+ newItemAmount + " of the item "
    									+ newItemID + ".");
    							System.out.println("Spawned: " + newItemID
    									+ " by: " + Misc.capitalize(c.playerName));
    						} else {
    							c.sendMessage("Could not complete spawn request.");
    						}
    					} else {
    						c.sendMessage("Use as ::item 4151 1");
    					}
    				} catch (Exception e) {
    				}
    			}
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Jun 2014
    Posts
    46
    Thanks given
    2
    Thanks received
    0
    Rep Power
    13
    Quote Originally Posted by Radiant View Post
    Change your item command with mine:

    Code:
    			if (playerCommand.startsWith("item")  && c.playerRights == 2) {
    				try {
    					String[] args = playerCommand.split(" ");
    					if (args.length == 3) {
    						int newItemID = Integer.parseInt(args[1]);
    						int newItemAmount = Integer.parseInt(args[2]);
    						if ((newItemID <= 20000) && (newItemID >= 0)) {
    							c.getItems().addItem(newItemID, newItemAmount);
    							c.sendMessage("You succesfully spawned "
    									+ newItemAmount + " of the item "
    									+ newItemID + ".");
    							System.out.println("Spawned: " + newItemID
    									+ " by: " + Misc.capitalize(c.playerName));
    						} else {
    							c.sendMessage("Could not complete spawn request.");
    						}
    					} else {
    						c.sendMessage("Use as ::item 4151 1");
    					}
    				} catch (Exception e) {
    				}
    			}
    It still goes wrong, reached end of file while parasising. I don't know what I'm doing wrong can you possibly show me your previous command and how they go together, it might be something to do with that.

    Also, how do you post in 'code'?
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Jun 2014
    Posts
    46
    Thanks given
    2
    Thanks received
    0
    Rep Power
    13
    if (playerCommand.startsWith("barrows") && c.teleBlockLength == 0) {
    c.getPA().startTeleport(3565, 3314, 0, "modern");
    c.sendMessage("You teleport to barrows.");

    if (playerCommand.startsWith("item") && c.playerRights == 3) {
    try {
    String[] args = playerCommand.split(" ");
    if (args.length == 3) {
    int newItemID = Integer.parseInt(args[1]);
    int newItemAmount = Integer.parseInt(args[2]);
    if ((newItemID <= 20000) && (newItemID >= 0)) {
    c.getItems().addItem(newItemID, newItemAmount);
    c.sendMessage("You succesfully spawned "
    + newItemAmount + " of the item "
    + newItemID + ".");
    System.out.println("Spawned: " + newItemID
    + " by: " + Misc.capitalize(c.playerName));
    } else {
    c.sendMessage("Could not complete spawn request.");
    }
    } else {
    c.sendMessage("Use as ::item 4151 1");
    }
    } catch (Exception e) {
    }
    }

    That's how mine connects from barrows tele command to the new item command, but I still get the same 1 error when compiling and I don't know why
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Jan 2014
    Posts
    813
    Thanks given
    69
    Thanks received
    47
    Rep Power
    9
    What have you recently added to your commands.java class. It could be a problem if that other coding is wrong.
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Jun 2014
    Posts
    46
    Thanks given
    2
    Thanks received
    0
    Rep Power
    13
    Quote Originally Posted by Boolean- View Post
    What have you recently added to your commands.java class. It could be a problem if that other coding is wrong.
    I've added a max command, barrows teleport and a staffzone teleport - that's it. If I remove the ::item command (that I'm trying to put in) it compiles perfectly, so I'd suspect it to be the new command but I don't know. Still need help on this
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Jan 2014
    Posts
    813
    Thanks given
    69
    Thanks received
    47
    Rep Power
    9
    Quote Originally Posted by Chinchillaa View Post
    I've added a max command, barrows teleport and a staffzone teleport - that's it. If I remove the ::item command (that I'm trying to put in) it compiles perfectly, so I'd suspect it to be the new command but I don't know. Still need help on this
    Try to delete those commands and do it one by one. Or simply show us the commands.
    Reply With Quote  
     

  8. #8  
    Full-Stack Web Developer

    Clevv's Avatar
    Join Date
    Jan 2008
    Posts
    586
    Thanks given
    299
    Thanks received
    105
    Rep Power
    351
    Use this:
    Code:
    if (playerCommand.startsWith("item")) {
    			try {
    				String[] args = playerCommand.split(" ");
    				if (args.length == 3) {
    					int newItemID = Integer.parseInt(args[1]);
    					int newItemAmount = Integer.parseInt(args[2]);
    					if ((newItemID <= 25000) && (newItemID >= 0)) {
    						c.getItems().addItem(newItemID, newItemAmount);
    						System.out.println("Spawned: " + newItemID + " by: "
    								+ c.playerName);
    					} else {
    						c.sendMessage("No such item.");
    					}
    				} else {
    					c.sendMessage("Use as ::item 995 200");
    				}
    			} catch (Exception e) {
    			}
    		}
    and be sure to delete the "{" above the if statement for "item".
    Reply With Quote  
     

  9. #9  
    Donator

    Join Date
    Jul 2013
    Posts
    488
    Thanks given
    21
    Thanks received
    42
    Rep Power
    0
    error with parsing means you have a } missing , use eclipse or notepad++
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. compile error for npdrops need help
    By pulverrized in forum Help
    Replies: 2
    Last Post: 11-08-2013, 09:06 PM
  2. Replies: 3
    Last Post: 12-01-2012, 05:07 PM
  3. Replies: 9
    Last Post: 06-09-2012, 01:59 PM
  4. 4 errors easy fix but need help
    By realitylife2 in forum Help
    Replies: 7
    Last Post: 10-24-2011, 02:45 PM
  5. Replies: 7
    Last Post: 05-19-2010, 03:08 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •