Thread: weird code behaviour?

Results 1 to 1 of 1
  1. #1 weird code behaviour? 
    Community Veteran

    mige5's Avatar
    Join Date
    Aug 2008
    Posts
    5,528
    Thanks given
    573
    Thanks received
    1,410
    Rep Power
    2114
    EDIT: solved, there was another method that was run in same time (which shouldnt be running) that caused this.

    Note: I have simplified the method by removing extra stuff from it, but its basically like this:
    Code:
    static int loopCount;
    	
    	public static void randomMethod(int count){
    		loopCount = 0;
    		final int times = count/150;
    		System.out.println(times);
    		final Tick timer1 = new Tick(6) {
    			@Override
    			public void execute() {
    				int count = loopCount;
    				System.out.println(count);
    				if(times == loopCount)
    					this.stop();
    				loopCount++;
    	    	}
    		};
    	    World.getTickManager().submit(timer1);
    	}
    Now lets input 250 to that method:
    Code:
    1st print ("times") = 1
    2nd print ("count") = 0
    3rd print ("count") = 0
    4th print ("count") = 2
    5th print ("count") = 3
    .
    .
    .
    ^Because its skipping count = 1 it will continue forever... but how can it skip count=1?
    Number of page #1 releases with most views & posts: (Updated: 2023)
    RS2 server section: 1
    RS2 client section: 2
    Reply With Quote  
     

  2. Thankful user:



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. Replies: 9
    Last Post: 09-02-2013, 06:04 AM
  2. Weird code in process(), in every delta!
    By Division in forum Help
    Replies: 15
    Last Post: 04-28-2010, 03:20 AM
  3. Wow this is kinda weird
    By aznsoldier6 in forum Chat
    Replies: 7
    Last Post: 01-16-2008, 04:15 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
  •