Jump to content
Sign in to follow this  
n4gix

MakeMDL.partx.xml Code to Rotate Knob

Recommended Posts

I have a knob in the VC I need to rotate to 3 positions:offdimbrightHas anyone had any success in MakeMDL.parts.xml version XML Code at rotating a knob based on a L:CabinLight variable?There are numerous examples of using "stock FS variables" but none using custom L:var types for anything except bool values.Further, there are examples of LeftSingle+LeftDrag+Wheel but no examples of RightSingle+RightDrag+Wheel???All the Rocker switches are completed and interfaced with the C gauge to keep 'em synched and allow for sound (via the C gauge logic), but the last three "rotary knobs" are being a PITA... ;)


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

Hmmm... I seem to "part way" towards the goal. The following code will rotate off, dim, bright, off... with consecutive Left mouse clicks. Rotating the knob gives the same sequence, regardless of direction... switch_cabinlight(L:CabinLight, enum) 50 * 300HandCabin Light(L:CabinLight, enum) ++ d 2 > if{ 0 } (>L:CabinLight, enum)


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

I hate "replying" to my own post, but... I found out that RightSingle does work, although unfortunately I can't see a way to combine the two into one area, and MakeMDL is intolerant of having two areas defined, since each one "covers the entire part." The good news is that the code in my first post will do the job at least... L:CabinLight,enum will count 0,1,2 and the 50 * multiplier translates into 0,50,100 for the part rotation...


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest airhead

Bill,Try detecting for a mouse event and type in your mouserect, then place your appropriate code based on the corresponding event (leftclick, rightclick, scroll, etc.). For each event type, you can use a conditional statement to detect which position the switch is already in (based on your var) and make the appropriate change to it's value, and consequently your knob position as well.

Share this post


Link to post
Share on other sites

Thanks for that, but it's not the logic with which I have a problem. Rather, it's the XML code structure and syntax! I could write working code in nearly any real computer language in a matter of minutes...The SDK rather breezily mentions M: events, but frankly is quite useless in describing the nuts-and-bolts of it's usage. Worse still is that the syntax used in XML gauges is quite a bit different that that used in the model XML code.


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest airhead

Ok then, maybe this will help a bit...

			(M:Event) 'LeftSingle' scmp 0 == 				if{ (L:Cabinmode, enum) 3 == 					if{ 0 (>L:Cabinmode,enum) } 					els{ (L:Cabinmode, enum) 0 == 						if{ 1 (>L:Cabinmode,enum) } 						els{ (L:Cabinmode, enum) 1 == 							if{ 2 (>L:Cabinmode,enum) }						}					}				}			(M:Event) 'RightSingle' scmp 0 == 				if{ (L:Cabinmode, enum) 2 == 					if{ 1 (>L:Cabinmode,enum) } 					els{ (L:Cabinmode, enum) 1 == 						if{ 0 (>L:Cabinmode,enum) } 						els{ (L:Cabinmode, enum) 0 == 							if{ 3 (>L:Cabinmode,enum) }						}					}				}

This is just a snip of the whole mouserect from a cabin temp control I did a while back. You can use mouse wheel events in this format as well. Doing so allows you to break out every type of event and write code specifically tailored for each action. While this is a relatively simple example, it should help with the structure for the parts.xml file. For the most part, I have found the coding to be relatively similar to standard xml gauges, though there are a few things I have found that tend not to work and play well with makemdl and require a workaround.

Share this post


Link to post
Share on other sites

YES!!!Thank you so very, very much! May God bless you for your act of kindness sir!I had just about resigned myself to having to use an "invisible C gauge" to accomplish this task.Now that I understand the syntax and structure, it seems so "easy..." ;)


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest airhead

Good to hear it all worked out for you.

Share this post


Link to post
Share on other sites

>Good to hear it all worked out for you.Now all I have to do is finish updating the electricalpanel.cpp code to include the three rotary knobs. The model's XML code simply controls the animation. The L:vars are read & written by the C code, and all actual "switching" and "sound" is supplied by the C gauge's logic. ;)


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

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...