• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FS2004 3way switch code problem

Messages
231
Country
us-alabama
I am designing in Gmax for fs2004. In the image below highlighted in yellow is a pic of the section light controls from the F4u-1 Corsair's pilot's manual.

Lights%20switches%20jpg.jpg


The 3 way master switch (switch_light_section_on) in the forward position should turn on the section light in a steady on display, either bright or dim depending on the position of the 2 way diming switch next to it.

The 3 way,s middle position should be the off display of the section light.

The 3 way master switch in the rear position should turn on the section light in a flashing display, either bright or dim depending on the position of the 2 way diming switch next to it.

My plan was to use the forward position to turn on a display in range part(sec_lght_on_b_d_vis) to show a version of the bright /dim switch controling the steady on light displays.

The middle position for a display in range part(sec_lght_b_d_nonvis) to show a version of the bright /dim switch that is unpowered and controls nothing except it's own animation.

And the rear position to turn on a display in range part(sec_lght_flsh_b_d_vis) to show a version of the bright /dim switch controling the flashing light displays.

That was my plan anyway! After a week of rewrites of all of the codes I am convinced I do not understand how the 3 way code works or how to connect the display in range parts to it. Can any one tell me what I am doing wrong? Here are the current codes:

Code:
<part>
    <name>switch_light_section_on</name>
    <animation>
      <parameter>
        <code>
          25 (L:switch_light_section_on, number) 25 * +
        </code>
      </parameter>
    </animation>
    <mouserect>
      <cursor>Hand</cursor>
      <tooltip_text>Section Light</tooltip_text>
      <mouse_flags>LeftSingle+RightSingle</mouse_flags>
      <callback_code>
        (M:Event) 'LeftSingle' scmp 0 ==
        if{ (L:switch_light_section_on, enum) -- -1 max (>L:switch_light_section_on, enum) }
        (L:sec_lght_on_b_d_vis, bool) ! (>L:sec_lght_on_b_d_vis, bool)
        (M:Event) 'RightSingle' scmp 0 ==
        if{ (L:switch_light_section_on, enum) ++  1 min (>L:switch_light_section_on, enum) }
        (L:sec_lght_flsh_b_d_vis, bool) ! (>L:sec_lght_flsh_b_d_vis, bool)
      </callback_code>
    </mouserect>
  </part>

The above code displays the, sec_lght_flsh_b_d_vis, in both forward and back positions, it is hidden in the middle position. The sec_lght_on_b_d_vis and sec_lght_b_d_nonvis all the time. Here are the current display in range part codes:

Code:
<part>
	<name>sec_lght_on_b_d_vis</name>
	<visible_in_range>
		<parameter>
			<code>
				(L:sec_lght_on_b_d_vis,bool) 100 *
			</code>
		</parameter>
		<minvalue>-1</minvalue>
	</visible_in_range>
</part>

<part>
	<name>sec_lght_flsh_b_d_vis</name>
	<visible_in_range>
		<parameter>
			<code>
				(L:sec_lght_flsh_b_d_vis,bool) 100 *
			</code>
		</parameter>
		<minvalue>1</minvalue>
	</visible_in_range>
</part>

<part>
	<name>sec_lght_b_d_nonvis</name>
	<visible_in_range>
		<parameter>
			<code>
				(L:sec_lght_b_d_nonvis,bool) 100 *
			</code>
		</parameter>
		<maxvalue>1</maxvalue>
	</visible_in_range>
</part>

Any comments or explanations of what the code is doing as written will be a help even if you have no fix for the over all problem. As you can tell by the pic I have several more places I need to use the 3 way code. The running lights highlighted in red may be a particular problem.

Carl
 
Why are you multiplying the bool values in your vis script by 100?

Remove the 100 * from each <code> section.

For that matter, you are only allowing (L:switch_light_section_on, number) to be one of -1, 0 or +1, so wouldn't it be simpler to test this way?

Code:
<part>
	<name>sec_lght_on_b_d_vis</name>
	<visible_in_range>
		<parameter>
			<code>
				(L:switch_light_section_on, number) -1 ==
			</code>
		</parameter>
		<minvalue>1</minvalue>
	</visible_in_range>
</part>
 
The excuse for why is because I have a limted supply of display in range code in the makemdl.parts.xml file that Ronnie left me when he bowed out of this project. Most of those are based on event Ids or commands and are easy enough to understand, but are not applicable to this problem.

