Thread: Adding some sort of delay?[PI]

Results 1 to 8 of 8
  1. #1 Adding some sort of delay?[PI] 
    Registered Member
    Jay's Avatar
    Join Date
    Apr 2012
    Posts
    541
    Thanks given
    96
    Thanks received
    177
    Rep Power
    201
    Hi i was making this code and i wanted to add a delay between 2 things.
    Like when you click something it does an emote, then waits for lets say 20sec and gives you an item/another emote.
    Does anyone knows something about this, tried some things :/
    Any help will be appricated!

    -JJ
    Reply With Quote  
     

  2. #2  
    Zaros Developer

    Nomac's Avatar
    Join Date
    Feb 2011
    Age
    29
    Posts
    1,068
    Thanks given
    318
    Thanks received
    200
    Rep Power
    1092
    Timers + process or Graham's event system.
    Attached image


    Reply With Quote  
     

  3. #3  
    Registered Member
    Jay's Avatar
    Join Date
    Apr 2012
    Posts
    541
    Thanks given
    96
    Thanks received
    177
    Rep Power
    201
    Quote Originally Posted by Rhiel View Post
    Timers + process or Graham's event system.
    Could you explain abit im quite new to Java
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Jan 2012
    Posts
    561
    Thanks given
    43
    Thanks received
    53
    Rep Power
    72
    I'd recommend Graham's event system but knowing you don't know how to make a timer you should do it the easy way;

    In Player.java add:
    Code:
    public int yourTimer = 0;
    In your class, for a 20 secs timer do:
    Code:
    c.yourTimer = 41;
    Then in Client.java under process() {
    Code:
    if (yourTimer > 0){
    yourTimer--;
    } else if (yourTimer == 1){
    getItems().addItem(theitemyouwant, amount);
    }
    Reply With Quote  
     

  5. #5  
    Member

    Join Date
    Jul 2011
    Posts
    164
    Thanks given
    12
    Thanks received
    24
    Rep Power
    0
    Why use process?
    Use Cycle based Task Manager
    On Graham's thread near the bottom of the post he shows you how to use it.
    I recommend going there.


    "He who asks a question is a fool for five minutes; he who does not ask a question remains a fool forever."
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Jan 2012
    Posts
    561
    Thanks given
    43
    Thanks received
    53
    Rep Power
    72
    Quote Originally Posted by A s i a n View Post
    Why use process?
    Use Cycle based Task Manager
    On Graham's thread near the bottom of the post he shows you how to use it.
    I recommend going there.
    I said that myself but if he wants to fix it now, why would he require the event system?
    Reply With Quote  
     

  7. #7  
    Registered Member
    Jay's Avatar
    Join Date
    Apr 2012
    Posts
    541
    Thanks given
    96
    Thanks received
    177
    Rep Power
    201
    Someone else has something i can use, as i tried the first one but didnt really worked :/
    i need to use it in useitem.java so it delays something
    Reply With Quote  
     

  8. #8  
    Registered Member
    LeBron James's Avatar
    Join Date
    Jan 2009
    Posts
    1,510
    Thanks given
    166
    Thanks received
    129
    Rep Power
    165
    Cycle Events, Tick manager are what you need.



    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. Replies: 3
    Last Post: 06-23-2012, 07:26 PM
  2. what sort of a leacher does this -.-
    By Jilic-Matt in forum Spam
    Replies: 20
    Last Post: 09-05-2011, 12:50 AM
  3. Adding an Delay [EASY]
    By Fakeblitz in forum Help
    Replies: 5
    Last Post: 07-11-2010, 05:51 PM
  4. Adding a delay to method executing
    By Seb Bruce in forum Snippets
    Replies: 29
    Last Post: 01-12-2010, 11:10 PM
  5. Adding Delay.
    By Premiere in forum Help
    Replies: 8
    Last Post: 10-07-2009, 12:14 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
  •