Just a quick question to all the logic code buffs out there. I am trying to integrate a axium multi zone amp in to my c-bus system, and have most of it up and running but the code for the source selection (which i borrowed and adapted from the forum) is a bit clunky and sometimes misses button presses (the button press is logged in the piced log file) or skips sources (jumps 2 source selections). So the question is. Am i going about this the right way or is there a easier or more elegant way to go about it so the code is [CODE] {Zone1 source Select} RequiredSourceZone1Amp := GetLightingLevel("Zone1Source"); {get the level} Zone1SourceOutString := Z1Source; {set the first part of the command string} Append(Zone1SourceOutString,Zone1Source); {add the strings together} Append(Zone1SourceOutString,LF); {add a line feed } if GetLightingState("Zone1Source")=ON then begin Zone1SourceCounter := Zone1SourceCounter +1; end; case Zone1SourceCounter of 1 : begin Zone1Source := CD; Zone1SourceName := 'CD'; end; 2 : begin Zone1Source := Tape; Zone1SourceName := 'Tape'; end; 3 : begin Zone1Source := Tuner; Zone1SourceName := 'Tuner'; end; 4 : begin Zone1Source := Aux; Zone1SourceName := 'Aux'; end; 5 : begin Zone1Source := Utility; Zone1SourceName := 'Utility'; end; 6 : begin Zone1Source := Sat; Zone1SourceName := 'Sat'; end; 7 : begin Zone1Source := Dvd; Zone1SourceName := 'Dvd'; end; 8 : begin Zone1Source := Video; Zone1SourceName := 'Video'; end; end; if Zone1SourceCounter >= 9 then begin Zone1SourceCounter := 0; end; if ( RequiredSourceZone1Amp <> CurrentSourceZone1Amp) then begin WriteSerial(1, Zone1SourceOutString); SetStringIBSystemIO("Label Group Text", "Local Network", "Lighting", "Zone1Source", Variant1, Zone1SourceName); CurrentSourceZone1Amp := RequiredSourceZone1Amp; end; [/CODE]