Do you mean how to use them (the CE technique) or what they're good for? I guess you mean the CE technique, since I guess it's quite oubvious what they're good for... but I'll probably explain what they're good for as well
First of all, the level which uses this technique:
http://www.zomis.net/rnd/download.php?id=614
The idea of the room variables is to "save" which emeralds in a room which has been taken and which that hasn't been taken. So how to do this in CEs?
If it's possible, we need to use both the CE Score and CE Value. CE Score for storing a variable in the CE, and a CE Value to check whether or not the current CE should be an emerald or empty space.
And then also, if we can check whether or not a CE should be an emerald. We need to save the new value when the emerald has been taken.
So, in short:
1. Get a CE Value for each CE
2. Make a CE Value check, if CE Score has CE Value bit, create emerald
3. Save new CE Score when an emerald has been taken.
So, for the CEs:
When a room is created, the CE "Machine control 2" is created. It changes after 3 frames, triggering a change page for the "Initialization Element" CE. This changes to "Get a ce value", which uses 2 change pages (1+3) to set the correct ce value for the element. And then, change to "CE 55" (I don't know why I haven't given that one a name) when they all have been given a CE Value. (CE Values = 128/64/32/16/8/4/2, 7 different bits)
When a new CE 55 has been created, the "Machine controller" at the bottom of the level changes and creates a CE 56, and at the same time copying the CE 56 value (which is equal to one of the seven bits, the first time it's 128).
The CE 56 element passes above the Machine controller, the CE 56 gets a CE Value (which is equal to the current room's CE Score, which the Machine controller has set to it's CE Score by it's 3rd change page). Then also the CE 56 decreases it's CE Value by the Machine Controller's CE Value (which is equal to the current bit).
These two things (CE 56 gets CE Value and decreases by CE Value of Machine controller) were only CE actions, so no real change has been made yet on the CE 56. This new CE Value is copied back to the Machine Controller's CE Score by the Machine Controller's 2nd change page (which occours by CE 56 page 4, that is - the CE 56 has decided that an emerald should be created).
Now, a little calculation. Imagine the CE Score is 255 (the default value of all the room elements), and the current bit is 128. 255-128=127. So the result is above 0, which means that we can output an emerald at the current position (remember CE 55?). CE 55 changes to an emerald when CE 56 change page 4 occours (a simple delay).
So then this is repeated for all 7 bits (all 7 "get a ce value"-elements)
But then imagine if the CE Score for the room is 170 (binary 10101011), what will happen?
First pass of CE 56 --> Machine Controller's CE Value = 128; Machine Controller's CE Score = 171; 171-128=43 --> Create emerald, process next bit
Second pass of CE 56 --> CE Value = 64; CE Score = 43; 43-64=-21
Ouch, here we encounter a negative CE Value, what happens? CE 56 page 3: Change to empty space when CE Value gets 0. This change page triggers page 2 for CE 55 -> Change current bit position to empty space. And so, the new value is not set back to the Machine controller's CE Score. We'll continue with the next bit.
Third pass/third bit --> CE Value = 32; CE Score = 43; 43-32=11
CE 56 does not trigger page 3, but instead it triggers page 4 (CE Delay 1 frame) --> Create emerald, set Machine Controller's CE Score to new value (=11)
Fourth bit --> CE Value = 16; CE Score = 11; Result = 11-16=-5. Sorry, no emerald here. We'll continue to the next bit.
Fifth bit --> CE Value = 8; CE Score = 11; Result = 3. Aaah, now the CE 56 can be alive for another frame, triggering page 4. So create an emerald!
Sixth bit --> CE Value = 4; CE Score = 3. Result = -1. So close, yet so far away. A value of 0 or below is still 0 or below. So no emerald here.
Seventh bit, final bit --> CE Value = 2; CE Score = 3; Result = 1. Yay! We have another emerald!
So, from this CE Score of 171 (binary 10101011) we've got 4 emeralds at bits 1, 3, 5 and 7 (reading from left to right).
So then, a question:
Why not using 8 bits? There's 8 bits from 0 to 255 after all.
Answer: Using the 8 bit would always return in empty space for the first bit. Since the 8 bit's value is 256, 256-255=-1. Using an 8 bit with the value 1 wouldn't help either. Since 1-1=0. And the ce value "gets 0" when it reaches zero or below. This is the same reason that the CE Score must be an odd number. Using the CE Value of 128 would return in no emeralds at all, since 128 (the bit) - 128 (the score) = 0
So what about storing the new CE Score for the room element when an emerald has been taken? Let's look at the "emerald".. what can we know about it?
1. It's floating
2. It's got to be a CE.
3. Why is it floating? Why isn't it set to "collectible"? Why isn't it snappable? One answer: Because it would be buggy! I tried making it collectible and such, but it didn't work in some situations. And if it had gravity, standing below it and walk upwards would make it drop down below you.
4. So, what does it do really?
It gives you score for it, and decreases gems needed by 1.
For the CE Score change - let's check the Room CEs...
Change page #26 (after the creation of the rooms), decreases CE Score by CE Value of trigger when touching "Decrease CE Score". Decrease CE Score gets created by Machine Controller when player enters the emerald element (which apparently seems to be called "Diamond" in this level), and gets it CE Value by the "Digged emerald" element which is created when the player enters a "Diamond" CE.
So, I hope you understand this now, if you have the strength to read through that post
Let me know if you want me to explain room teleportation as well
