Please use the Question Tags to state the name and full version number of the Story Format you are using, as answers can vary based on that information. I will assume you are using SugarCube v2.21.0 or later.
I suggest use an Array and store the name of each wire in it as it is connected, this will allow you to check the order of those names.
The following rough prototype includes links for connecting each of three coloured wires, for testing if all three have been connected and that they were connected in the correct order. It also has a link for resetting / un-connecting all the wires.
<<set $connected to []>>\
Message: @@#message;No wires are connected.@@
<<link "Connect Red Wire">>
<<run $connected.pushUnique("Red")>>
<</link>>
<<link "Connect Green Wire">>
<<run $connected.pushUnique("Green")>>
<</link>>
<<link "Connect Blue Wire">>
<<run $connected.pushUnique("Blue")>>
<</link>>
Determine if all three wires have need connected and that they were connects in the order of Red, Green, Blue.\
<<link "Test Connections">>
<<if $connected.length lt 3>>
<<replace "#message">>You need to connect all three wires.<</replace>>
<<elseif $connected[0] is "Red"
and $connected[1] is "Green"
and $connected[2] is "Blue">>
<<replace "#message">>The wires are connect correctly.<</replace>>
<<else>>
<<replace "#message">>The wires were not connected in the right order.<</replace>>
<</if>>
<</link>>
<<link "Reset all connections">>
<<set $connected to []>>
<<replace "#message">>No wires are connected.<</replace>>
<</link>>
I suggest you read the relevant SugarCube 2.x documentation for any of the above macros or functions you're not familiar with.