Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-20-2008, 10:32 AM
Member
 
Join Date: Jan 2008
Posts: 1
im-not-alive is on a distinguished road
Simple timer
I'm developing a "private server" for an online game and I'm basically reading commands from different files, example:
Code:
message = You search the crate . . . anim = 881 wait = 2 message = You find nothing.
Theoretically what it should do is send the player a message saying "You search the crate . . .", and then a simple animation comes up and wait 2 seconds before displaying the message "You find nothing." The problem is that the delay happens at the begging of the script so it waits 2 seconds, and then it does the animation and sends both of the messages at the same time.

This should be useful:
Code:
if(token.startsWith("wait")) { try { Thread.sleep(Integer.parseInt(token3[0]) * 1000); } catch(Exception e) { } }
Any help is highly appreciated; thanks in advance.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-20-2008, 10:04 PM
Senior Member
 
Join Date: Jul 2007
Posts: 1,189
hardwired is on a distinguished road
Try doing this animation and waiting inside a background thread so the EventDispatchThread is not blocked by the waiting/sleeping.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to cancel an individual timer in spite of canceling whole timer Java Tip java.util 0 04-04-2008 03:46 PM
CountDown timer Seema Sharma AWT / Swing 1 03-06-2008 05:26 PM
Page Timer deeadeed New To Java 0 12-05-2007 09:44 PM
Help with timer in java barney Advanced Java 1 08-01-2007 11:24 AM
problem with timer Marcus Advanced Java 2 07-01-2007 06:13 AM


All times are GMT +3. The time now is 07:18 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org