Thread: Error with else statement

Results 1 to 3 of 3
  1. #1 Error with else statement 
    Registered Member
    Join Date
    Apr 2016
    Posts
    194
    Thanks given
    25
    Thanks received
    3
    Rep Power
    63
    Howdy y'all.

    Starting off by saying this is a PI and I use Eclipse.
    For this one I'm up in the firstclickobject method up in ActionHandler.java

    Im just requiring a certain key for an Icy Gate. At the moment it moves you just fine but if I try and add the else statement in it throws errors in Eclipse and says syntax error on token else delete token and thats it. A little puzzling. Now I know what a syntax error is but I don't see where. I might also add that this form of else statement is everywhere in the same method...

    Code:
    case 6461:
    			if (c.getItems().playerHasItem(9662, 1));
    			c.getItems().deleteItem2(9662, 1);
    			c.getPA().movePlayer(3056, 9562, 0);
    		} else {
    			c.sendMessage("Maybe one of these Wyverns is hiding the key...");
    		}
    break;
    Reply With Quote  
     

  2. #2  
    Appellate Moderator



    Join Date
    Jan 2009
    Posts
    5,653
    Thanks given
    1,069
    Thanks received
    3,366
    Rep Power
    5000
    Quote Originally Posted by Raiga View Post
    Howdy y'all.

    Starting off by saying this is a PI and I use Eclipse.
    For this one I'm up in the firstclickobject method up in ActionHandler.java

    Im just requiring a certain key for an Icy Gate. At the moment it moves you just fine but if I try and add the else statement in it throws errors in Eclipse and says syntax error on token else delete token and thats it. A little puzzling. Now I know what a syntax error is but I don't see where.

    Code:
    case 6461:
    			if (c.getItems().playerHasItem(9662, 1));
    			c.getItems().deleteItem2(9662, 1);
    			c.getPA().movePlayer(3056, 9562, 0);
    		} else {
    			c.sendMessage("Maybe one of these Wyverns is hiding the key...");
    			break;
    		}

    Code:
    case 6461:
        if (c.getItems().playerHasItem(9662, 1)) {
            c.getItems().deleteItem2(9662, 1);
            c.getPA().movePlayer(3056, 9562, 0);
        } else {
            c.sendMessage("Maybe one of these Wyverns is hiding the key...");
        }
        break;
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Registered Member
    Join Date
    Apr 2016
    Posts
    194
    Thanks given
    25
    Thanks received
    3
    Rep Power
    63
    Quote Originally Posted by Spooky View Post
    Code:
    case 6461:
        if (c.getItems().playerHasItem(9662, 1)) {
            c.getItems().deleteItem2(9662, 1);
            c.getPA().movePlayer(3056, 9562, 0);
        } else {
            c.sendMessage("Maybe one of these Wyverns is hiding the key...");
        }
        break;
    Ah thank you. The nonsense a missing bracket can cause.
    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. Help with If/Else statement
    By JacobiYounger in forum Help
    Replies: 14
    Last Post: 10-10-2013, 11:06 PM
  2. Player yell with cases and not IF-ELSE statements!
    By Versuprace in forum Snippets
    Replies: 26
    Last Post: 10-24-2012, 01:37 AM
  3. Error with class8
    By Elid in forum Help
    Replies: 5
    Last Post: 10-15-2008, 06:15 PM
  4. Replies: 14
    Last Post: 08-28-2008, 02:12 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
  •