Board index FlightGear Development New features

Suggestion to make the newbies happy

Discussion and requests for new features. Please note that FlightGear developers are volunteers and may or may not be able to consider these requests.

Suggestion to make the newbies happy

Postby aristide » Wed Aug 28, 2013 8:09 pm

Hi,
The first step afer the installation is to select a plane and learn how it works.
The ideal tools are the tutorials you can select in the Help menu.
Unfortunately, it is not so easy. The flow of the messages can't be controlled, and afer a few time, you are lost.
The "p" key wich pauses FG doesn't work.

Would it be possible to extend the the use of the "p" key to pause the tutorial or get another key to pause the tutorial ?
aristide
 
Posts: 2
Joined: Wed Aug 28, 2013 8:01 pm

Re: Suggestion to make the newbies happy

Postby Hooray » Wed Aug 28, 2013 8:31 pm

Hi & welcome,

thanks for taking the time to provide feedback - to get back to your question: yes, ANYTHING is possible in FlightGear - and the tutorial system in particular is rather simple, it is entirely scripted using FlightGear's built-in scripting language, called "Nasal" - it can be easily modified/extended to add features like the one you are describing, see:

http://wiki.flightgear.org/Tutorials
http://wiki.flightgear.org/Nasal

So,all you'd need to do, is to modify the code, register a listener via setlistener() (use the freeze property) and then pause the tutorial: http://wiki.flightgear.org/Using_listen ... ener.28.29

For starters, you can use the property browser and play with the /sim/freeze properties
http://wiki.flightgear.org/Property_Browser
Image

Next, you'll want to use the Nasal console, to achieve the same thing, just paste this code:

Code: Select all
var freeze = "/sim/freeze";
setprop(freeze, 1);


http://wiki.flightgear.org/Nasal_Console
Image

To register a listener, use this snippet:
Code: Select all
var freeze = "/sim/freeze";
var freeze_changed = func {
 print("Pause/Unpause !");
}
setlistener(freeze, freeze_changed);


As you can see, it's just 3 lines of code
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: 11475
Joined: Tue Mar 25, 2008 8:40 am

Re: Suggestion to make the newbies happy

Postby F-JJTH » Wed Aug 28, 2013 9:21 pm

Hi,

@Hooray, I think aristide is asking for "How can I control how many time will be displayed tutorials messages?"
Currently, tutorials messages are displayed via /sim/messages/copilot property. Each time this property receive a new value (a new message) the value (the message) is displayed during 5 seconds. here, aristide want to control these 5 seconds to change it to 10, 15 or maybe 20 seconds.

If you know how to extend the delay between the message appears then disappears of the screen it will help arisitide ;)

Regards,
Clément
User avatar
F-JJTH
 
Posts: 697
Joined: Fri Sep 09, 2011 11:02 am

Re: Suggestion to make the newbies happy

Postby Hooray » Wed Aug 28, 2013 9:50 pm

it's the same thing basically - but you can also just as well change the default to a longer interval, it's all in $FG_ROOT/Nasal/gui.nas (tooltip / popup).
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: 11475
Joined: Tue Mar 25, 2008 8:40 am

Re: Suggestion to make the newbies happy

Postby F-JJTH » Wed Aug 28, 2013 10:40 pm

@aristide: this is the solution to your request

First solution (permanent):
Edit the file fgdata/Nasal/screen.nas at line 418 replace the last argument by the delay (in seconds) you want, example
Code: Select all
log = window.new(nil, -30, 10, 20); # Messages are displayed during 20 seconds
log = window.new(nil, -30, 10, 30); # Messages are displayed during 30 seconds
log = window.new(nil, -30, 10, 40); # Messages are displayed during 40 seconds


Second solution (only for current session):
Run FG then open the Nasal console (Debug > Nasal console) then enter this: (as above, the last argument is the delay in seconds)
Code: Select all
screen.log = screen.window.new(nil, -30, 10, 50);

Then press "Execute"
In this example messages will be displayed during 50 seconds
Now you can run your tutorial and each messages will be displayed during 50 seconds

Regards,
Clément
User avatar
F-JJTH
 
Posts: 697
Joined: Fri Sep 09, 2011 11:02 am

Re: Suggestion to make the newbies happy

Postby Hooray » Wed Aug 28, 2013 11:48 pm

Ya, that will work, but it's a hack, and not necessary to use a hack here - after all, there's a reason I provided so many explicit pointers, specifically to tutorial.nas: http://gitorious.org/fg/fgdata/source/a ... torial.nas

If you want to override screen.log(), please just do it at the scope of the tutorial.nas file, and not globally - you can just add your own screen.log function to the top of the file, but you MUST use th e var keyword when doing so.

That being said, it would be much cleaner to just patch/fix the corresponding line in tutorial.nas instead of overriding the whole screen.log() function: http://gitorious.org/fg/fgdata/source/a ... l.nas#L411

I suggest to introduce a tutorial_delay variable here, and make it property-configurable through either getprop() or a listener, so that it can be easily customized at runtime, and made persistent usiing the userarchive attribute.

Having a dedicated configuration dialog just for the tutorial system would sound like a good idea, and in the meantime, having a bunch of config properties should work, too.

But please don't override APIs in a system-wide fashion - or it will cause issues later on.

Finally, modifying screen.nas to allow messages to be optionally paused (as explained above) would seem like another straightforward option that should also come in handy.
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: 11475
Joined: Tue Mar 25, 2008 8:40 am

Re: Suggestion to make the newbies happy

Postby Philosopher » Wed Aug 28, 2013 11:52 pm

Well I do know that 'p' pauses going on in the tutorial, but it doesn't otherwise suspend the message display. I suspect it's an issue of the last argument to settimer() (real time versus sim time), but I sometimes like being able to pause and have the messages disappear (for screenshots).

But adding getprops/menu options for timing would also work.
Thanks,
Philosopher
(inactive but lurking occasionally...)
Philosopher
 
Posts: 1590
Joined: Sun Aug 12, 2012 6:29 pm
Location: Stuck in my head...
Callsign: AFTI
Version: Git
OS: Mac OS X 10.7.5

Re: Suggestion to make the newbies happy

Postby aristide » Thu Aug 29, 2013 8:08 am

Thank you to all of you,
To take care of a true newbie troubles and concerns.

Horray, I agree with you to patch tutorial.nas file only, as to get the patch local to the tutorials.This is obviouly an interin solution.

You may undestand I have no knowledge of Nasal.
The line you specifed here :
That being said, it would be much cleaner to just patch/fix the corresponding line in tutorial.nas instead of overriding the whole screen.log() function: http://gitorious.org/fg/fgdata/source/a ... l.nas#L411


is : screen.log.write(msg, 1, 1, 1)

Would you please tell me what it should be written to get the message shown during a given time.
Best regards.
aristide
 
Posts: 2
Joined: Wed Aug 28, 2013 8:01 pm


Return to New features

Who is online

Users browsing this forum: No registered users and 2 guests