You know how I can't stop fiddling …
Instructions for use:
Attach script to the guage body itself, the needle (physics off), the bit of pipe the knob sits on and the knob.
Set the 'strength' of each entity to the same value, i.e. first set of entities to 1 second set to 2 etc.
The script postitions all the bits using their names and associates the knob to the right needle using the strength value.
I've added a global function called GaugesGetValveState( num ) which can be called from another script and returns the current state of the specified valve (i.e. num parameter matches the strength value you gave the entities).
In the video I have attached a script to the crate which simply displays the current state, in a game you can use it to drive some other action, for example if you had 4 valves numbered 1 to 4 you could do something like:
if GaugesGetValveState( 1 ) == 'on' and GaugesGetValveState( 2 ) == 'off' and GaugesGetValveState( 4 ) == 'on' then PlaySound( e, 0 ) end
So if the player gets the combination of valves set right she is rewarded with a nice sound played.
Been there, done that, got all the T-Shirts!