So in SQF we have this:
Is this possible in CSHarp? I know while() works but it seems to freeze the console for me. Any idea's?Code:waitUntil { not alive player }; //This is arma 3 code
Solved C# Wait Until
Discussion in 'Rust Development' started by DylanSMR, Sep 15, 2016.
-
Can waitUntil contain arbitrary code or just specific keywords?
EDIT: Nvm, I looked up the docs.
OnTick with a condition is equivalent to waitUntil.
Keep in mind that this may be very bad for performance and performs way worse than normal hooks. -
Yeah I knew it would be somewhat bad for server frames. In Arma they somewhat optimized it using a algorithm based on how the server is running. So either it checks every frame or every X(frames) dependent on the server stats at the time of check.
-
I suggest staying away from OnTick until you really need it. There aren't many plugins that do. -
such Yield commands works only for nested classes:
Code:using System.Collections;public class WaitUntilExample: MonoBehaviour { public int frame; void Start() { StartCoroutine(Example()); } IEnumerator Example() { Debug.Log("Waiting for princess to be resqued..."); yield return new WaitUntil(() => frame >= 10); Debug.Log("Princess was resqued!"); } void Update() { if (frame <= 10) { Debug.Log("Frame: " + frame); frame++; } } }
-
What exactly do you want to do if I may ask?
-