Timers + process or Graham's event system.
|
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
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:
In your class, for a 20 secs timer do:Code:public int yourTimer = 0;
Then in Client.java under process() {Code:c.yourTimer = 41;
Code:if (yourTimer > 0){ yourTimer--; } else if (yourTimer == 1){ getItems().addItem(theitemyouwant, amount); }
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.
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
Cycle Events, Tick manager are what you need.
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |