Instalar Steam
iniciar sesión
|
idioma
简体中文 (Chino simplificado)
繁體中文 (Chino tradicional)
日本語 (Japonés)
한국어 (Coreano)
ไทย (Tailandés)
български (Búlgaro)
Čeština (Checo)
Dansk (Danés)
Deutsch (Alemán)
English (Inglés)
Español - España
Ελληνικά (Griego)
Français (Francés)
Italiano
Bahasa Indonesia (indonesio)
Magyar (Húngaro)
Nederlands (Holandés)
Norsk (Noruego)
Polski (Polaco)
Português (Portugués de Portugal)
Português - Brasil (Portugués - Brasil)
Română (Rumano)
Русский (Ruso)
Suomi (Finés)
Svenska (Sueco)
Türkçe (Turco)
Tiếng Việt (Vietnamita)
Українська (Ucraniano)
Informar de un error de traducción
I couldn't find anything about them decreasing it either. :/
@Gekkibi - Is there something similar to 'sleep' (java) in C# that works in-game? Are you saying you can delay a timer (to trigger now) in milliseconds via programmable block (and possibly another timer)? I'm not clear on that.
Edit: http://stackoverflow.com/questions/91108/how-do-i-get-my-c-sharp-program-to-sleep-for-50-msec
Is this applicable in-game?
I had this problem earlier when I was trying to make a laser array that fired at <1 second intervals. What I did was I made a mechanical clock out of a rotor using sensors.
Gotcha.
Ingenious workaround, but won't work for what I'm doing. Thanks for sharing.
So <1 second is a really bad idea.
Interestingly while Ctrl+Click allows you to set the value up to the 3rd decimal place, it appears to get rounded.
According to mod API this value is a float already. So at the very least they have room for this kind of change.
They don't want polling scripts to be run too often (<1 second).
If we could set timers to 1.5, how long would it take for someone too set up 3 timers*:
A is set to 1.5 delay and then start/trigger now C
B and C are set to 1 second delay, restarting themself and triggering the same work
Start A and B at same time.
After 2.5 seconds you have two timers doing the same action every 0.5 seconds.
Just give me one timer with ms precision, one programming block and a large enough vanilla timer group and I will make you a script doing the same operation at any time resolution.
I guess they just really saw that comming.
*From writing this post it is 0 seconds
Thus it actually forces us to use a less elegant solution to get what we want.
As for the current solution, you can set up a timer and programmable block in such a way:
Timer:
- run the PB
PB:
- store the last time the script ran
- store the time you want to wait
- check if the different between stored time and current time exceeds the time you want to wait
- if not then terminate the script
- if it does then do what you want to do
The script would not continue in both cases, backup the stack and store the current position with the execution.
When the time x for Sleep has passed in case of a Sleep(x) call or the PBs Notify() method was called in case of Wait(), then it would continuee where it previously halted with the stack backup at the old/stored position.
So it actually would be possible.
Handling all PBs through separate threads internally would make the whole setup even easier.
The huge drawback of that however is the performance impact that approach had.
Instead, it is best to use the approach i described above and check the passed time relative to a stored time.
Just to clarify, you're saying that the Timer will keep executing the PB with Trigger Now until the current time exceeds the time you want to wait.
Timer -> run PB
PB -> checks time diff
PB -> do work if time is above waiting time
PB -> TriggerNow Timer
and it loops again, the time runs the PB, PB checks ....
Thanks!