Another pillar puzzle

OK, I'd suggest having the Door opening dependant upon a Variable. The Door is Open only if the Door_Open Variable takes on a certain value. I'd initialise the Door_Open Variable to 0, and all the Pillars to a colour other than Yellow. Each Pillar Adds a specific value to Door_Open if it turns Yellow. If it is already Yellow, but turns to any other colour, it subtracts this value. For a 2-Pillar Game, I'd have Pillar 1 add or subtract 1 to Door_Open. The second Pillar adds or subtracts 2 to Door_Open. The Door opens only if Door_Open has a value of 3.


For a 3-Pillar Game, the third Pillar adds or subtracts 4, and Door_Open needs to be 7 to Open the Door. For a 4-Pillar Game, Pillar 4 adds or subtracts 8 to Door_Open, and the Door Opens at a value of 15. Each Pillar adds or subtracts the next binary number, the Door Opens at the total of these numbers.


So, in Pseudo Code...
 

Spoiler
Pill_1 is Red


Pill_1_Colo=0


Pill_2 is Blue


Pill_2_Colo=0


Door_Open = 0


Pill_1 changes colour


Test...


If Pill_1_Colo=0 // Pillar 1 is not Yellow


  If Pill_1 is Yellow // Pillar_1 has turned Yellow


    Pill_1_Colo=1 // Indicates that it's now Yellow


    Door_Open=Door_Open+1 // Add binary value to Door


  Endif


else // Pillar is no longer Yellow 


  Pill_1_Colo=0 // indicate that it's another colour


  Door_Open=Door_Open-1 //remove binary number from Door


Endif


Repeat above for Pillar 2, but adding or subtracting 2, instead of 1...


Pill_2 changes colour


etc...


Test Door_Open


If Door_Open = 3


Open Door


Repeat all above



Can you turn that into MV commands, and see if it fits your needs..?
That... sounds overly-complicated to me, @Dad3353. Doesn't my solution already fit what he wants? It seemed so to me, and it is the classic way to do it as far as I know...
I don't want to start a bun-fight, I'm just trying to explain, in words, the process. It's extremely simple if one knows what is required, without explanation. I don't doubt that there are better, or more sophisticated methods. It's the process, though, that I wanted to get pinned down. Still, if everyone is clear without my intervention, by all means carry on. From the ping-pong seen above, it's not at all clear to me, but , as I mentioned above, maybe it's just me.
Oh, I'm not wanting a fight either @Dad3353, sorry if it sounded like that. It is just a different method of doing it.


But... your process seems overly-complicated to me.


And... I'm not really sure it would work for something with more than two different possible values...


I mean, sure, if it only got two colors, four orbs, one with the value 1, other with 2, the third with 4 and the fourth with 8, this would be a bit complicated but as long as the result was 15 it would work... but as soon as you add a third color the math would go wrong, because you got two subtracting colors and only one adding, and if it works as you described and it subtracts every time it changes to a different color...
I agree that, before working out how to do anything, in any programming language, it's a Good Idea to state what is required (and, preferably, stick to it...). Once the 'problem' is declared and understood, the method (or methods...) can be put into place. Firstly, then, state the problem. Without that, it's quicksands. What is meant by 'subtracting colour', for instance..? It matters not how many colours there are, as long as there is only one which Opens the Door. If that's not the case, then all bets are off, and it's back to the drawing board, anyway. Define the requirements first, then go forward; don't move the goalposts. That way, madness lies.
Each Pillar Adds a specific value to Door_Open if it turns Yellow. If it is already Yellow, but turns to any other colour, it subtracts this value.

This gives the impression that every time the color changes if thanges the value... which would mean that, in a 2 color puzle, add 1, subtract one... but in a three-color it is add 1, subtract 1, subtract 1 again, which gives us a total of -1, each time the whole round is made.
I'm sorry, but I don't agree. If you mean a Game which could have 3 colours, but 2 Pillars, then adding the Pillar Value only when the Pillar turns Yellow, and subtracting only when a Yellow reverts to a Red or Blue, there is never a negative (if no Pillar is Yellow at the start...).


