Using random_switch for industry
Posted: 17 May 2021 09:26
Hello!
I used random_switch for industry and needed to re randomise it.
WIKI says that "Industry tiles can rerandomise both their own random bits as well as the random bits of the industry (via type PARENT)." So I did a test. I created 4 independent random_switch for industry, which stores 4 variables and placed them in monthly_prod_change callback And I placed random_switch in random trigger of industry tiles in order to re randomize the first 4. I expected my variables to change every month, but the actual result was very surprising to me.
In fact, my variables only changed their values once. And they were never changed again. Moreover, the variables of different farms took the same value. And what surprised me the most is that each time I did this test (new game), I got the same sequence of variables: 1, 1, 1, 2. How this could be?
After that I decided to determine how often in fact the random_trigger triggers.
If I understood the WIKI correctly, the frequency of the random_trigger call depends on random_switch trigger event.
So I created 3 counters 0->5 and place one of them in produce_256_ticks callback. The other 2 were placed in random_trigger, which called random_switch with TRIGGER_INDUSTRYTILE_256_TICKS I expected my counters to change at the same time or at the same frequency. But in fact the last 2 counters (placed in random_trigger) changed it's value faster. The farm has only 1 tile of these types, if it does matter.
So the questions are
What I was doing wrong or misunderstanding?
Is there any way to re randomize random_switch for industry?
How often does random_trigger called?
I used random_switch for industry and needed to re randomise it.
WIKI says that "Industry tiles can rerandomise both their own random bits as well as the random bits of the industry (via type PARENT)." So I did a test. I created 4 independent random_switch for industry, which stores 4 variables and placed them in monthly_prod_change callback And I placed random_switch in random trigger of industry tiles in order to re randomize the first 4. I expected my variables to change every month, but the actual result was very surprising to me.
In fact, my variables only changed their values once. And they were never changed again. Moreover, the variables of different farms took the same value. And what surprised me the most is that each time I did this test (new game), I got the same sequence of variables: 1, 1, 1, 2. How this could be?
After that I decided to determine how often in fact the random_trigger triggers.
If I understood the WIKI correctly, the frequency of the random_trigger call depends on random_switch trigger event.
So I created 3 counters 0->5 and place one of them in produce_256_ticks callback. The other 2 were placed in random_trigger, which called random_switch with TRIGGER_INDUSTRYTILE_256_TICKS I expected my counters to change at the same time or at the same frequency. But in fact the last 2 counters (placed in random_trigger) changed it's value faster. The farm has only 1 tile of these types, if it does matter.
So the questions are
What I was doing wrong or misunderstanding?
Is there any way to re randomize random_switch for industry?
How often does random_trigger called?