- Messages
- 189
- Country

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.



It will work. That is the exact script I'm using. There are 40 possible "fractional frequencies" which is why the range for the L:var tuning variable is 0 to 39.I found something on this forum that will be usable, I hope![]()

(L:B737_Com1Stby_WHOLE_TUNE,enum) 19 ==
if{ 0 (>L:B737_Com1Stby_WHOLE_TUNE,enum) }
(L:B737_Com1Stby_WHOLE_TUNE,enum) -1 ==
if{ 18 (>L:B737_Com1Stby_WHOLE_TUNE,enum) }

Bill,
in that code you count L:B737_Com1Stby_WHOLE_TUNE from -1 to +19, then you change -1 to +18, and +19 to 0. You calculating similar with the decimal variable. What's the reason of this?

(M:Event) 'WheelDown' scmi 0 == if{ (L:com_mhz,number) -- 0 max (>L:com_mhz,number) }
(M:Event) 'WheelUp' scmi 0 == if{ (L:com_mhz,number) ++ 18 min (>L:com_mhz,number) }
118 (L:com_mhz,number) + (L:com_khz,number) +
100.001 * 10000 % int
d 10 % r 10 / int
d 10 % r 10 / int
d 10 % r 10 / int
16 * +
16 * +
16 * +
(>K:COM_RADIO_SET)

(P:local time, seconds) 2 + (>L:T38_Com_MouseActive,enum)
<!-- INTRODUCE SLIGHT DELAY TO ALLOW FOR DIRECT ENTRY FROM KNOBS -->
(L:T38_Com_CompleteFreq,enum) (A:COM1 ACTIVE FREQUENCY,Mhz) !=
(L:T38_Com_MouseActive,enum) (P:local time, seconds) >
and
if{ }
els{
@ExtDigit((A:COM1 ACTIVE FREQUENCY,Khz),6,0) (>L:T38_Com_100_TUNE,enum)
@ExtDigit((A:COM1 ACTIVE FREQUENCY,Khz),5,0) (>L:T38_Com_10_TUNE,enum)
@ExtDigit((A:COM1 ACTIVE FREQUENCY,Khz),4,0) (>L:T38_Com_1_TUNE,enum)
@ExtDigit((A:COM1 ACTIVE FREQUENCY,Khz),3,0) (>L:T38_Com_10ths_TUNE,enum)
@ExtDigit((A:COM1 ACTIVE FREQUENCY,Khz),2,0) s0
l0 0 == if{ 0 (>L:T38_Com_100ths_TUNE,enum) }
l0 2 == if{ 1 (>L:T38_Com_100ths_TUNE,enum) }
l0 5 == if{ 2 (>L:T38_Com_100ths_TUNE,enum) }
l0 7 == if{ 3 (>L:T38_Com_100ths_TUNE,enum) }
}

I haven't had to do anything to the B737-200 script to ensure continuity of tuning...

