Board index FlightGear Development Nasal

propeller finer coarser  Topic is solved

Nasal is the scripting language of FlightGear.

propeller finer coarser  

Postby Bomber » Mon Aug 14, 2017 6:04 pm

I'm needing to be able to adjust this using finer graduations than are at present done by the nasal (?) script...

I'd like to simply be able to rebind the keys as below example, I'm looking to do this only on my testing platform.... all other planes can be as before, using nasal.
But am finding they keep getting reset to 1 after about a second...

The question is what do I have to comment out, and in which file to prevent this from happening...

Any help appreciated.

Code: Select all
      <key n="110">
         <name>n</name>
         <desc>Propeller Finer</desc>
         <repeatable type="bool">true</repeatable>
         <binding>
            <command>property-adjust</command>
            <property>/fdm/jsbsim/fcs/advance-cmd-norm</property>
            <step>-0.1</step>
            <min>0</min>
            <max>1</max>
            <wrap>false</wrap>
         </binding>
      </key>
      
      <key n="78">
         <name>N</name>
         <desc>Propeller Coarser</desc>
         <repeatable type="bool">true</repeatable>
         <binding>
            <command>property-adjust</command>
            <property>/fdm/jsbsim/fcs/advance-cmd-norm</property>
            <step>0.1</step>
            <min>0</min>
            <max>1</max>
            <wrap>false</wrap>
         </binding>
      </key>
"If anyone ever tells you anything about an aeroplane which is so bloody complicated you can't understand it, take it from me - it's all balls" - R J Mitchel
Bomber
 
Posts: 1934
Joined: Fri Dec 14, 2007 7:06 pm
OS: Windows XP and 10

Re: propeller finer coarser

Postby Hooray » Mon Aug 14, 2017 6:16 pm

Maybe I am simply missing something, but I don't see any Nasal code in the posted snippet of code (?)
What I do see are so called fgcommands that operate on properties, as per $FG_ROOT/Docs/README.commands: http://wiki.flightgear.org/Bindings

If something is invalidating/overwriting your property modifications after a while (1000ms), it's most likely some other piece of code/XML etc that is conflicting with your changes, something that you are unaware of.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11309
Joined: Tue Mar 25, 2008 8:40 am

Re: propeller finer coarser

Postby Bomber » Mon Aug 14, 2017 6:27 pm

The keyboard file contains these lines

Code: Select all
 <key n="110">
  <name>n</name>
  <desc>Propeller Finer</desc>
  <repeatable type="bool">true</repeatable>
  <binding>
   <command>nasal</command>
   <script>controls.adjPropeller(1)</script>
  </binding>
 </key>

 <key n="78">
 <name>N</name>
  <desc>Propeller Coarser</desc>
  <repeatable type="bool">true</repeatable>
  <binding>
   <command>nasal</command>
   <script>controls.adjPropeller(-1)</script>
  </binding>
 </key>


"If anyone ever tells you anything about an aeroplane which is so bloody complicated you can't understand it, take it from me - it's all balls" - R J Mitchel
Bomber
 
Posts: 1934
Joined: Fri Dec 14, 2007 7:06 pm
OS: Windows XP and 10

Re: propeller finer coarser

Postby Bomber » Mon Aug 14, 2017 6:34 pm

it's ok.... all I seem to have to do is change the 1 to 0.1 to get a finer grade..

cheers tho.
"If anyone ever tells you anything about an aeroplane which is so bloody complicated you can't understand it, take it from me - it's all balls" - R J Mitchel
Bomber
 
Posts: 1934
Joined: Fri Dec 14, 2007 7:06 pm
OS: Windows XP and 10

Re: propeller finer coarser

Postby Hooray » Mon Aug 14, 2017 6:35 pm

okay, without having looked at the corresponding code, I would expect such code to end up in $FG_ROOT/Nasal/controls.nas and I think it will merely increment/decrement using +1/-1 respectively.

And given that it is bound to the same key (78), this would mean that you have a list of functions executed when that key is triggered - first, it would decrement using your XML markup (e.g. using -.1) and shortly thereafter, it would trigger the next binding for the same key, using -1/+1 respectively

Again, that it without having looked at anything else other than the snippets you have posted there.

But given these snippets, it would seem plausible that the "bindings" (=actions) registered to be invoked for the key "78" are indeed conflicting with each other, by mutually invalidating their changes. If in doubt, you could try to comment out "controls.adjPropeller(); calls by preprending a hash/pound sign, like this:

Code: Select all
<key n="78">
 <name>N</name>
  <desc>Propeller Coarser</desc>
  <repeatable type="bool">true</repeatable>
  <binding>
   <command>nasal</command>
   <script>#controls.adjPropeller(-1)</script>
  </binding>
 </key>



Alternatively, you could replace the token "nasal" with something unknown, e.g. something that is not a valid command - e.g. "null", and it would stop the execution of the script.

If that "fixes" your problem, you have found the snippet of code that is competing with your own changes. Which would mean that you'd want to load your own key bindings to overwrite those. If it doesn't fix your problem, there are more things going on somewhere ...
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11309
Joined: Tue Mar 25, 2008 8:40 am

Re: propeller finer coarser

Postby Bomber » Mon Aug 14, 2017 6:42 pm

I already have a custom keyboard file so I simply added this into it

Code: Select all
      <key n="106">
         <name>j</name>
         <desc>Propeller Finer</desc>
         <repeatable type="bool">true</repeatable>
         <binding>
            <command>nasal</command>
            <script>controls.adjPropeller(0.1)</script>
         </binding>
      </key>      
      
      <key n="74">
         <name>J</name>
         <desc>Propeller Coarser</desc>
         <repeatable type="bool">true</repeatable>
         <binding>
            <command>nasal</command>
            <script>controls.adjPropeller(-0.1)</script>
         </binding>
      </key>
"If anyone ever tells you anything about an aeroplane which is so bloody complicated you can't understand it, take it from me - it's all balls" - R J Mitchel
Bomber
 
Posts: 1934
Joined: Fri Dec 14, 2007 7:06 pm
OS: Windows XP and 10


Return to Nasal

Who is online

Users browsing this forum: No registered users and 1 guest