ID:164958
 
Is there a way to get a shorter sleep time than 1? I know that its 1/10th of a second, but its too slow for what I'm trying to do.

I have a HUD text display that shows up when you talk to NPCS or when an event is triggered but they take a lot of time to talk, especially during a fast paced thing (Like someone screaming in fear then running). I suppose I could make it sleep only every X letters that show up but it wouldn't look as good as it does when every letter appears by itself.

Any help with this would be great.
I usually do if(prob(25)) sleep(1)
In response to Xx Dark Wizard xX
Hmm that would probably work best. Thanks.

They should make decimal values work with sleep >_>
In response to Polantaris
You could just use the modulus operator.
mob
proc
ScreenText(string)
for(var/i = 1 to length(string))
if((i % 4) == 0)sleep(1) // sleep every 4 characters
In response to Xx Dark Wizard xX
THats true but the prob() way is (technically) the same effect and using that would take more integrating that I need to deal with with using prob() instead anyway. THanks.
sleep() with no arguments at all will only pause for a moment when the server is stressed.
In response to CaptFalcon33035
Yeah but then it's like not having it anyway. I believe a sleep() is like a millisecond or something.
In response to Polantaris
I don't think it would be possibl for decimal values. Correct me if I'm wrong, but I believe sleep() works with the 10 FPS system on BYOND, and allowing decimals just simply would not work. I mean, why else would we be limited to 10 FPS? My guess is the 10 tick system.
In response to Polantaris
Not really. It makes a very big difference on some loops. If your loop is CPU-intensive, BYOND might pick up an infinite loop runtime and cancel it or something. Using a sleep() procedure with no arguments will actually wait for the host's PC to slow down a second so that DS does not crash.
In response to CaptFalcon33035
Oh I didnt know that.
In response to CaptFalcon33035
That actually might solve a problem I have in another project. XD Thanks if it does.
In response to Polantaris
Polantaris, may I talk to you in e-mail? Got a few questions to ask regarding Slime Journey. (mine is [email protected])

Umm, about sleep.

obj
lol
icon='66.dmi'
icon_state="1"
sleep(1)
del(src)
In response to Polantaris
Polantaris wrote:
THats true but the prob() way is (technically) the same effect

Uh, no it isn't. If you're relying on random integers than you are also relying on random waiting times. sleep()ing at random would probably result in random waiting times, and I don't suppose you'd want to rely on luck to operate your system.

In theory, though, DM may base its randomness upon a counter of some sort, and thus would result in constant waiting times. I'm not too sure about that, though. You probably won't get the quarter you're attempting to achieve here even if it was constant, as time would probably be counted differently (thus resulting in an eighth or a half, or a second, or something of the sort).
In response to King of Slimes
You can't call procedures outside of other procedures. That belongs in Code Problems.
In response to CaptFalcon33035
Polantaris, I sent a e-mail :D