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

FSX Lock stick

Messages
106
Country
germany
Hi guys,

my little project is a lock for a stick.
if the lock is 1, then the stick don`t move.
my problem is the stick moves allways.
is if with an A-variable allowed?

if yes, what is wrong?

Code:
<PartInfo>
        <Name>lever_stick_l_r_block</Name>
        <AnimLength>100</AnimLength>
        <Animation>
            <Parameter>
                <Code>
            (L:stickblock,bool) 0 == if{ (A:YOKE X POSITION, percent) }
          </Code>
            </Parameter>
        </Animation>
    </PartInfo>

MiJo
 
I think testing a variable for 0 is a bit buggy in MSFS. Try "1 !=" instead.
 
What about this?

Code:
(L:stickblock,bool) 0 == if{ 0 (>K:AILERON_SET) }

You can add this to a controller (a single polygon) and have the stick itself animated with the appropriate default animation tag.
 
Your part name (lever_stick_l_r_block) may be too long, and FS is only reading the part as lever_stick_l_r. Try using something like lever_stick_block_l_r

Hope this helps,
 
i have 2 parts.
lever_stick_l_r_block and lever_stick_foraft_block.

when i used these names is the variable equal. i can use any variable like in this thread "K:AILERON_SET". i can move the stick.

when i use l_s_l_r_block and the correct variable "A:YOKE X POSITION, percent", then the animation is dead.

this is going ober names not variables
 
I still don't understand why you want to use A:YOKE X POSITION...



(You can also explain it in german if you want to.)
 
ok in deutsch :)

mein plan ist es, den stick (beide achsen) zu blockieren, sobald ein bügel auf dem stick liegt.

der bügel bekommt die variable "L:stickblock,bool".

jetzt gibt es das problem, dass ich ein if-anweisung schreiben kann, wie ich will, den stick kann ich immer bewegen. dabei ist es egal, welche variable der stick hat. entscheidend scheint hier der name zu sein.

wenn ich nun aber den namen änder, aber die korrekte variable verwende ist die animation tot.
 
Ich mache eigentlich dasselbe in meiner 737, aber nehme die K:-Variablen (für Ailerons und Elevators), um Yoke und Stick zu blockieren. Das funktioniert tadellos. :confused:


Also nochmal in Codeform. Erst der Bügel.
Code:
<PartInfo>
 <Name>Stick_Lock</Name>
 <AnimLength>100</AnimLength>
 <Animation>
 <Parameter>
 <Code>
 (L:Stickblock, bool) 50*
 </Code>
 <Lag>200</Lag>
 </Parameter>
  </Animation>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>Lock control stick (%((L:Stickblock, bool))%{case}%{:0}Disengaged%{:1}Engaged%{end})</TooltipText>		
 <MouseFlags>LeftSingle</MouseFlags>
<CallbackCode>
 (L:Stickblock, bool) ! (&gt;L:Stickblock,bool)
</CallbackCode>
</MouseRect>
</PartInfo>

Denk an den, für jede Animation nötigen, Index-Eintrag mit GUID usw...

Als nächstes ein Controller für die Implementierung der Animation. Falls du's nicht weisst: "Controller" sind simple, versteckte Polygone mit irgendeinem Material und dieser Animation. Keyframes sollten vorhanden sein, der Controller muss sich aber nicht unbedingt bewegen.

Code:
<PartInfo>
 <Name>Stick_Controller</Name>
  <AnimLength>2</AnimLength>    
   <Animation>   
     <Parameter>     
      <Code>
       (L:Stickblock, bool) 0 !=
       if{ 0 (&gt;L:STICK X, enum)  0 (&gt;L:STICK Y, enum) }
       els{ (A:AILERON POSITION, percent) (&gt;L:STICK X, enum)
             (A:ELEVATOR POSITION, percent) (&gt;L:STICK Y, enum) }
       </Code>  
     </Parameter>   
   </Animation> 
</PartInfo>

Und zum Schluss der Stick selbst:

Code:
<PartInfo>
 <Name>Stick_X_Axis</Name>
 <AnimLength>100</AnimLength>
 <Animation>
 <Parameter>
 <Code>
 (L:STICK X, enum) 50 +
 </Code>
 </Parameter>
  </Animation>
</PartInfo>

<PartInfo>
 <Name>Stick_Y_Axis</Name>
 <AnimLength>100</AnimLength>
 <Animation>
 <Parameter>
 <Code>
 (L:STICK Y, enum) 50 +
 </Code>
 </Parameter>
  </Animation>
</PartInfo>


Vielleicht ist das alles aufwendiger als es sein müsste, aber ich implementiere meine Sachen lieber übersichtlicher nach dem klar getrennten "Input -> Verarbeiten -> Output"-Schema anstatt irgendwelche Verarbeitungsanweisungen irgendwo reinzuklatschen.
 
Sag bescheid obs funktioniert hat. Dann kann ich meinen Ansatz ja mal für andere übersetzen.
 
funktioniert echt klasse. nur das der der stick nicht mehr in der mittelstellung ist. mal nen bissl neu animieren.

Danke vielmals :D
 
Weist du dem Stick selbst beide Animationstags (also für X und Y) zu?
 
habe es gestern auf die ganz blöde art versucht. und es ging ohne controller mit einer einfachen if-anweisung
 
code for locking the collective

Lock
Code:
<part>
	<name>col_sperre</name>
	<animation>
	   <parameter>
		<code>(L:sperre1, bool) 100 *
		</code>
		<lag>100</lag>
	   </parameter>
	</animation>
	<mouserect>
		<cursor>Hand</cursor>
		<tooltip_text>COLLECTIVE LOCK (%((L:sperre1, bool))%{case}%{:0}Disengaged%{:1}Engaged%{end})</tooltip_text>
		<callback_code>
		 (L:sperre1, bool) ! (>L:sperre1, bool) 1 (>L:click,enum)
		</callback_code>
	</mouserect>
   </part>

collective
Code:
<Part>
 <Name>test_col</Name>
 <AnimLength>100</AnimLength>
  <Animation>
    <Parameter>
     <Code>
        (L:sperre1, bool) 1 != if{ (A:GENERAL ENG THROTTLE LEVER POSITION:1, percent) }
     </Code>
    </Parameter>
  </Animation>
</Part>
 
Back
Top