toyspana.blogg.se

Download space engineers programmable block for free
Download space engineers programmable block for free







download space engineers programmable block for free

If((updateSource & (UpdateType.Update1 | UpdateType.Update10)) != 0) If((updateSource & UpdateType.Update100) != 0) You need to use bitwise operations again. Since this enum can have multiple values, you can't do simple comparison with =. In this case, the update is batched, and updateSource will have all three flags in it, and the script will be run only once, instead of three times.

download space engineers programmable block for free

That is, if your script is set to update on 1, 10, and 100, there's a chance all three can run at the same time. This is because all the self-update sources are batched. Note that UpdateType is a Flags enum, meaning it can have multiple flags in one value. Like the string argument, this is optional and can be omitted (however, you cannot omit the string argument and have only the updateSource argument). / Script is updating once before the tick. / Script run by another programmable block. / Script run by antenna receiving a message. / Script run by a block such as timer, sensor. / Enum describes what source triggered the script to run. The updateSource argument will tell you *how* the script is being run. There's now a new argument on the Main method. This is useful when you want a one-shot update on the next tick, like initialization code or a function that should only run when triggered by an outside event. After this update, the Once flag is removed. This is a special flag which schedules your script for one bonus update on the next game tick. Of course, you can also do straight assignment as in the example constructor, if you want to completely overwrite the value, for instance if you want to stop all updating, you can assign Runtime.UpdateFrequency = UpdateFrequency.None which will remove all flags, and stop any future updating.Īlso of note is the UpdateFrequency.Once value. That should cover the basics of adding and removing flags from an enum. Runtime.UpdateFrequency &= ~UpdateFrequency.Update10 Runtime.UpdateFrequency |= UpdateFrequency.Update100 Runtime.UpdateFrequency = UpdateFrequency.Update1 | UpdateFrequency.Update10









Download space engineers programmable block for free