Talk:Bindings: Difference between revisions

Jump to navigation Jump to search
 
Line 48: Line 48:


—[[User:Johan G|Johan G]] ([[User_talk:Johan_G|Talk]] | [[Special:Contributions/Johan_G|contribs]]) 18:22, 26 August 2014 (UTC)
—[[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)

Navigation menu