The answer to why is I have a very limited understanding of .xml code especially display in range code. This code has worked for most of my other switches needing vir code and I kinda understand it. At least the <minvalue>1</minvalue> to display and <maxvalue>1</maxvalue> to hide, I think I understand anyway.

My personal failings aside, let us see if I have learned something from your code section example. The code section line:
(L:switch_light_section_on, number) -1 ==
tells the vir part (sec_lght_on_b_d_vis) to display when switch_light_section_on is in the -1 position.

So I asume I would write the (sec_lght_flsh_b_d_vis) vir part as:

Code:
<part>
	<name>sec_lght_flsh_b_d_vis</name>
	<visible_in_range>
		<parameter>
			<code>
				(L:switch_light_section_on, number) 1 ==
			</code>
		</parameter>
		<minvalue>1</minvalue>
	</visible_in_range>
</part>

And the power off version (sec_lght_b_d_nonvis) as:

Code:
<part>
	<name>sec_lght_b_d_nonvis</name>
	<visible_in_range>
		<parameter>
			<code>
				(L:switch_light_section_on, number) 1 ==
			</code>
		</parameter>
		<maxvalue>1</maxvalue>
	</visible_in_range>
</part>

I will try these codes out and report results.

But while I am on code section entries, am I reading this line from the (switch_light_section_on) code correctly?

25 (L:switch_light_section_on, number) 25 * +

I think the first 25 tells the code to start at the 25th keyframe as 0 then the second 25 * + tells it to move in 25 keyframe increments. And the callback code drives the forward movement with the -- -1 max line,and the rearward movement with the ++ 1 min line. As I said I understand very little of xml coding but I want to learn!

Carl
 
Some success, the switches linked to sec_lght_on_b_d_vis and sec_lght_flsh_b_d_vis display as needed. The switch linked to sec_lght_b_d_nonvis displays all the time, I thought it would go out of display when either of the other 2 were in display. I tried adding 0 == in the code section of sec_lght_b_d_nonvis to no effect, still displays all the time. I am now trial and erroring different entries in the callback section of switch_light_section_on to get it to go out of display and will post results later.

Carl
 
Carl, when testing for visibility, whatever you stuff between <code> and </code> should be evaluated and return either "0" or "1" (false or true)...

...which is why I suggested setting up the conditions to test the way I did.

Your "switch" is set to return one of three possible values (-1, 0, +1), so testing for those three possible values is the easiest way to approach the problem.

Your understanding of the switch animation is correct. All L:variables initialize to zero when the aircraft is loaded (or reloaded), so we need to supply an offset (bias) to the formula that sets the animation value...

The most important formula we need to remember when working on XML animations is this:

keyframe = simvalue * scale + bias

So, your switch is using 50 frames, with 25 being the "middle" or "off" position. In order to display the switch correctly when the L:var is zero, we need to add the bias, and to scale the animation correctly we need to multiply the L:var (simvar) by 25.

To test this, simply check each possible condition in a table:

Code:
-1 * 25 + 25 = frame 0
0 * 25 + 25  = frame 25
1 * 25 + 25  = frame 50
 
Good morning

Still no luck getting the dimmer switch to hide as I thought it would using the code:

Code:
<part>
	<name>sec_lght_b_d_nonvis</name>
	<visible_in_range>
		<parameter>
			<code>
				(L:switch_light_section_on, number) 1 ==
			</code>
		</parameter>
		<maxvalue>1</maxvalue>
	</visible_in_range>
</part>

The codes for sec_lght_on_b_d_vis and sec_lght_flsh_b_d_vis display their children switches perfectly. Here is a testing video with the child switches spread out for viewing.

http://www.pendercrafts.com/Carls folder/Fldr01/switch forum.avi

I do not think I really need the sec_lght_b_d_nonvis to hide it's child switch, as the children switches of sec_lght_on_b_d_vis and sec_lght_flsh_b_d_vis are the actual controller switches for the light displays.

As you can see from the video I have all three of the children switch's movement linked in their callback codes. So there is no need to have the sec_lght_on_b_d_vis and sec_lght_flsh_b_d_vis children display other than as single poly parts which act as the light display controllers. But I have been wrong before, further testing will tell.

I came to the above theory early in the quest to get the sec_lght_b_d_nonvis child to hide when the switch_light_section_on switch moved out of the center/0 position. I tried many rewrites of the sec_lght_b_d_nonvis code with no luck as it bothered me that it would not hide when I thought it should.

Finally I went back to the original vir code and had partial success, the sec_lght_b_d_nonvis child switch went out of view when I right clicked to display the sec_lght_flsh_b_d_vis child. Here is a video of the test.