It's interesting, because in my plane when I first load it, and click the COM radio knobs for the first time, it's jumps to the "zero" position everytime, namely to 118.000Mhz
In your code @ExtDigit is a macro, as I think, which pick out the digits from the frequency(?) Do I need to put in this macro somewhere or it is the part of the plugin?
<!-- SET COM1 STBY RADIO BASE FREQUENCY -->
(A:COM STANDBY FREQUENCY:1,Mhz) 999.999 min 0 max 100 % 10 / flr (>L:B737_Com1Stby_10_TUNE,enum)
(A:COM STANDBY FREQUENCY:1,Mhz) 999.999 min 0 max 10 % flr (>L:B737_Com1Stby_1_TUNE,enum)
(A:COM STANDBY FREQUENCY:1,Mhz) 10 * 99999.999 min 0 max 10 % flr (>L:B737_Com1Stby_10ths_TUNE,enum)
(A:COM STANDBY FREQUENCY:1,Mhz) 100 * 0.1 + 10 % flr (>L:B737_Com1Stby_100ths_TUNE,enum)
(L:B737_Com1Stby_10_TUNE,enum) (L:B737_Com1Stby_1_TUNE,enum) + (>L:B737_Com1Stby_WHOLE_TUNE,enum)
(L:B737_Com1Stby_10ths_TUNE,enum) (L:B737_Com1Stby_WHOLE_TUNE,enum) + (>L:Com1StbyDecimal,enum)
118 (L:B737_Com1Stby_WHOLE_TUNE,enum) + (L:Com1StbyDecimal,enum) +
100 * 10000 % int d 10 % r 10 / int d 10 % r 10 / int d 10 % r 10 / int 16 * + 16 * + 16 * + (>K:COM_STBY_RADIO_SET)
<!-- SET COM2 STBY RADIO BASE FREQUENCY -->
(A:COM STANDBY FREQUENCY:2,Mhz) 999.999 min 0 max 100 % 10 / flr (>L:B737_Com2Stby_10_TUNE,enum)
(A:COM STANDBY FREQUENCY:2,Mhz) 999.999 min 0 max 10 % flr (>L:B737_Com1Stby_2_TUNE,enum)
(A:COM STANDBY FREQUENCY:2,Mhz) 10 * 99999.999 min 0 max 10 % flr (>L:B737_Com2Stby_10ths_TUNE,enum)
(A:COM STANDBY FREQUENCY:2,Mhz) 100 * 0.1 + 10 % flr (>L:B737_Com2Stby_100ths_TUNE,enum)
(L:B737_Com2Stby_10_TUNE,enum) (L:B737_Com2Stby_1_TUNE,enum) + (>L:B737_Com2Stby_WHOLE_TUNE,enum)
(L:B737_Com2Stby_10ths_TUNE,enum) (L:B737_Com2Stby_WHOLE_TUNE,enum) + (>L:Com2StbyDecimal,enum)
118 (L:B737_Com2Stby_WHOLE_TUNE,enum) + (L:Com2StbyDecimal,enum) +
100 * 10000 % int d 10 % r 10 / int d 10 % r 10 / int d 10 % r 10 / int 16 * + 16 * + 16 * + (>K:COM2_STBY_RADIO_SET)


<!-- SECONDARY INIT SECTION TO DO ONCE ON A/C LOAD! -->
(L:T38_Init2,bool) 0 ==
if{
15.5 (>L:Buffet_P1_Start,enum)
17.0 (>L:Buffet_P1_End,enum)
20.0 (>L:Buffet_P2_End,enum)
1 (>L:T38_Init2,bool)
}
<!-- END SECONDARY INITIALIZATION -->
<Update Hidden="Yes">
<!-- COPY TO MODELDEF.XML INIT SECTION WHEN COMPLETED! -->
<!-- 1 SECOND UPDATE -->
(P:Absolute time,seconds) 1 % 1 > !
if{
15.5 (>L:Buffet_P1_Start,enum)
17.0 (>L:Buffet_P1_End,enum)
20.0 (>L:Buffet_P2_End,enum)
}


<CallbackCode>
(M:Event) 'WheelUp' scmi 0 == if{ (L:khz,number) ++ 40 min (>L:khz,number) 1 (>L:lun_khz_hang,enum) }
(M:Event) 'WheelDown' scmi 0 == if{ (L:khz,number) -- -1 max (>L:khz,number) 1 (>L:lun_khz_hang,enum) }
(L:khz,number) 40 == if{ 0 (>L:khz,number) }
(L:khz,number) -1 == if{ 39 (>L:khz,number) }
(L:khz,number) 0.025 * (>L:com_khz,number)
118 (L:com_mhz,number) + (L:com_khz,number) +
100.001 * 10000 % int
d 10 % r 10 / int
d 10 % r 10 / int
d 10 % r 10 / int
16 * + 16 * + 16 * + (>K:COM_RADIO_SET)
</CallbackCode>
(L:khz,number) [COLOR="Red"]39 >[/COLOR] if{ 0 (>L:khz,number) }

