Events or scripts?

Okay I'm stuck on something and I don't know if it can be evented or if it will need a script.

I am working on matching mini-game. So the player will have a set number of objects and will have to pick two at a time to see if they match.

Right now, I've got it working very well up to a certain point. To turn the "card", I am using a door animation. That part works fine. The player turns one card over. Then the second. If it doesn't match, I can get the second card to turn back over using a move route in the event of the second card. What I am stuck on is how to get the first card to turn back over. I know I can set a move route to affect another event. BUT I won't know which event the player chose first, and there seems to be no way to use variables in the Move Route event selection.

I'm trying to think of ways to simply event this, but it mushrooms into some complicated thing with tons of variables. Is there something simple I'm missing or would it be better to try to work this with a script. (And I did do a quick search to see if there was already script out there for it, but found nothing.)

Clarifying: I am specifically wanting to know if it's possible to event the first card turning back over. I can't use a variable as an event page condition because you can only set to a certain number or above and the or above part would mess it up. I can't set the event to a move route in the second event, because I would have to know which event to set beforehand. Short of creating a unique switch for each event, I can't figure how to do this. And I would like to have upwards of 50 cards, for an interesting game, so that's a lot of switches. Not impossible, but not ideal.
Maybe show us what you've got already for each card.

I imagine it would go something like this when a card is interacted with:

Page 1 of each card

- no conditions

- sprite is card facing down

Set Move Route (This Event): animation to turn overConditional Branch: Switch [0001: First Card Turned] = OFF Comment: No other card is facing up. Just store the value of this card and note that a card is now facing up Control Switches [0001: First Card Turned] = ON Control Variables [0001: Card Value] = <whatever value you want to give this card - it will change for each event> Control Self Switch A = ONElse Comment: Another card is already facing up - see if its value is the same as this card Conditional Branch: Variable [0001: Card Value] = <whatever value you want to give to this card> Comment: The values match - remove the cards (maybe show an optional animation here if you want something fancy to happen) Control Switches [0002: Cards Match] = ON Erase Event Comment: Do any other "matching" stuff here too - add points, see if this is the last pair of cards, whatever Else Comment: Cards don't match - turn this one back down, and make the other one turn back down too Set Move Route (This Event): animation to turn back down Control Switches [0003: Cards Don't Match] = ON Branch EndBranch EndPage 2 of each card (just an image of the card, but it lets you turn it back down if you click it - if you DON'T want the player to be able to turn a card back over, just don't put in the event commands)- condition by Self Switch A

- sprite is card facing up

Set Move Route (This Event): animation to turn back downControl Switches [0001: First Card Turned] = OFFControl Self Switch A = OFFPage 3 of each card- conditioned by Self Switch A and Switch [0002: Cards Match]

- sprite is card facing up

- set to parallel process

(maybe show an optional animation here if you want something fancy to happen)Control Switches [0001: First Card Turned] = OFFControl Switches [0002: Cards Match] = OFFControl Self Switch A = OFFErase EventPage 4 of each card

- conditioned by Self Switch A and Switch [0003: Cards Don't Match]

- sprite is card facing up

- set to parallel process

Set Move Route (This Event): animation to turn back downControl Switches [0001: First Card Turned] = OFFControl Switches [0003: Cards Don't Match] = OFFControl Self Switch A = OFFI haven't tested it, but what SHOULD happen is that you'll turn over the first card, it'll detect that there are no other face-up cards, so will log that it is now face up, record its own value, and wait for the next move. You'll turn over another card, it'll detect that there's already a face-up card, and will compare its value to the one that's already face up; if they match, it'll remove itself and trigger the other event to also remove itself, in the process indicating that there's no longer any face-up cards; if they don't match, it'll turn itself back over again and trigger the other event to also turn itself back over, in the process indicating that there's no longer a face-up card.
Disclaimer: I'm really tired right now, so I'm probably missing something.


Shaz, thanks for all the input. I'm going to come back in the morning and read through it again to process it though. I'm also going to go back and put a point of clarification in the first post, because I see the way I wrote it is a bit misleading. What I'm really wanting to know is specifically if there's a way to event the first card chosen turning back over. And again, maybe because I'm tired, but it seems you put something pretty non-specific in that part. (Not criticizing, I appreciate all the thought you put into it.)


Onward to my bed!
That's where the self switch and those other two switches come into it. The self switch makes it say "I'm the active card" and the other two switches say "whoever is the active card - turn yourself back over, or remove yourself" - so you don't HAVE to know which one needs to be turned.
Okay, thanks Shaz, my vision's blurring I'm so tired, so I will definitely read through again in the morning.  Thanks again so much.

Edit:  Shaz to the resuce again!  A good night's sleep and I've got it working perfectly!!  Thank you, thank you, thank you!  I was envisioning 50 unique switches and variables and it made me want to cry, lol!

Original thread: https://forums.rpgmakerweb.com/threads/events-or-scripts.22879/