Not sure if this is news to anyone or not, but placing the same spob in multiple systems, only one of which is ever visible, works fine. The spob functions as it should. Isn't selectable by random misns, but a misn targeted at it specifically will select whichever one is currently visible. I imagine a few people are aware of this, but here comes the funky part:
If you have a misn to such a spob, but the spob goes invisible, then the misn automatically succeeds, triggering the 'OnSucceed' ncbs, giving the reward and changing the legal status. There are operators to fail and abort misns, but none to force success. This works quite nicely and allows us to build if-then checks than run within crons -> we can now do nested loops!
Thanks to this method, we should now be able to create counters using even fewer crons.
3bit counter:
Syst ... Visability
1 ....... (b1 & !b2) & !b0
2 ....... !b1 & !b0
3 ....... (b1 & b2) | b0
Each syst contains spob 1
Misn ... OnSuc .... OnFail
1 ........ b1 ^b3 ... b0 ^b2
The misn destination is spob 1
Cron ... Enable ... Start
1 ........ b11 ........ S1 !b1 F1 S1 ^b2 A1 ^b1 !b0 !b11
When bit 11 is set, the counter is increased by one
7 bit counter:
yst ... Visability
1 ....... (((b1 & !b2) & b11) | ((b3 & !b4) & b12) | ((b5 & !b6) & b13)) & !b0
2 ....... ((!b1 & b11) | (!b3 & b12) | (!b5 & b13) ) & !b0
3 ....... (b1 & b2 & b11) | (b3 & b4 & b12) | (b5 & b6 & b12) | b0
Each syst contains spob 1
Misn ... OnSuc .... OnFail
1 ........ b1 ^b12 ... b0 ^b2
2 ........ b3 ^b13 ... b0 ^b4
3 ........ b5 ^b7 ..... b0 ^b6
The misn destination is spob 1 for each
Cron ... Enable ... Start
1 ........ b11 .......... S1 !b1 F1 S1 ^b2 A1 ^b1 !b0 !b11
2 ........ b12 .......... S2 !b3 F2 S2 ^b4 A2 ^b3 !b0 !b12
3 ........ b13 .......... S3 !b5 F3 S3 ^b6 A3 ^b5 !b0 !b13
When bit 11 is set, the counter for the least significant 2 bits is incremented.
When bit 12 is set, the counter for the nest significant 2 bits is incremented.
When bit 13 is set, the counter for the most significant 3 bits is incremented.
Resource Usage:
n-bit ... m ........... ncb ....... misn ... cron ... syst ... spob
3 ......... 1 ............ 5 ........... 1 ......... 1 ....... 3 ........ 1
5 ......... 2 ............ 8 ........... 2 ......... 2 ....... 3 ........ 1
7 ......... 3 ............ 11 ......... 3 ......... 3 ....... 3 ........ 1
n ......... (n-1)/2 ... 3m+2 ... m ........ m ...... 3 ........ 1
As you can see, it's very efficient in resource usage, as well as being quite elegant. A few ncbs can be saved (and the visbits made less complicated!) by using a separate triple system/spob for each m. Changes ncb usage to 2m+2, syst usage to 3m and spob usage to m. Alternatively, a combination of the methods could be used. Setting aside an extra ncb for instance would halve the syst/spob usage. It's a very versatile set-up.
It is likely that this could be used to reduce cron usage in other calculations.
------------------
(url="http://"http://homepage.mac.com/jonathanboyd/evn/index.html")Classic4Nova plug-in(/url)