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

I need an opinion on this code

Messages
10,163
Country
us-arizona
Hey all,

Do you see anything wrong on this code block? This is for a Gmax animation;


Code:
<part>
	<name>lhc_ap_hdgalt_lock</name>
	<animation>
		<parameter>
        <code>
           (L:LHC AUTO PILOT HDG ALT LOCK,bool) 10 *
        </code>
       <lag>100</lag>
		</parameter>
	</animation>
	<mouserect>
		<cursor>Hand</cursor>
                                <tooltip_text>AUTO PILOT HDG & ALT LOCK</tooltip_text>
		<event_id>AP_HDG_HOLD_ON
                                                   AP_ALT_HOLD_ON
                                </event_id>
               1 (&gt;L:XMLSND4,enum)
	</mouserect>
</part>



Note that I have two assignments in the event id. I stacked them. I dont know if thats possible. I am trying to figure out what crashed my animations sheet for Gmax (FS2004) and it stated that the tooltip was the crash; 'no white zone allowed for this line' I think is what it said. I wonder if its the section below it that it was hanging up on.

How would it be written for two of these, if I may ask?



Bill
 
Hey all,

Do you see anything wrong on this code block? This is for a Gmax animation;

Note that I have two assignments in the event id. I stacked them. I dont know if thats possible. I am trying to figure out what crashed my animations sheet for Gmax (FS2004) and it stated that the tooltip was the crash; 'no white zone allowed for this line' I think is what it said. I wonder if its the section below it that it was hanging up on.

How would it be written for two of these, if I may ask?

Bill, you can have one -and only one- command in an <event_id>.

If you need to issue more than one, then you must use the <callback_code> method. Also, you will need to trigger the custom L:Var for your <code> section as well. The reason for the crash is that you've tried to trigger the sound effect outside of the <callback_code>

Code:
<part>
      <name>lhc_ap_hdgalt_lock</name>
	<animation>
	   <parameter>
                    <code>
                       (L:LHC AUTO PILOT HDG ALT LOCK,bool) 10 *
                    </code>
                    <lag>100</lag>
	   </parameter>
	</animation>
      <mouserect>
          <cursor>Hand</cursor>
          <tooltip_text>AUTO PILOT HDG & ALT LOCK</tooltip_text>
          <callback_code>
              (>K:AP_ALT_HOLD_ON)
              (>K:AP_HDG_HOLD_ON)
              1 (>L:LHC AUTO PILOT HDG ALT LOCK,bool)
              1 (>L:XMLSND4,enum)
          </callback_code>
      </mouserect>
</part>

Now that's just fine for turning things ON, but...

...how are ya gonna turn 'em off again?
 
Ahh sooo......

Many thanks Bill.

For some reason, I always think of K: as being keyboard controls only.

Off to do some experimenting.


Bill
LHC
 
Found it.


<callback_code>
(>K:AP_ALT_HOLD)
(>K:AP_HDG_HOLD)
1 (>L:LHC AUTO PILOT HDG ALT LOCK,bool)
1 (>L:XMLSND4,enum)
</callback_code>

These can be written as a toggle;
AP_ALT_HOLD
AP_HDG_HOLD

Thanks Bill.
 
These can be written as a toggle;
AP_ALT_HOLD
AP_HDG_HOLD

Thanks Bill.

You are correct. It's easy for me to get these confused, because the multiple autopilot Kommands are a tangled mess!

In that case I'd approach the Animation a bit differently to make things easier on yourself:
Code:
<part>
      <name>lhc_ap_hdgalt_lock</name>
	<animation>
	   <parameter>
                    <code>
                       (A:AUTOPILOT HEADING LOCK,bool)
                       (A:AUTOPILOT ALTITUDE LOCK,bool) and 10 *
                    </code>
                    <lag>100</lag>
	   </parameter>
	</animation>
      <mouserect>
          <cursor>Hand</cursor>
          <tooltip_text>AUTO PILOT HDG & ALT LOCK</tooltip_text>
          <callback_code>
              (>K:AP_ALT_HOLD_ON)
              (>K:AP_HDG_HOLD_ON)
              1 (>L:XMLSND4,enum)
          </callback_code>
      </mouserect>
</part>
 
Thanks Bill.

I'll give that one a test also. So far the animation is still messed up, still not functioning (the entire animation list).


Bill
 
This is still not working.

There must be a typo in it some where that is holding it back. Maybe a space that shouldnt be there?


Code:
<part>
	<name>lhc_ap_hdgalt_lock</name>
	<animation>
		<parameter>
        <code>
           (L:LHC AUTO PILOT HDG ALT LOCK,bool) 10 *
        </code>
       <lag>100</lag>
		</parameter>
	</animation>
	<mouserect>
		<cursor>Hand</cursor>
                                <tooltip_text>AUTO PILOT HDG & ALT LOCK</tooltip_text>
         <callback_code>
              (>K:AP_ALT_HOLD)
              (>K:AP_HDG_HOLD)
              1 (>L:LHC AUTO PILOT HDG ALT LOCK,bool)
              1 (>L:XMLSND4,enum)
        </callback_code>
	</mouserect>
</part>
 
No, it's the bloody darned "&" in your <tooltip_text> that I've failed to notice. As soon as I copy/pasted your script into Visual Studio's XML editor, it highlighted the bugger immediately as an "error!" The ampersand "&" is a reserved character in XML. It is the "bit-shift operator".

Also, since the two K:events are toggles, you must also write your custom L:var to be a toggle as well. Since this could lead to synchronization problems, I highly recommend that you eliminate this custom L:var and make the animation dependent on the state of the two K:vars as I indicated in my previous reply.

Code:
  <part>
    <name>lhc_ap_hdgalt_lock</name>
    <animation>
      <parameter>
        <code>
          (L:LHC AUTO PILOT HDG ALT LOCK,bool) 10 *
        </code>
        <lag>100</lag>
      </parameter>
    </animation>
    <mouserect>
      <cursor>Hand</cursor>
      <tooltip_text>AUTO PILOT HDG/ALT LOCK</tooltip_text>
      <callback_code>
        (>K:AP_ALT_HOLD)
        (>K:AP_HDG_HOLD)
        (L:LHC AUTO PILOT HDG ALT LOCK,bool) ! (>L:LHC AUTO PILOT HDG ALT LOCK,bool)
        1 (>L:XMLSND4,enum)
      </callback_code>
    </mouserect>
  </part>
 
Ahhh soo..

Thanks Bill. Man, I was wondering what in the world it was.

Roger that on the custom L:var



Bill
 
Back
Top