eagle monart wrote:
> i am tryng to add a delay in seconds before activation/
> deactivation of cockpit functions. my aim is to declare
> specific drag according to time within component cycle time. i
> am trying to add an example decleration for that purpose....but
> function goes toooooooooo..........infinite!!!  or totaly
> frezes sim .

Well, first, we seem to be talking about different things.  I
thought the question was about how to use settimer() in a Nasal
script, whereas these are modifications to the C code in LaRCsim.

Second, as a more general suggestion: please get your whitespace under
control.  Different programmers have different ideas about where
braces go, how many spaces to use for indentations, whether tabs are
legal, whether whitespace should be used around parentheses,
etc...  But no one should be forced to read stuff like you posted.  I
honestly had to read through your (non-code) text several times just
to be sure it wasn't a joke. :)

Third, the clock() function you are calling is not what you think it
is.  It does not "wall clock" time, but CPU time used by your current
process.  These aren't likely to be well synchronized.

And finally, trying to wait like this is never going to work well.
FlightGear has a main loop that it needs to execute every frame.  When
you block waiting on something to happen, you are blocking the entire
simulator.  The proper way to implement this kind of feature is to
"poll" for changes every frame, and set some kind of "state" to know
what to do each update.

Honestly, my suggestion is to leave the C/C++ code alone, study the
existing aircraft to learn how they are configured using XML and
Nasal, and try to implement your feature at that level.


Flightgear-devel mailing list

Reply via email to