Thread: Does not wait

Results 1 to 2 of 2
  1. #1 Does not wait 
    Registered Member
    Join Date
    Oct 2015
    Posts
    92
    Thanks given
    4
    Thanks received
    1
    Rep Power
    31
    When you click object it does not wait at all. you can click the object fast and it will run through the inventory rapidly without waiting 5 secs per click.

    case 5878:
    long lastInteraction = 0;
    long objectDelay = 1_500L;
    if (c.getItems().playerHasItem(960, 1) && System.currentTimeMillis() - lastInteraction < objectDelay) {
    c.startAnimation(878);
    lastInteraction = System.currentTimeMillis();
    c.getItems().deleteItem2(960, 1);
    c.getPA().addSkillXP(10000, Skill.CONSTRUCTION.getId(), true);
    } else {
    c.sendMessage("Wait 5 seconds..");
    }
    break;
    Reply With Quote  
     

  2. #2  
    nbness2#5894

    nbness2's Avatar
    Join Date
    Aug 2011
    Posts
    668
    Thanks given
    248
    Thanks received
    119
    Rep Power
    262
    Your problem here is lastInteraction is always 0 because you are instantiating it right there. I think what you want is Player.lastInteraction variable. Not sure what base you are using, but I can probably wing it.

    Code:
    class Player {
        // code
        private long lastInteraction = 0;
        public long getLastInteraction() { return this.lastInteraction; }
        public void setLastInteraction(long lastInteraction) { this.lastInteraction = lastInteraction; }
        // code
    }
    and then in your function replace System.currentTimeMillis() - lastInteraction with System.currentTimeMillis - c.getLastInteraction() and replace lastInteraction = System.currentTimeMillis(); with c.setLastInteraction(System.currentTimeMillis);
    KT/JAVA - NBX 637 - [Only registered and activated users can see links. ]!
    KT - Drop tables: Simple and Readable - [Only registered and activated users can see links. ]!
    KT - Item Containers: Safe, Easy and Powerful - [Only registered and activated users can see links. ]
    KT - Action: Commands made modular - [Only registered and activated users can see links. ]
    KT - NbUtil: Make your kotlin easier - [Only registered and activated users can see links. ]
    KT - Hopping Islands: From Java to Kotlin - [Only registered and activated users can see links. ] - [Only registered and activated users can see links. ] - [Only registered and activated users can see links. ] - [Only registered and activated users can see links. ]
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 11-08-2008, 09:19 PM
  2. Proper dig emote!-does not do continuely
    By Sub in forum Configuration
    Replies: 3
    Last Post: 05-23-2008, 05:30 PM
  3. Ipwnjagex's Tut Does Not Fill.........
    By i--bl1tz--i in forum Tutorials
    Replies: 2
    Last Post: 09-26-2007, 03:02 PM
  4. Replies: 8
    Last Post: 08-09-2007, 06:06 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
  •