<PartInfo>
<Name>gomb_com_MHz</Name>
<AnimLength>180</AnimLength>
<Animation>
<Parameter>
<Code>(L:com_mhz,number) (A:COM ACTIVE FREQUENCY:1, MHz) 118 - int !=
if{ (A:COM ACTIVE FREQUENCY:1, MHz) 118 - int (>L:com_mhz,number) }
(A:COM ACTIVE FREQUENCY:1, MHz) 118 - int 10 *
</Code>
</Parameter>
</Animation>
<MouseRect>
<Cursor>hand</Cursor>
<TooltipText>COM Freq - %((A:COM ACTIVE FREQUENCY:1, MHz))%!3.3f!MHz</TooltipText>
<MouseFlags>WheelUp+WheelDown+LeftSingle+RightSingle</MouseFlags>
<CallbackCode>
(M:Event) 'LeftSingle' scmp 0 ==
(M:Event) 'WheelDown' scmi 0 == or
if{ (L:com_mhz,number) -- -1 max (>L:com_mhz,number) 1 (>L:lun_mhz_hang,enum) }
(M:Event) 'RightSingle' scmp 0 ==
(M:Event) 'WheelUp' scmi 0 == or
if{ (L:com_mhz,number) ++ 19 min (>L:com_mhz,number) 1 (>L:lun_mhz_hang,enum) }
118 (L:com_mhz,number) + (L:com_khz,number) +
100.001 * 10000 % int d 10 % r 10 / int d 10 % r 10 / int d 10 % r 10 / int 16 * + 16 * + 16 * + (>K:COM_RADIO_SET)
</CallbackCode>
</MouseRect>
</PartInfo>
<PartInfo>
<Name>gomb_com_kHz</Name>
<AnimLength>360</AnimLength>
<Animation>
<Parameter>
<Code>(L:com_khz,number) (A:COM ACTIVE FREQUENCY:1, MHz) 1 % !=
if{ (A:COM ACTIVE FREQUENCY:1, MHz) 1 % 0.025 / (>L:khz,number)
(L:khz,number) 0.025 * (>L:com_khz,number) }
(A:COM ACTIVE FREQUENCY:1, MHz) 1 % 360 *
</Code>
</Parameter>
</Animation>
<MouseRect>
<Cursor>hand</Cursor>
<TooltipText>COM Freq - %((A:COM ACTIVE FREQUENCY:1, MHz))%!3.3f!MHz</TooltipText>
<MouseFlags>WheelUp+WheelDown+LeftSingle+RightSingle</MouseFlags>
<CallbackCode>
(M:Event) 'RightSingle' scmp 0 ==
(M:Event) 'WheelUp' scmi 0 == or
if{ (L:khz,number) ++ 40 min (>L:khz,number) 1 (>L:lun_khz_hang,enum) }
(M:Event) 'LeftSingle' scmp 0 ==
(M:Event) 'WheelDown' scmi 0 == or
if{ (L:khz,number) -- -1 max (>L:khz,number) 1 (>L:lun_khz_hang,enum) }
(L:khz,number) 39 > if{ 0 (>L:khz,number) }
(L:khz,number) -1 == if{ 39 (>L:khz,number) }
(L:khz,number) 0.025 * (>L:com_khz,number)
118 (L:com_mhz,number) + (L:com_khz,number) +
100.001 * 10000 % int d 10 % r 10 / int d 10 % r 10 / int d 10 % r 10 / int 16 * + 16 * + 16 * + (>K:COM_RADIO_SET)
</CallbackCode>
</MouseRect>
</PartInfo>


I've been trying to modify the working code above to meet my requirements but not had much luck. The code as it stands seems to rotate the part through 180° and then stops.
For my part I need it to rotate through 360° without the stop (i.e. to keep turning as long as the user provides input) as the dial starts back at 118 Mhz again after the first revolution.
Can anyone suggest how I can adapt the code to my needs please?