http://www.pendercrafts.com/Carls folder/Fldr01/swtcholdedit1.avi

Here is the original code again.

Code:
<part>
	<name>sec_lght_b_d_nonvis</name>
	<visible_in_range>
		<parameter>
			<code>
				(L:sec_lght_b_d_nonvis,bool) 100 *
			</code>
		</parameter>
		<maxvalue>1</maxvalue>
	</visible_in_range>
</part>
Now I am more confused than ever!

Carl
 
You are confused? Why on earth are you even trying to "hide and unhide" 3d switch objects to begin with?

Simply animate the silly things and be done with it...

...name the 3d switch "MySwitch" (or whatever you want to call it)...

...animate the 3d switch at keyframes 0 - 50 - 100... then use something like this to control the animation.

Code:
<part>
    <name>MySwitch</name>
    <animation>
        <parameter>
            <code>50 (L:MySwitch,bool) 50 * +</code>
			<lag>200</lag>
        </parameter>
    </animation>
    <mouserect>
        <cursor>Hand</cursor>
        <mouse_flags>LeftSingle+RightSingle</mouse_flags>
        <callback_code>
			(M:Event) 'RightSingle' scmp 0 ==
			if{ (L:MySwitch,bool) -- -1 max (L:MySwitch,bool) }
			(M:Event) 'LeftSingle' scmp 0 ==
			if{ (L:MySwitch,bool) ++  1 min (L:MySwitch,bool) }      
        </callback_code>
    </mouserect>
</part>
 
I hate these why questions, but this one is easy to answer! My editor/beta tester Stansdds from over at sim outhouse seems to be the worlds top expert on the F4u Corsairs. He expects every switch, pully, cable and knob to move as they did in the real Corsair and to control or respond to their function in the sim as they did in the real Corsair.

So I make powered (move and act as controller) and un powered (do nothing but move) versions of the down circuit switches that display when an up circuit switch is in it's powered or un powered setting.

In this case the three way powered, up circuit switch has 2 powered, down circuit switches each of which control a dim or bright light display, one controls bright or dim steady on light, the other controls bright or dim flashing light. Plus I have the third down circuit unpowered switch that does nothing but play it's animation to simulate the toggle movement when the powered 3 way switch is in the off setting or the un powered version of the 3 way switch is in display when it's up circuit main battery switch is in the off position.

I am getting confused just trying to explain it. The confusion gets worse trying to write code to make it happen! The simple explanation is my editor wants complete....Total.....Perfect... Histoical accuaracy. It is my sad duty to provied it. Unless someone here tells me "it can't be done" then I can tell him to shut his hole about it.

Carl
 
You are describing switch movements: up, middle, down...

...those are simply animations.

Nothing to do with playing "hide and go seek" with them.

Physical switches don't normally disappear on command, so I'm not certain just what you are wanting to do now... :scratchch

Also, physical switches normally will still move when the finger of the pilot pushes on them, but they might not do anything other than move if another switch isn't in the correct position.

For example, you can flip light switches all day and nothing will happen until you have flipped on the master battery switch!

This script is from my recent Milviz F-86 and does precisely what your leftmost switch does. Turns position lights from steady - off - flash

