Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
Runtime.UpdateFrequency = UpdateFrequency.None; // Disable self-execution.
Runtime.UpdateFrequency = UpdateFrequency.Once; // Run on the next tick, then remove.
Runtime.UpdateFrequence = UpdateFrequency.Update1; // Every tick.
Runtime.UpdateFrequency = UpdateFrequency.Update10; // Every 10th tick.
Runtime.UpdateFrequency = UpdateFrequency.Update100; // Every 100th tick.
The script will only run once at any given time, but it passes flags you can read back so you can perform different routines on every tick, every 10, every 100 and the bonus (once), without setting up your own accumulators. eg:
if ((updateSource & UpdateType.Update100) != 0) <something for every 100 ticks>
if ((updateSource & UpdateType.Once) != 0) <special one-off stuff>
You can also freely change between them during the script. Might be useful for things which don't always require per-tick timing, like a radar script which only kicks into "high sensitivity" mode when it actually detects something.
Runtime.UpdateFrequency = UpdateFrequency.Update1 | UpdateFrequency.Update100;
That | in the middle performs a bitwise OR, so you end up with both values effectively set at the same time. You can add or remove other values with bitwise OR or AND statements, such as:
Runtime.UpdateFrequency &= ~UpdateFrequency.Update100; // Bitwise AND with NOT 100.
Runtime.UpdateFrequency |= UpdateFrequency.Once; // Bitwise OR with Once.
This would remove the flag telling it to update every 100 ticks, followed by setting the "Once" flag, without changing anything else either time. Presumably you coudl also use standard addition and subtraction, but the logical comparitors are the officially referenced way to go about it and I haven't tested otherwise.
Also, be aware that the 10-tick and 100-tick modes aren't exact, so you'll need to use your own accumulators if you need that kind of precision. The game will dynamically separate PB execution to reduce per-update load, meaning they can actually occur more or less quickly if you're adding or removing running programs.
There is a video in this Guide, may help.
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=368213720&searchtext=programable+block
Note
2017 thread
The game is not the same anymore so maybe ask in the "in-game-programming" Channel on Keen Discord server, all the best are online every days and like to help on programming.
Join here, the link is in the first comment :
https://steamhost.cn/steamcommunity_com/app/244850/discussions/0/810938810590486770/
Usually I lock right away but sometimes I will help and specify that it is better to create new Discussion when a forum thread is old because the game changes.. Still in making so not the same anymore.
I will not lock if it's relevent but I may lock this one later.