Sometimes there are situations where script callbacks are not synchronized. While they are best avoided, it's not always feasible and the idea is that you do only non-sync-changing stuff in them.
For example I think there used to be a "MusicFinished"-callback that allowed a script to play the next piece. This was probably when AsyncRandom was added. It was later replaced by Playlists. I think portrait assignment also used AsyncRandom because portraits were not synchronized.
I also added an AsyncGet-callback to custom properties in the new editor because I want them to work when multiple people are editing in paused mode. They just call stuff like GetColor(), but they may also want to call AsyncRandom at some point.
> For example I think there used to be a "MusicFinished"-callback that allowed a script to play the next piece. This was probably when AsyncRandom was added. It was later replaced by Playlists. I think portrait assignment also used AsyncRandom because portraits were not synchronized.
Guenther and me had a look through the old RWD repository and nothing in there uses AsyncRandom, so what it was intended for is anyone's guess.
> I also added an AsyncGet-callback to custom properties in the new editor because I want them to work when multiple people are editing in paused mode. They just call stuff like GetColor(), but they may also want to call AsyncRandom at some point.
This sounds extremely dangerous and I'd rather limit those kinds of property accessors to only call pure functions.
> Guenther and me had a look through the old RWD repository and nothing in there uses AsyncRandom, so what it was intended for is anyone's guess.
I think Soeren wanted to use it in "Ruf der Wipfe" (that's why we also had that weird GetTime() function which only worked in non-network). But I don't know if was ultimately used.
Anyway, we can just re-add it when we need it.
loop
{
if (AsyncRandom(2))
return EliminatePlayers();
if (GetPlayerCount() == 1)
GameOver();
}
Thrilling fun with RandomElimination.ocs! Who might win?
> Guenther and me had a look through the old RWD repository and nothing in there uses AsyncRandom, so what it was intended for is anyone's guess.
To elaborate, the script function is Sven2's fault:
> + Added AsyncRandom for script" (2007)
The curious thing is that he didn't add the implementation, which already existed in the initial revision, containing 4.65, but wasn't exported for some lost reason. It's only a trivial wrapper around SafeRandom, which is actually used for various things in the engine.
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill