Thread: Boolean not changing...

Results 1 to 10 of 10
  1. #1 Boolean not changing... 
    Registered Member BryceTheCoder's Avatar
    Join Date
    Aug 2008
    Posts
    740
    Thanks given
    21
    Thanks received
    24
    Rep Power
    27
    Ok I am seriously to a point of total dumbness.... I look at this and NOTHING it wrong, but for some reason it is......

    So the boolean "isMining" is very self-explanatory.

    Look at my mining code:

    Code:
    public void mineEssence(int objX, int objY) {
    		
    		if (c.isMining) {
    			c.sendMessage("@red@DEBUG: mining");
    			return;
    		} else {
    			c.sendMessage("@red@DEBUG: not mining");
    		}
    			
    		
    		c.turnPlayerTo(objX, objY);
    		
    		if (Misc.random(60) == 1) {
    			AntiBot.showRedButton(c);
    			return;
    		}
    		
    		if (c.getItems().freeSlots() < 1) {
    			c.getPA().sendStatement("You do not have any inventory space.");
    			return;
    		}
    		
    		aaa = -1;
    		
    		for (int i = 0; i < Pick_Settings.length; i++) {
    			if (c.getItems().playerHasItem(Pick_Settings[i][0]) || c.playerEquipment[c.playerWeapon] == Pick_Settings[i][0]) {
    				if (Pick_Settings[i][1] <= c.playerLevel[c.playerMining]) {
    					aaa = i;
    				}
    			}
    		}
    		
    		if (aaa == -1) {
    			c.getPA().sendStatement("You need a pickaxe to mine this.");
    			return;
    		}
    			
    		c.isMining = true;
    		c.startAnimation(Pick_Settings[aaa][3]);
    		CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
    			@Override
    			public void execute(CycleEventContainer container) {
    				if (c.isMining) {
    					c.getItems().addItem(1436, 1);
    					c.getPA().addSkillXP(80, c.playerMining);
    					c.startAnimation(Pick_Settings[aaa][3]);
    				} else {
    					container.stop();
    				}
    				
    				if (c.getItems().freeSlots() < 1) {
    					container.stop();
    					c.getPA().sendStatement("You do not have any more inventory space.");
    				}
    			}
    			@Override
    			public void stop() {
    				c.startAnimation(65535);
    				c.isMining = false;
    			}
    		}, 1 + Misc.random(2));
    	}
    And it seriously will say "not mining" if I keep clicking on the object that calls mineEssences()

    however it clearly states the boolean to true and it is just not changing.... wtf is going on?
    Reply With Quote  
     

  2. #2  
    Registered Member BryceTheCoder's Avatar
    Join Date
    Aug 2008
    Posts
    740
    Thanks given
    21
    Thanks received
    24
    Rep Power
    27
    Wow shit..... I just was debugging for the past hour and ran a command

    Code:
    if (playerCommand.equalsIgnoreCase("b"))
    				c.isMining = true;

    and that still had my isMining boolean to false.....
    I must have someone consatntly running that sets it to false or something..

    I'm so damn lost
    Reply With Quote  
     

  3. #3  
    Registered Member Hat_'s Avatar
    Join Date
    Nov 2013
    Posts
    21
    Thanks given
    0
    Thanks received
    2
    Rep Power
    11
    where does it say its true apart from the line with animation?

    Reply With Quote  
     

  4. #4  
    Registered Member BryceTheCoder's Avatar
    Join Date
    Aug 2008
    Posts
    740
    Thanks given
    21
    Thanks received
    24
    Rep Power
    27
    Quote Originally Posted by Danny- View Post
    x = true
    Don't know wtf that reply was for haha.


    Quote Originally Posted by Hat_ View Post
    where does it say its true apart from the line with animation?
    Nowhere.
    Reply With Quote  
     

  5. #5  
    Registered Member Hat_'s Avatar
    Join Date
    Nov 2013
    Posts
    21
    Thanks given
    0
    Thanks received
    2
    Rep Power
    11
    Quote Originally Posted by BryceTheCoder View Post
    Don't know wtf that reply was for haha.




    Nowhere.

    exactly.. if the booleans false its going to say its false? pm me and i can help you

    Reply With Quote  
     

  6. #6  
    Registered Member BryceTheCoder's Avatar
    Join Date
    Aug 2008
    Posts
    740
    Thanks given
    21
    Thanks received
    24
    Rep Power
    27
    Quote Originally Posted by Hat_ View Post
    exactly.. if the booleans false its going to say its false? pm me and i can help you
    Unfortunately, (not trying to be rude) but you don't understand/know whats going on.
    It clearly states right there to make it true, soo why would you say its never gona change when it states to be true there?
    But I have figured this all out and no need for this thread anymore.
    Thanks anyways.
    Reply With Quote  
     

  7. #7  
    Registered Member

    Join Date
    Dec 2011
    Posts
    1,615
    Thanks given
    1,971
    Thanks received
    819
    Rep Power
    1049
    Code:
    if (playerCommand.equalsIgnoreCase("b"))
    				c.isMining = true;
    Should be

    Code:
    if (playerCommand.equalsIgnoreCase("b")) {
    				c.isMining = true;
    }
    Just for the record.

    Also, there's nothing that's actually making the boolean set to true. It appears to be true by default, but you need to set it to true when you click on a rune essence rock or something.


    Quote Originally Posted by Jason View Post
    No actually, it doesn't have to be. A conditional statement with a single line to follow doesn't require the condition to have curly braces.
    Reply With Quote  
     

  8. #8  
    Donator

    Jason's Avatar
    Join Date
    Aug 2009
    Posts
    6,092
    Thanks given
    2,402
    Thanks received
    2,823
    Rep Power
    4550
    Quote Originally Posted by Murilirum View Post
    Code:
    if (playerCommand.equalsIgnoreCase("b"))
                    c.isMining = true;
    Should be

    Code:
    if (playerCommand.equalsIgnoreCase("b")) {
                    c.isMining = true;
    }
    Just for the record.

    Also, there's nothing that's actually making the boolean set to true. It appears to be true by default, but you need to set it to true when you click on a rune essence rock or something.
    No actually, it doesn't have to be. A conditional statement with a single line to follow doesn't require the condition to have curly braces.

    OT: If you have eclipse, and a decent computer then send me a PM with your teamviewer information and i'll try and resolve this for you.
    Reply With Quote  
     

  9. #9  
    Registered Member

    Join Date
    Dec 2011
    Posts
    1,615
    Thanks given
    1,971
    Thanks received
    819
    Rep Power
    1049
    Quote Originally Posted by Jason View Post
    No actually, it doesn't have to be. A conditional statement with a single line to follow doesn't require the condition to have curly braces.
    I stand corrected. Jason knows Java much better than I ^ Listen to him.

    Adjusted my post to avoid confusion.
    Reply With Quote  
     

  10. Thankful user:


  11. #10  
    PokeFrontier Java Developer

    Pokemon's Avatar
    Join Date
    May 2011
    Posts
    2,726
    Thanks given
    495
    Thanks received
    807
    Rep Power
    1260
    Something else is setting that variable to true then look around run the server on debug mode and on the main loop do

    System.out.println(c.isMining);

    if it prints out true and you haven't mined then make a command that sets the variable to false

    if it keepts setting it to true

    Look around files that are setting this variable to true once you find the method causing this comment it out and see if it starts spamming false once you use the command again.


    Attached image


    I love
    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. (pi) "CURSES" NOT CHANGEING
    By Aymen in forum Help
    Replies: 0
    Last Post: 10-13-2011, 02:45 AM
  2. Replies: 0
    Last Post: 08-02-2011, 06:48 AM
  3. Hmm JFrame size will not change?
    By Simon in forum Application Development
    Replies: 3
    Last Post: 09-28-2009, 04:42 PM
  4. Ip not changing?
    By Echo` in forum Help
    Replies: 1
    Last Post: 05-26-2009, 05:28 PM
  5. New "modicons" but not changing playerrights
    By Zee Best in forum Show-off
    Replies: 23
    Last Post: 04-11-2009, 07:16 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •