Talk:Bindings: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
(Created page with 'How do <tt><command>property-set</command></tt> and <tt><command>property-assign</command></tt> (used in the CDU) differ? --~~~~')
 
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
How do <tt><command>property-set</command></tt> and <tt><command>property-assign</command></tt> (used in the [[CDU]]) differ?
How do <tt><command>property-set</command></tt> and <tt><command>property-assign</command></tt> (used in the [[CDU]]) differ?
--[[User:Hcc23|Hcc23]] 22:55, 1 December 2010 (UTC)
--[[User:Hcc23|Hcc23]] 22:55, 1 December 2010 (UTC)
----
Hi Hcc23,
welcome on board :-)
* these (and other) commands are documented in $FG_ROOT/Docs/README.commands (FG_ROOT being the FG base package): http://gitorious.org/fg/fgdata/blobs/master/Docs/README.commands
* the C++ code implementing these commands is to be found in $FG_SRC/Main/fg_commands.cxx http://gitorious.org/fg/flightgear/blobs/next/src/Main/fg_commands.cxx
* increasingly, such hard-coded commands are being replaced with [[Nasal]] (scripting language) code instead
* the details of osgText animations are documented in $FG_ROOT/Docs/README.osgtext: http://gitorious.org/fg/fgdata/blobs/master/Docs/README.osgtext
* the lateral keys of a CDU are commonly called "Line Select Keys" (LSK), so this might be a more appropriate abbreviation
* the whole project's source code can be found at http://gitorious.org/fg/ - you can easily clone the whole project to work on your own branches
* the [http://www.flightgear.org/mail.html FlightGear developers mailing list] and the [http://www.flighgear.org/forums FlightGear forums] are a better place to get more direct feedback
Even if you should not subscribe to the developers mailing list, make sure to still check out the forums - let us know if you have any questions.
--[[User:Hooray|Hooray]] 23:42, 1 December 2010 (UTC)
== Out of date? ==
Hi Hooray,
Could you indicate wich part is out of date? Not complete is something different than out of date. As far as I'm aware the content of the article is mostly/completely correct.
[[User:Gijs|Gijs]] 15:11, 29 May 2013 (UTC)
: incomplete and thus not up-to-date --[[User:Hooray|Hooray]] 15:21, 29 May 2013 (UTC)
:: Still there's a big difference between the two (when considering the template text), so I've created a special {{tl|incomplete}} template. This should also help wiki contributors see where their help is most needed (out dated/faulty documentation is worse than no documentation) ;-)
:: [[User:Gijs|Gijs]] 15:50, 29 May 2013 (UTC)
::: Yes, thanks - we had quite an editing war there, lots of conflicts because I was doing the same thing. I have reverted my changes now, are you going to add an optional argument to the template?--[[User:Hooray|Hooray]] 15:51, 29 May 2013 (UTC)
== This could be more generic ==
I note that the commands can be used both when defining bindings in xml files and when programming in nasal, so why not make this more generic and just list the commands and the named parameters and then have a section in the beginning (or maybe the end) with examples on how to use commands both for bindings and in Nasal?
I volunteer to do that, though I might need some help with one or two small Nasal snippets.
In addition it might be a good idea to add most if not all bindings in flightgear/src/Main/fg_commands.cxx.  (I am very grateful for the commented code there.)
Finally, can the commands be used for more things in XML files than bindings?
—[[User:Johan G|Johan G]] ([[User_talk:Johan_G|Talk]] | [[Special:Contributions/Johan_G|contribs]]) 18:22, 26 August 2014 (UTC)
== fgcommand() Nasal bindings ==
I had a lot of trouble getting property-cycle to work, so here is some working code:
<syntaxhighlight lang="nasal">
  var states = props.Node.new ({
    "property": "/instrumentation/clock/chronograph-state",
    "value": ["running", "stopped", "reset"]
  });
  fgcommand("property-cycle", states);
</syntaxhighlight>
It would seem that the props.node hash uses the name of the XML tags as strings for keys, and that multiple values have to be a vector.  It literally took several hours to first trying to find any docs on what <code>props.Node.new()</code> would expect, and then after giving up since I could not make heads or tails about <code>$FGDATA/Nasal/props.nas</code>, go for trial and error with the [[Nasal Console|Nasal console]] in spite of the sparse debugging output.
A bit frustrating. :-\
—[[User:Johan G|Johan G]] ([[User_talk:Johan_G|Talk]] | [[Special:Contributions/Johan_G|contribs]]) 18:48, 8 January 2015 (UTC)

Latest revision as of 18:48, 8 January 2015

How do <command>property-set</command> and <command>property-assign</command> (used in the CDU) differ? --Hcc23 22:55, 1 December 2010 (UTC)




Hi Hcc23,

welcome on board :-)

Even if you should not subscribe to the developers mailing list, make sure to still check out the forums - let us know if you have any questions. --Hooray 23:42, 1 December 2010 (UTC)

Out of date?

Hi Hooray,

Could you indicate wich part is out of date? Not complete is something different than out of date. As far as I'm aware the content of the article is mostly/completely correct.

Gijs 15:11, 29 May 2013 (UTC)

incomplete and thus not up-to-date --Hooray 15:21, 29 May 2013 (UTC)
Still there's a big difference between the two (when considering the template text), so I've created a special {{incomplete}} template. This should also help wiki contributors see where their help is most needed (out dated/faulty documentation is worse than no documentation) ;-)
Gijs 15:50, 29 May 2013 (UTC)
Yes, thanks - we had quite an editing war there, lots of conflicts because I was doing the same thing. I have reverted my changes now, are you going to add an optional argument to the template?--Hooray 15:51, 29 May 2013 (UTC)

This could be more generic

I note that the commands can be used both when defining bindings in xml files and when programming in nasal, so why not make this more generic and just list the commands and the named parameters and then have a section in the beginning (or maybe the end) with examples on how to use commands both for bindings and in Nasal?

I volunteer to do that, though I might need some help with one or two small Nasal snippets.

In addition it might be a good idea to add most if not all bindings in flightgear/src/Main/fg_commands.cxx. (I am very grateful for the commented code there.)

Finally, can the commands be used for more things in XML files than bindings?

Johan G (Talk | contribs) 18:22, 26 August 2014 (UTC)

fgcommand() Nasal bindings

I had a lot of trouble getting property-cycle to work, so here is some working code:

  var states = props.Node.new ({
    "property": "/instrumentation/clock/chronograph-state",
    "value": ["running", "stopped", "reset"]
  });

  fgcommand("property-cycle", states);

It would seem that the props.node hash uses the name of the XML tags as strings for keys, and that multiple values have to be a vector. It literally took several hours to first trying to find any docs on what props.Node.new() would expect, and then after giving up since I could not make heads or tails about $FGDATA/Nasal/props.nas, go for trial and error with the Nasal console in spite of the sparse debugging output.

A bit frustrating. :-\

Johan G (Talk | contribs) 18:48, 8 January 2015 (UTC)