If, however, you mean the case of a 3-Pillar Game, there is never a negative either. Pillar 1 adds or subtracts 1, PIllar 2 2, Pillar 3 4, but only if the Pillar turns either Yellow or another colour. If a Pillar is not Yellow, it will never subtract. If it turns from Yellow to another colour, it only subtracts what it has already previously added. There is no case where the total is negative.  Where do you get your negative value from., or what is different from the case outlined above..?


The situation asked for was a method for knowing when to Open the Door, by detecting if all the Pillars (however many; it matters little...) were Yellow. That's all.
I get the negative case from the fact in your explanation the value seems to be subtracted from every color but yellow, which adds.


That means, let's assume the color starts as blue. then go to red, -1. Then to yellow, +1 = 0 (problem starts here). Then blue again, -1 = -1. Then red, -1 = -2. Then yellow again, +1 = -1. And that is just one pillar.
Apologies for the confusion. Would never thought the counter idea would work, which it does to an extent. Seems as though I need to fiddle with it a bit more, seeing it use to recognize the count when all of the orbs turn yellow all at once, but when it comes to color changing and figuring which switches to press to change it to yellow and able to get all four, it doesn't acknowledge it. Somewhere lies a logic error I created on my behalf.


This issue could be that this runs only once if parallel. So, maybe creating a label jump would work? Loop would be a bad idea, seeing it'll continue to repeat, making an infinite loop
Alright, I got it to work. My issue was that I didn't use the condition variable on the left side. Instead, I rely on the conditional branch. This was for the matching event in order to open the door
I get the negative case from the fact in your explanation the value seems to be subtracted from every color but yellow, which adds.


That means, let's assume the color starts as blue. then go to red, -1. Then to yellow, +1 = 0 (problem starts here). Then blue again, -1 = -1. Then red, -1 = -2. Then yellow again, +1 = -1. And that is just one pillar.



Maybe just semantics, but that's not what I wrote. Let's walk it through...


Pillar is Red, changes to Blue..? Nothing added


Pillar is Red, changes to Green..? Nothing added


Pillar is Red, changes to Yellow..? Value is added to Door_Open


Pillar is Blue, changes to Red..? Nothing added


Pillar is Blue, changes to Green..? Nothing added


Pillar is Blue, changes to Yellow..? Value is added to Door_Open


Pillar is Green, changes to Red..? Nothing added


Pillar is Green, changes to Blue..? Nothing added


Pillar is Green, changes to Yellow..? Value is added to Door_Open


Pillar is Yellow, changes to Red..? Value is subtracted.from Door_Open


Pillar is Yellow, changes to Blue..? Value is subtracted.from Door_Open


Pillar is Yellow, changes to Green..? Value is subtracted.from Door_Open


There. All cases are covered. Door_Open never goes negative, as far as I can see, as there's never a subtraction unless there has already been an addition. Doing this for each Pillar, Door_Open can be detected by addition of the values of each Pillar.
Yes, this way works.


It is just that the way you had written it before didn't give the impression it would only subtract if leaving Yellow. Instead it sounded more like it would subtract for changing to anything but yellow.
Maybe I should have written...


Each Pillar Adds a specific value to Door_Open if it turns Yellow.


f it is already Yellow, but turns to any other colour, it subtracts this value.
Well I wish to say thank you both for your support. I know my situation was a tad puzzling, but after putting in my pseudo code I think it was understood what I wanted and was able to fix it. Kind of wish the counter idea came across sooner than I anticipated, on my end of course, for it is such a novice and simple way of resolving puzzle situations like this one.


Very least, it was solved and taken care of.


Now off to generating random numbers
R91KekF.gif
Edit: NVM answered on page 2.

Original thread: https://forums.rpgmakerweb.com/threads/another-pillar-puzzle.69858/