Thread: Simple Java Issue

Results 1 to 5 of 5
  1. #1 Simple Java Issue 
    Extreme Donator

    Join Date
    Jul 2014
    Posts
    414
    Thanks given
    46
    Thanks received
    8
    Rep Power
    15
    I don't know what I'm doing wrong, but I edited my GodWars because everytime you would try to access the door with 20 kill count, it would require you to be at a certain tile. Which was causing it to teleport different locations around the room.
    When I removed the method I got all sorts of issues and don't know how to fix it... I've tried everything I know and I'm just simply getting missing syntax errors stuff like that.
    Simple stuff but not for me.

    My code currently:

    http://pastebin.com/t6J4wUUJ

    Errors lay on lines: 180, 168, 156, 144

    Error: Syntax error on token "}", { expected after this token

    And I've tried to insert { but it's leading to more issues.

    --- Fixed by: Armo ---
    Reply With Quote  
     

  2. #2  
    RuneCasino


    Join Date
    Jul 2007
    Posts
    1,647
    Thanks given
    175
    Thanks received
    257
    Rep Power
    358
    Replace it all with this:

    Code:
    package core.framework.game.npc.godwars;
    
    import core.framework.game.WorldObject;
    import core.framework.game.WorldTile;
    import core.framework.game.player.controlers.Controler;
    
    public class Godwars extends Controler {
    
    	public static boolean isArmadylNPC(String npcName) {
    		switch (npcName) {
    		case "Aviansie":
    		case "Kree'arra":
    		case "Wingman Skree":
    		case "Flockleader Geerin":
    		case "Flight Kilisa":
    			return true;
    		}
    		return false;
    	}
    
    	public static boolean isBandosNPC(String npcName) {
    		switch (npcName) {
    		case "Hobgoblin":
    		case "Jogre":
    		case "Cyclops":
    		case "Ork":
    		case "Spiritual warrior":
    		case "Goblin":
    		case "Ogre":
    		case "Sergeant Steelwill":
    		case "General Graardor":
    		case "Sergeant Strongstack":
    		case "Sergeant Grimspike":
    			return true;
    		}
    		return false;
    	}
    
    	public static boolean isSaradominNPC(String npcName) {
    		switch (npcName) {
    		case "Knight of Saradomin":
    		case "Spiritual warrior":
    		case "Saradomin priest":
    		case "Commander Zilyana":
    		case "Bree":
    		case "Starlight":
    		case "Growler":
    			return true;
    		}
    		return false;
    	}
    
    	public static boolean isZammyNPC(String npcName) {
    		switch (npcName) {
    		case "Icefiend":
    		case "Imp":
    		case "Werewolf":
    		case "Vampyre":
    		case "Pyrefiend":
    		case "Spirtual mage":
    		case "Spirual warrior":
    		case "Bloodveld":
    		case "Hellhound":
    		case "Gorak":
    		case "K'ril Tsutsaroth":
    		case "Tstanon Karlak":
    		case "Balfrug Kreeyath":
    		case "Zakl'n Gritch":
    			return true;
    		}
    		return false;
    	}
    
    	private int armadylKC;
    
    	private int bandosKC;
    
    	private int saraKC;
    
    	private int zammyKC;
    
    	public void closeKCInterface() {
    		player.getInterfaceManager().closeOverlay(
    				player.getInterfaceManager().hasRezizableScreen());
    		removeControler();
    		resetKillCount();
    	}
    
    	@Override
    	public void forceClose() {
    		closeKCInterface();
    	}
    
    	public int getArmadylKC() {
    		return armadylKC;
    	}
    
    	public int getBandosKC() {
    		return bandosKC;
    	}
    
    	public int getSaraKC() {
    		return saraKC;
    	}
    
    	public int getZammyKC() {
    		return zammyKC;
    	}
    
    	@Override
    	public boolean login() {
    		closeKCInterface();
    		return false;
    	}
    
    	@Override
    	public boolean logout() {
    		return false;
    	}
    
    	@Override
    	public void magicTeleported(int type) {
    		closeKCInterface();
    	}
    
    	@Override
    	public void moved() {
    		// sendInterfaces();
    	}
    
    	@Override
    	public boolean processObjectClick1(final WorldObject object) {
    		if (object.getId() == 26427) {
    				if (getSaraKC() >= 20) {
    					player.setNextWorldTile(new WorldTile(2902, 5269, 0));
    					setSaraKC(0);
    				} else if (player.getX() == 2907 && player.getY() == 52565) {
    				player.setNextWorldTile(new WorldTile(2908, 5265, 0));
    			} else {
    					player.out("This door is locked by the power of Saradomin! You will need at least 20 kill count before this door will open.");
    				}
    		return false;
    	}
    	if (object.getId() == 26428) {
    				if (getZammyKC() >= 20) {
    					player.setNextWorldTile(new WorldTile(2921, 5327, 2));
    					setZammyKC(0);
    				} else if (player.getX() == 2925 && player.getY() == 5331) {
    				player.setNextWorldTile(new WorldTile(2925, 5332, 2));
    			} else {
    					player.out("This door is locked by the power of Zamorak! You will need at least 20 kill count before this door will open.");
    				}
    		
    			return false;
    		}
    		if (object.getId() == 26426) {
    				if (getArmadylKC() >= 0) {
    					player.setNextWorldTile(new WorldTile(2837, 5306, 2));
    					setArmadylKC(0);
    				} else if (player.getX() == 2839 && player.getY() == 5296) {
    				player.setNextWorldTile(new WorldTile(2839, 5295, 2));
    			} else {
    					player.out("This door is locked by the power of Armadyl! You will need at least 20 kill count before this door will open.");
    				}
    			return false;
    		}
    		if (object.getId() == 26425) {
    				if (getBandosKC() >= 20) {
    					player.setNextWorldTile(new WorldTile(2859, 5356, 2));
    					setBandosKC(0);
    				} else if (player.getX() == 2863 && player.getY() == 5357) {
    				player.setNextWorldTile(new WorldTile(2863, 5354, 2));
    			} else {
    					player.out("This door is locked by the power of Bandos! You will need at least 20 kill count before this door will open.");
    				}
    		
    			return false;
    		}
    	if (object.getId() == 57225) {
    			player.getDialogueManager().startDialogue("NexEntrance");
    			return false;
    		}
    		return true;
    	}
    		
     public void resetKillCount() {
    		setZammyKC(0);
    		setBandosKC(0);
    		setSaraKC(0);
    		setArmadylKC(0);
    	}
    
    	@Override
    	public boolean sendDeath() {
    		closeKCInterface();
    		return true;
    	}
    
    	@Override
    	public void sendInterfaces() {
    		player.getInterfaceManager().sendOverlay(601,
    		player.getInterfaceManager().hasRezizableScreen());
    		//sendKCString(); // default 0 , no need to send
    	}
    
    	public void sendKCString() {
    		player.getPackets().sendIComponentText(601, 8, getArmadylKC() + "");
    		player.getPackets().sendIComponentText(601, 9, getBandosKC() + "");
    		player.getPackets().sendIComponentText(601, 10, getSaraKC() + "");
    		player.getPackets().sendIComponentText(601, 11, getZammyKC() + "");
    	}
    
    	public void setArmadylKC(int armadylKC1) {
    		armadylKC = armadylKC1;
    	}
    
    	public void setBandosKC(int bandosKC1) {
    		bandosKC = bandosKC1;
    	}
    
    	public void setSaraKC(int saraKC1) {
    		saraKC = saraKC1;
    	}
    
    	public void setZammyKC(int zammyKC1) {
    		zammyKC = zammyKC1;
    	}
    
    	@Override
    	public void start() {
    		sendInterfaces();
    	}
    
    }
    Reply With Quote  
     

  3. #3  
    Extreme Donator

    Join Date
    Jul 2014
    Posts
    414
    Thanks given
    46
    Thanks received
    8
    Rep Power
    15
    Quote Originally Posted by Armo View Post
    Replace it all with this:

    Code:
    package core.framework.game.npc.godwars;
    
    import core.framework.game.WorldObject;
    import core.framework.game.WorldTile;
    import core.framework.game.player.controlers.Controler;
    
    public class Godwars extends Controler {
    
    	public static boolean isArmadylNPC(String npcName) {
    		switch (npcName) {
    		case "Aviansie":
    		case "Kree'arra":
    		case "Wingman Skree":
    		case "Flockleader Geerin":
    		case "Flight Kilisa":
    			return true;
    		}
    		return false;
    	}
    
    	public static boolean isBandosNPC(String npcName) {
    		switch (npcName) {
    		case "Hobgoblin":
    		case "Jogre":
    		case "Cyclops":
    		case "Ork":
    		case "Spiritual warrior":
    		case "Goblin":
    		case "Ogre":
    		case "Sergeant Steelwill":
    		case "General Graardor":
    		case "Sergeant Strongstack":
    		case "Sergeant Grimspike":
    			return true;
    		}
    		return false;
    	}
    
    	public static boolean isSaradominNPC(String npcName) {
    		switch (npcName) {
    		case "Knight of Saradomin":
    		case "Spiritual warrior":
    		case "Saradomin priest":
    		case "Commander Zilyana":
    		case "Bree":
    		case "Starlight":
    		case "Growler":
    			return true;
    		}
    		return false;
    	}
    
    	public static boolean isZammyNPC(String npcName) {
    		switch (npcName) {
    		case "Icefiend":
    		case "Imp":
    		case "Werewolf":
    		case "Vampyre":
    		case "Pyrefiend":
    		case "Spirtual mage":
    		case "Spirual warrior":
    		case "Bloodveld":
    		case "Hellhound":
    		case "Gorak":
    		case "K'ril Tsutsaroth":
    		case "Tstanon Karlak":
    		case "Balfrug Kreeyath":
    		case "Zakl'n Gritch":
    			return true;
    		}
    		return false;
    	}
    
    	private int armadylKC;
    
    	private int bandosKC;
    
    	private int saraKC;
    
    	private int zammyKC;
    
    	public void closeKCInterface() {
    		player.getInterfaceManager().closeOverlay(
    				player.getInterfaceManager().hasRezizableScreen());
    		removeControler();
    		resetKillCount();
    	}
    
    	@Override
    	public void forceClose() {
    		closeKCInterface();
    	}
    
    	public int getArmadylKC() {
    		return armadylKC;
    	}
    
    	public int getBandosKC() {
    		return bandosKC;
    	}
    
    	public int getSaraKC() {
    		return saraKC;
    	}
    
    	public int getZammyKC() {
    		return zammyKC;
    	}
    
    	@Override
    	public boolean login() {
    		closeKCInterface();
    		return false;
    	}
    
    	@Override
    	public boolean logout() {
    		return false;
    	}
    
    	@Override
    	public void magicTeleported(int type) {
    		closeKCInterface();
    	}
    
    	@Override
    	public void moved() {
    		// sendInterfaces();
    	}
    
    	@Override
    	public boolean processObjectClick1(final WorldObject object) {
    		if (object.getId() == 26427) {
    				if (getSaraKC() >= 20) {
    					player.setNextWorldTile(new WorldTile(2902, 5269, 0));
    					setSaraKC(0);
    				} else if (player.getX() == 2907 && player.getY() == 52565) {
    				player.setNextWorldTile(new WorldTile(2908, 5265, 0));
    			} else {
    					player.out("This door is locked by the power of Saradomin! You will need at least 20 kill count before this door will open.");
    				}
    		return false;
    	}
    	if (object.getId() == 26428) {
    				if (getZammyKC() >= 20) {
    					player.setNextWorldTile(new WorldTile(2921, 5327, 2));
    					setZammyKC(0);
    				} else if (player.getX() == 2925 && player.getY() == 5331) {
    				player.setNextWorldTile(new WorldTile(2925, 5332, 2));
    			} else {
    					player.out("This door is locked by the power of Zamorak! You will need at least 20 kill count before this door will open.");
    				}
    		
    			return false;
    		}
    		if (object.getId() == 26426) {
    				if (getArmadylKC() >= 0) {
    					player.setNextWorldTile(new WorldTile(2837, 5306, 2));
    					setArmadylKC(0);
    				} else if (player.getX() == 2839 && player.getY() == 5296) {
    				player.setNextWorldTile(new WorldTile(2839, 5295, 2));
    			} else {
    					player.out("This door is locked by the power of Armadyl! You will need at least 20 kill count before this door will open.");
    				}
    			return false;
    		}
    		if (object.getId() == 26425) {
    				if (getBandosKC() >= 20) {
    					player.setNextWorldTile(new WorldTile(2859, 5356, 2));
    					setBandosKC(0);
    				} else if (player.getX() == 2863 && player.getY() == 5357) {
    				player.setNextWorldTile(new WorldTile(2863, 5354, 2));
    			} else {
    					player.out("This door is locked by the power of Bandos! You will need at least 20 kill count before this door will open.");
    				}
    		
    			return false;
    		}
    	if (object.getId() == 57225) {
    			player.getDialogueManager().startDialogue("NexEntrance");
    			return false;
    		}
    		return true;
    	}
    		
     public void resetKillCount() {
    		setZammyKC(0);
    		setBandosKC(0);
    		setSaraKC(0);
    		setArmadylKC(0);
    	}
    
    	@Override
    	public boolean sendDeath() {
    		closeKCInterface();
    		return true;
    	}
    
    	@Override
    	public void sendInterfaces() {
    		player.getInterfaceManager().sendOverlay(601,
    		player.getInterfaceManager().hasRezizableScreen());
    		//sendKCString(); // default 0 , no need to send
    	}
    
    	public void sendKCString() {
    		player.getPackets().sendIComponentText(601, 8, getArmadylKC() + "");
    		player.getPackets().sendIComponentText(601, 9, getBandosKC() + "");
    		player.getPackets().sendIComponentText(601, 10, getSaraKC() + "");
    		player.getPackets().sendIComponentText(601, 11, getZammyKC() + "");
    	}
    
    	public void setArmadylKC(int armadylKC1) {
    		armadylKC = armadylKC1;
    	}
    
    	public void setBandosKC(int bandosKC1) {
    		bandosKC = bandosKC1;
    	}
    
    	public void setSaraKC(int saraKC1) {
    		saraKC = saraKC1;
    	}
    
    	public void setZammyKC(int zammyKC1) {
    		zammyKC = zammyKC1;
    	}
    
    	@Override
    	public void start() {
    		sendInterfaces();
    	}
    
    }
    Ayee how'd you fix it bro? Just so I know for next time .
    Reply With Quote  
     

  4. #4  
    RuneCasino


    Join Date
    Jul 2007
    Posts
    1,647
    Thanks given
    175
    Thanks received
    257
    Rep Power
    358
    Quote Originally Posted by Projecteco View Post
    Ayee how'd you fix it bro? Just so I know for next time .
    I switched around some else if statements that were in the wrong order
    Reply With Quote  
     

  5. #5  
    Extreme Donator

    Join Date
    Jul 2014
    Posts
    414
    Thanks given
    46
    Thanks received
    8
    Rep Power
    15
    Quote Originally Posted by Armo View Post
    I switched around some else if statements that were in the wrong order
    Thanks a lot, Armo. I'll hopefully know for next time.
    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. Simple JAVA swing tutorial
    By Karma in forum Application Development
    Replies: 10
    Last Post: 11-04-2009, 08:39 PM
  2. Simple java web server
    By Colby in forum Application Development
    Replies: 0
    Last Post: 06-17-2009, 09:19 AM
  3. Simple Java Errors... I'm Dumb :(
    By Deviants in forum Help
    Replies: 7
    Last Post: 02-16-2009, 08:08 AM
  4. CrasherCrisis - simple java doser
    By Zahhak in forum Downloads
    Replies: 16
    Last Post: 01-02-2009, 02:31 AM
  5. Scu11's Simple Java: Inversing Booleans
    By Scu11 in forum Tutorials
    Replies: 17
    Last Post: 04-13-2008, 01:03 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
  •