Jump to content
Sign in to follow this  
Guest LOT

Rotating Knob Gauge

Recommended Posts

Guest LOT

Hi all!I need to create a rotating knob on an ADF panel using the ADF Panel bitmap and the knob bitmap. The knob is supposed to have 4 positions:knob1dt.jpgSo far I managed to create only 2 positions:(G:Var1)Rotating Knob(G:Var1) ! (>G:Var1)Any ideas?

Share this post


Link to post
Share on other sites

Yes :-)G:Var1) ! (>G:Var1) means you use G: Var1 as a boolean, so one 0 and 1.Also don't use a G:var, since under some circumstances (like going from Windowed to FullScreen mode, v.v.) but use an L:var instead.Like:(L:RotatingKnob,enum) ++ d (>L:RotatingKnob,enum)4 ==if{ 0 (>L:RotatingKnob,enum) }If you want two clickspots (like up and down), use (mind the xx and yy):Rotating Knob(L:RotatingKnob,enum) ++ 3 min (>L:RotatingKnob,enum)Rotating Knob(L:RotatingKnob,enum) -- 0 max (>L:RotatingKnob,enum)Cheers, Rob

Share this post


Link to post
Share on other sites
Guest LOT

Thanks, Rob! :) It works. I was a bit misled by Nick Pike's FS2004 XML Gauge Programming tutorial (1.4 and ) in which he is using G:Var for rotating.Now I'd like to add a sound to the knob with the dsd_xml_sound3.gau gauge. I configured the sounds.ini file as follows:---------------[Config]MaxSounds=1Lvar=dsd_xml_sound_idLvarStop=dsd_stop_sounds[sounds]Sound00=./THE_PATH/click.wav[LVars]Lvar00=dsd_xml_sound_id_00---------------Also I added the dsd_xml_sound_id_00 Lvar to the clickable areas:---------------Rotating Knob(L:RotatingKnob,enum) ++ 3 min (>L:RotatingKnob,enum) 1 (>L:dsd_xml_sound_id_00,number)Rotating Knob(L:RotatingKnob,enum) -- 0 max (>L:RotatingKnob,enum) 1 (>L:dsd_xml_sound_id_00,number)---------------I have the sound now but there is a little problem that you can still hear it when you click on extreme left and right positions (for (+) and (-) clickable areas). I have to change the logic so I can hear the sound only when rotating the knob. Any help would be appreciated. :)

Share this post


Link to post
Share on other sites

Hi,Try for the sound:(L:RotatingKnob,enum) s0 0 >= l0 3 <= and if{ 1 (>L:dsd_xml_sound_id_00,number) } Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites
Guest LOT

>Hi,>>Try for the sound:>>(L:RotatingKnob,enum) s0 0 >= l0 3 <= and >if{ 1 (>L:dsd_xml_sound_id_00,number) } >>Jan>>"Beatus ille qui procul negotiis..."Hi, Looks like something wrong with the syntax because the gauge won't show up. Any ideas?

Share this post


Link to post
Share on other sites

Hi,Possible(?);try:(L:RotatingKnob,enum) -- 0 max (>L:RotatingKnob,enum) (L:RotatingKnob,enum) 0 >= (L:RotatingKnob,enum) 3 <= && if{ 1 (>L:dsd_xml_sound_id_00,number) } (L:RotatingKnob,enum) ++ 3 min (>L:RotatingKnob,enum) (L:RotatingKnob,enum) 0 >= (L:RotatingKnob,enum) 3 <= && if{ 1 (>L:dsd_xml_sound_id_00,number) } Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

I think the problem is in using "<=" or in "and"I've never figured out when you could you these constructors like >, >=, < or <=. Hence, I always use:- ">" instead of ">"- "<" instead of "<"- "&&" instead of "and"That always works.Try it. At least the gauge loads now.But (sorry Jan if I'm wrong), it doesn't do what you what.If I understand correctly, you only want the sound if (L:RotatingKnob,enum) actually changes when you click the gauge, right ?So NOT with UP if it's already 3, or DOWN if it's already 0.If so, use:Rotating Knob(L:RotatingKnob,enum) 3 <if{ 1 (>L:dsd_xml_sound_id_00,number) }(L:RotatingKnob,enum) ++ 3 min (>L:RotatingKnob,enum)Rotating Knob(L:RotatingKnob,enum) 0 >if{ 1 (>L:dsd_xml_sound_id_00,number) }(L:RotatingKnob,enum) -- 0 max (>L:RotatingKnob,enum)Rob

Share this post


Link to post
Share on other sites

Hi Jan,Using "<" as smaller-than" gives a syntax error.Which, come to think of it, is logical. Because "<" is the opening symbol of the next tag. Which also explains why ">" DOES work :-)Cheers, Rob

Share this post


Link to post
Share on other sites

Hi,Totally correct.That is why i always use more click area's like:0 (>L:RotatingKnob,enum)1 (>L:dsd_xml_sound_id_00,number)1 (>L:RotatingKnob,enum)1 (>L:dsd_xml_sound_id_00,number)2 (>L:RotatingKnob,enum)1 (>L:dsd_xml_sound_id_00,number)3 (>L:RotatingKnob,enum)1 (>L:dsd_xml_sound_id_00,number)Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Jan, did you also noticed my post above (#7) about "<" being illegal as "smaller-than" operator (gives a syntax error)??Cheers, ROb

Share this post


Link to post
Share on other sites

Hi,I use this approach, works good when there is complex code embedded:Cant of positions : 3 (0-2)Up:(Lvar) ++ 3 min (>Lvar)If lvar = 1 then complex codeIf lvar = 2 then complex codeLVar 3 == if{ 2 (>Lvar) }Down:(Lvar) -- -1 max (>Lvar)If lvar = 0 then complex codeIf lvar = 1 then complex codeLVar -1 == if{ 0 (>Lvar) }Tom

Share this post


Link to post
Share on other sites

Hi,I know, but the forum translates my > and < in the wrong characters.I use the right ones.Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites
Guest LOT

Thanks, guys! Now it's all right. I used Rob's solution. Now I need to create a pressed/released button on the panel. Its mechanics should work like a "mouse button". I put it as follows: (L:Button,bool)Button(L:Button,bool) ! (>L:Button,bool)Now the problem is that I'd like to add 2 sounds to it: when you press it you can hear L:dsd_xml_sound_id_03 (that sounds once) and when you release it you can hear L:dsd_xml_sound_id_04.Also when using the above code continuous button press/release actionshappen when you press & hold the mouse button. I have change the codeso that when you press the button it remains pressed. Any suggestions?

Share this post


Link to post
Share on other sites

Hi,Play with:(M:Event) 'LeftSingle' scmp 0 == if{ 1 (>L:dsd_xml_sound_id_03,enum) 1 (>L:Button,bool) } (M:Event) 'Leave' scmp 0 == if{ 1 (>L:dsd_xml_sound_id_04,enum) 0 (>L:Button,bool) } Hope it helps,Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites
Guest LOT

Hi,Thanks, but when using your code you can hear the sounds but the bitmaps won't change. Also when you click & hold the mouse button the sounds come repeatedly. I rewrote the code as follows: Button (L:Button,bool) ! (>L:Button,bool) (L:Button,bool) 1 < if{ 1 (>L:dsd_xml_sound_id_03,number) } (L:Button,bool) 0 > if{ 1 (>L:dsd_xml_sound_id_04,number) } Now when you single click the button all seems perfect but when you hold the mouse button down the sounds and bitmaps start to change repeatedly and even change the order they apear and sound. Any ideas to solve this?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...