Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
Creating a code in the command
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="JayC" data-source="post: 430463" data-attributes="member: 36373"><p>Absolutely against using thread.sleep anywhere in the emulator. This is a noobish way to do it. It causes the entire thread to stop processing - so the whole thread goes into a paused state. Putting this in the wrong spot, could cause your user to freeze until that time is up.</p><p></p><p>Also Sleep takes milliseconds - 1,000 is 1 second. You need to say 10,000 to sleep for 10 seconds.</p><p>[doublepost=1520980422,1520978690][/doublepost]Okay, so since I am going to reply to this and say what not to do, I will reply and give the best possible answer to how I would code this.</p><p>I would create a Timer for each user. Do NOT keep them running 24/7. When you need the timer inside of the code - CREATE IT. Wait for the timer to execute, then discard the timer until you need to create it again.</p><p></p><p>Timers are their own threads, which mean that when that part of your code is reached - You are not pausing the code that is already running. This way your thread can get in, and out and continue with whatever processes it needs to while your timer is ticking away in the background awaiting execution.</p></blockquote><p></p>
[QUOTE="JayC, post: 430463, member: 36373"] Absolutely against using thread.sleep anywhere in the emulator. This is a noobish way to do it. It causes the entire thread to stop processing - so the whole thread goes into a paused state. Putting this in the wrong spot, could cause your user to freeze until that time is up. Also Sleep takes milliseconds - 1,000 is 1 second. You need to say 10,000 to sleep for 10 seconds. [doublepost=1520980422,1520978690][/doublepost]Okay, so since I am going to reply to this and say what not to do, I will reply and give the best possible answer to how I would code this. I would create a Timer for each user. Do NOT keep them running 24/7. When you need the timer inside of the code - CREATE IT. Wait for the timer to execute, then discard the timer until you need to create it again. Timers are their own threads, which mean that when that part of your code is reached - You are not pausing the code that is already running. This way your thread can get in, and out and continue with whatever processes it needs to while your timer is ticking away in the background awaiting execution. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
Creating a code in the command
Top