Regulus's Counter idea improvement

A lot of you probably already know about Regulus's idea for a counter, but if you don't, check out (url="http://"http://www.ambrosiasw.com/webboard/Forum26/HTML/002790.html#")this(/url) board.

Anyway, I've come up with an improvement. Instead of using 16 cron resources, you can make it use 4.

Quick note: The ncb's are ordered such that b1 is 8, b2 is 4, b3 is 2, and b4 is 1, with b0 being the toggle bit

Going by the premise that crons are executed in ID-numerical order (which is backed up by a test that I did), I can order several crons in the following way, where X is some random number:

Cron(X):
- EnableOn: b0 & (b2 & (b3 & b4))
- OnStart: ^b1
Cron(X+1):
- EnableOn: b0 & (b3 & b4)
- OnStart: ^b2
Cron(X+2):
- EnableOn: b0 & b4
- OnStart: ^b3
Cron(X+3)
- EnableOn: b0
- OnStart: ^b4 !b0

Basically, when you set the toggle bit, it will go increment the number.

Example:

b0 is clear, b1 is clear, b2 is clear, b3 is set, and b4 is clear (the counter is 2 and the toggle is off). A mission sets the toggle bit. Cron(X) checks and doesn't run. Cron(X+1) checks and doesn't run. Cron(X+2) checks and doesn't run. Cron(X+3) runs, sets b4 and clears b0. The counter is now 3. The mission is received again and b0 is set. Cron(X) checks and doesn't run. Cron(X+1) checks and runs, setting b2. Cron(X+2) checks and clears b3 (it flips the already-set bit). Cron(X+3) runs and clears b4 (it flips the already-set bit) and clears b0. Now the counter reads 0100, or 4. And it continues this way.

Quick note: to make the counter go up to, say, 11, make the mission Available spot check "(regular check) & !(b1 & (b3 & b4))". Basically, it runs the regular check and also makes sure the counter is not 11.

Anyway, this is just my addition to this excellent idea. I hope it proves useful for someone.

------------------
Kevin Ballard
(url="http://"mailto:kevin@sb.org")mailto:kevin@sb.org(/url)kevin@sb.org

^iBump^

------------------
Kevin Ballard
(url="http://"mailto:kevin@sb.org")mailto:kevin@sb.org(/url)kevin@sb.org

Very interesting improvement... allows many more counters to be made. This could easily be adapted for use in a scenario by making a counter of how many ships the user has boarded, disabled, etc. Thus, a primitive scoring system could be set up. As well, if the user has taken over a certain number of planets, (or something), you could set bounty hunters to start hunting the player, with the higher the count, the more (and stronger the hunters could be. Werd up, Aranor.

------------------
Werd