Code:
        (M:Event) 'RightSingle'   scmi 0 ==
        (M:Event) 'WheelDown' scmp 0 == or
        if{ (L:POS_LIGHT, enum) ++ -1 max (>L:POS_LIGHT, enum) 
        (M:Event) 'LeftSingle'   scmi 0 ==
        (M:Event) 'WheelUp' scmp 0 == or
        if{ (L:POS_LIGHT, enum) -- 1 min (>L:POS_LIGHT, enum)

As for the Bright/Dim switches, I've never found a way to actually have bi-level .fx file lighting...
 
Last edited:
Bill

Getting bright and dim switches to work is the point of the hide and seek game. Not with .fx file lighting but with 2, 3d parts. One with a 20% opacity light emitting materieal for the dim light, the other 90% opacity light emitting materieal for the bright light. Each of these parts have vir parents that display or hide depending on the position of the bright/dim 2 way switch.

I have run out of time and must go get ready for my day job, if they have any thing for me to do today that is. I will finish the explanation later. Hopefully with a up /down circuit flow chart to show the overall idea.

Carl
 
Okay, that makes much more sense now...

In fact for the recent F86 I've used much the same technique for my a/c's position lights (the switch code for which I posted earlier). Here are the two <Visibility> scripts I use for the "lights" themselves. Again, this is FSX script, but the stuff between the <Code> and </Code> tags is what's important.

This first script will either have the lights constant if the switch is at the -1 position, and will "flash" via a timer code if the switch is at the +1 position.

Code:
  <PartInfo>
    <Name>f86_position_flash_on</Name>
    <Visibility>
      <Parameter>
        <Code>
          (L:POS_LIGHT, enum) -1 &lt;=
          (L:BATT, enum) and
          if{ 1 }
          (L:POS_LIGHT, enum) 1 &gt;=
          (L:BATT, enum) and
          (P:Absolute time,seconds) 1 % 0.7 > ! and
          if{ 1 }
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>

The script below is used for those lights that do not flash at all, but are instead simply ON or OFF.
Code:
  <PartInfo>
    <Name>f86_position_steady_on</Name>
    <Visibility>
      <Parameter>
        <Code>
          (L:POS_LIGHT, enum)
          (L:BATT, enum) and
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>
 
Bill

Sorry this took so long I am a slow typist, but here is the Up down circuit chart:


Top up circuit switch - battery_mast_swtch / single 2way switch

Down circuit VIR part -switch_light_section_off_vis / VIR part linked in its code section to

display Blue 3way - switch_light_section_off When battery_mast_swtch is in off position.


Down circuit VIR part -switch_light_section_on_vis / VIR part linked in its code section to

display Red 3way - switch_light_section_on When battery_mast_swtch is in on position.

First down circuit switch off version - switch_light_section_off / Blue 3way switch, displays

when battery_mast_swtch is in off position to simulate unpowered version of on, off, flash 3

way switch.

When I get the circuit working I hope to link this switches movement with powered version

of switch movement in callback code. This usually causes display problems in down circuit

light parts but I chase those problems after control circuit is functioning.

First down circuit switch on version - switch_light_section_on / Red 3way switch, displays

when battery_mast_swtch is in on position to simulate powered version of on, off, flash 3

way switch.

This version of the 3 way switch is the actual controller of the down circuit VIR parts

sec_lght_on_b_d_vis, sec_lght_flsh_b_d_vis and sec_lght_b_d_nonvis. Which are in turn

parents to the down circuit 2 way switches, sec_lght_on_b_d, sec_lght_flsh_b_d_vis and

sec_lght_b_d_off.

Down circuit VIR part - sec_lght_on_b_d_vis / VIR part linked in its code section to display

Yellow 2 way switch - sec_lght_on_b_d When switch_light_section_on is in -1 position. This

now works thanks to your code section entry Bill

Down circuit VIR part - sec_lght_flsh_b_d_vis / VIR part linked in its code section to

display Purple 2 way switch - sec_lght_flsh_b_d_vis When switch_light_section_on is in 1

position. This now works thanks to your code section entry Bill

Down circuit VIR part - sec_lght_b_d_nonvis / VIR part linked in its code section to display

Green 2 way switch - sec_lght_b_d_off When switch_light_section_on is in 0 or center

position. This no longer works as I think it should, still working on why. But I think I can

make it work in the circuit as is.

Second down circuit switch On version - sec_lght_on_b_d / Yellow 2 way switch, displays

when switch_light_section_on is in -1 position. Parent to VIR parts sec_lght_on_b_vis and

sec_lght_on_d_vis which are written to display depending on sec_lght_on_b_d switch

position.

Second down circuit switch Flash version - sec_lght_flsh_b_d / Purple 2 way switch,

displays when switch_light_section_on is in 1 position. Parent to VIR parts

sec_lght_flsh_b_vis and sec_lght_flsh_d_vis which are written to display depending on

sec_lght_flsh_b_d switch position.

Second down circuit switch Off version - sec_lght_b_d_off / Green 2 way switch, should

display when switch_light_section_on is in 0 or off position. For display when

switch_light_section_on is in the 0 or off position or when switch_light_section_off is in

display because the battery_mast_swtch is in the off position.
Displays all the time but as stated above I think I can make it work.

Down circuit VIR part - sec_lght_on_b_vis / VIR part to display bright steady on light part

depending on sec_lght_on_b_d switch position.

Down circuit VIR part - sec_lght_on_d_vis / VIR part to display dim steady on light part

depending on sec_lght_on_b_d switch position.

Down circuit VIR part - sec_lght_flsh_b_vis / VIR part to display bright flash light part

depending on sec_lght_flsh_b_d switch position.

Down circuit VIR part - sec_lght_flsh_d_vis / VIR part to display bright flash light part

depending on sec_lght_flsh_b_d switch position.

That is the theory any way! I am having troubles with some of the Vir parts displaying as I think they should. The 3 way switches seem to be adding a monkey wrench into the already confusing mess but I have made simular circuit schemes work for my interior lighting systems so I am hoping this will work out. I plan to spend the last half hour before getting ready for my day job studying your codes. By the way the references to color of switches will help Identify the changes in the video if you replay it.

Carl
 
Last edited:
I finally got about an hour to actually work on the circuit today. After spending 3 hours on the mess in the above reply. I got most of the circuit working as needed. Here is a video:

http://www.pendercrafts.com/Carls folder/Fldr01/Switch demo.avi

All that is left to do is remove the polys from the unneeded 2 way switch parts leaving 4 vertices to work the animations. Slave the movements of the 2 3 way switches together and deal with the down circuit display problems that causes. Then I will have command and control code for all of the lighting displays except the landing light which I plan to use the sim's .fx file lighting for. I will post results later.

Carl
 
Bill

Slaving the movements of the 3 way switches together is proving to be a problem. But I still have ideas to try. I will post any results later.

Carl
 
I have never seen any mechanical inter-connection ("slaved") in such a panel, which is why I'm completely lost as to what you're attempting to accomplish.
 
I too can't imagine why any of those 4 switches would be mechanically tied to one another - they do 4 different things!
 
The blue 3 way switch is in display when when battery switch is in the off position, it does nothing except move when left or right clicked. Simply there as an unpowered display so my editor can flip it back and forth and see that the lights do not light up.

The red 3 way switch is in display when when battery switch is in the on position. This is the powered version of the switch it actually controls the display of the lights left click from center off position it moves forward and turns on the steady display, right click from center position it moves to the rear and turns on the flash display.

Watch the video and notice the color change on the three way switch when the battery switch is toggled. Both versions will be textured the same later and it is my hope that then you will not be able to see the change from powered to unpowered versions. But for now the visable change lets me know the vir parts are functioning as intended.

Now the need to slave the movements is simple. Say my editor plays with the unpowered 3 way switch and leaves it in the steady on / forward position then switches the battery switch from off to on the blue switch changes to the red switch and seems to jumps from the forward position to the center position that the red switch defaults to when the aircraft loads. See the need to slave the movements? No jump when power up happens!

With the 2 way switches I simply slave them in the callback code of each switch as with the yellow, green and purple dimmer switches as shown in the video. Here are the codes for them.


Code:
<part>
	<name>sec_lght_b_d_off</name>
      <animation>
	<parameter>
	  <code>(L:sec_lght_b_d_off, bool) 100 *</code>
 	  <lag>300</lag>
	</parameter>
      </animation>
   <mouserect>
	<cursor>Hand</cursor>
   <tooltip_text>Section light bright/dimOff</tooltip_text>
   <callback_code>
     (L:sec_lght_b_d_off, bool) ! (>L:sec_lght_b_d_off, bool)
     (L:sec_lght_flsh_b_d, bool) ! (>L:sec_lght_flsh_b_d, bool)
     (L:sec_lght_on_b_d, bool) ! (>L:sec_lght_on_b_d, bool)
   </callback_code>
   </mouserect>
</part> 

<part>
	<name>sec_lght_on_b_d</name>
      <animation>
	<parameter>
	  <code>(L:sec_lght_on_b_d, bool) 100 *</code>
 	  <lag>300</lag>
	</parameter>
      </animation>
   <mouserect>
	<cursor>Hand</cursor>
   <tooltip_text>Section light bright/dimOn</tooltip_text>
   <callback_code>
     (L:sec_lght_on_b_d, bool) ! (>L:sec_lght_on_b_d, bool)
     (L:sec_lght_flsh_b_d, bool) ! (>L:sec_lght_flsh_b_d, bool)
     (L:sec_lght_b_d_off, bool) ! (>L:sec_lght_b_d_off, bool)
   </callback_code>
   </mouserect>
</part> 

<part>
	<name>sec_lght_flsh_b_d</name>
      <animation>
	<parameter>
	  <code>(L:sec_lght_flsh_b_d, bool) 100 *</code>
 	  <lag>300</lag>
	</parameter>
      </animation>
   <mouserect>
	<cursor>Hand</cursor>
   <tooltip_text>Section light bright/dimFlash</tooltip_text>
   <callback_code>
     (L:sec_lght_flsh_b_d, bool) ! (>L:sec_lght_flsh_b_d, bool)
     (L:sec_lght_on_b_d, bool) ! (>L:sec_lght_on_b_d, bool)
     (L:sec_lght_b_d_off, bool) ! (>L:sec_lght_b_d_off, bool)
   </callback_code>
   </mouserect>
</part>

I have not been able to get this dodge to work with the 3 way switches though. But I still have a few ideas.

I have a toddlers understanding of what xml code expressions are saying in most cases. So I write what I can with my limited understanding, and keep trying till it works. But the end product must function perfectly or I get a nasty gram from my editor.

Carl
 
Last edited:
Sorry guys I had to leave earlier. Now the rest of it.

Tom
There are 5 not 4 switches. All ment to fool the user's eye by using VIR parts to display them under different conditions.

2- 3 way switches, one blue displays when battery switch is off, one red displays when battery switch is on both occupy the same location to give the impression of one switch functioning unpowered and powered.

3- 2 way switches, all 3 are movement slaved in their callback code and will occupy the same location when I have the circuit functioning correctly. I plan to delete the polys on the yellow and purple controller toggles leaving just the unpowered green toggle as the visually displayed clickable master that moves the yellow and purple slaved light display controllers.

The yellow and purple will remain as 4 vertices each to react to the vir parts controlled by the up circuit Red 3 way switch's position and to control the bright /dim down circuit lighting displays. Confusing but it may fool the users eye into thinking he sees just 2 swtches, one 3 way and one 2 way. By the way the colors may have changed for the 2 way switches in the more recent videos.

I may not understand much of xml coding, but what I do understand I like to use to the hilt, then shove the hilt and handle in up to the pommel if I can.

Carl
 
Last edited:
Guys

In this new video. I moved the yellow and purple 2 way toggles to the same center as the green 2 way toggle, deleted all but one poly and allowed deletion of the isolated vertices. Then deleted the one poly that remained and kept the four vertices that were left. Both yellow and purple toggles are still there just rendered invisible by removing the polys. The video cuts to the exterior lights to show they still function to control the lights so I no longer need the toggles to display in the vc.

I also tried to demo the problem with the 3 way switches jumping if not in the same position when the battery switch, or at least what the auto weld left of the battery switch is clicked. Hopefully you can see my need for slaving the switches together.

Here is the base code I am using for each switch first the blue un powered version:

Code:
<part>
    <name>switch_light_section_off</name>
    <animation>
      <parameter>
        <code>
          25 (L:switch_light_section_off, number) 25 * +
        </code>
      </parameter>
    </animation>
    <mouserect>
      <cursor>Hand</cursor>
      <tooltip_text>Section Light</tooltip_text>
      <mouse_flags>LeftSingle+RightSingle</mouse_flags>
      <callback_code>
        (M:Event) 'LeftSingle' scmp 0 ==
        if{ (L:switch_light_section_off, enum) -- -1 max (>L:switch_light_section_off, enum) }
        (M:Event) 'RightSingle' scmp 0 ==
        if{ (L:switch_light_section_off, enum) ++  1 min (>L:switch_light_section_off, enum) }
      </callback_code>
    </mouserect>
  </part>

Now the red powered version:

Code:
<part>
    <name>switch_light_section_on</name>
    <animation>
      <parameter>
        <code>
          25 (L:switch_light_section_on, number) 25 * +
        </code>
      </parameter>
    </animation>
    <mouserect>
      <cursor>Hand</cursor>
      <tooltip_text>Section Light</tooltip_text>
      <mouse_flags>LeftSingle+RightSingle</mouse_flags>
      <callback_code>
        (M:Event) 'LeftSingle' scmp 0 ==
        if{ (L:switch_light_section_on, enum) -- -1 max (>L:switch_light_section_on, enum) }
        (M:Event) 'RightSingle' scmp 0 ==
        if{ (L:switch_light_section_on, enum) ++  1 min (>L:switch_light_section_on, enum) }
      </callback_code>
    </mouserect>
  </part>

Basicly the same code with the names changed to protect the innocent.
Any suggestions on how to slave the movement will be welcomed.

Oops! I forgot the video here it is:
http://www.pendercrafts.com/Carls folder/Fldr01/Slave demo.avi

Carl
 
Last edited:
Sorry, I've made switch combinations much more complicated than this and have never had one switch replace another like that. It just crazy in my mind to try to do this "slight of hand" kind of thing when with a little extra coding you could do it all with one physical switch each. Since I've never done anything remotely like this (and will never have to), I can't help...
 
Back
Top