In fact, the only time a is needed is when a non-repeatable button starts an ongoing process, and we want to stop that process when we release the button. It does no harm, just wastes time, albeit very little time. Xml files are full of such code, which is totally, unnecessary. I have been having a good look at the controls.nas file that comes with FG. This lets the interpreter know that you haven't finished yet. Note that all lines except the last have a at the end. If your code has more than one command, then do this Not all actions need a section, but you will soon get the hang of what does and what doesn't. Just use the correct button number, give the correct, decide repeatable or non-repeatable, and then type the correct code in place of Your code goes here and Code for what happens when the button is released goes here. You can use this shell for all your buttons. To make a button repeatable, replace false with true. Code for what happens when the button is released goes here The shell of a button definition looks lke this So when you decide on the use for joystick buttons, you decide which will be repeatable and which not. Setting a button to repeatable or non-repeatable is part of the basic definition of the button (like its number), it cannot be changed willy-nilly. When we have the view we want, we release the button, and zooming stops.Īn important point to remeber is that if a button is repeatable, even if you just give it the briefest of touches, the instruction will be carried out a few times, thanks to the repeat-rate of the system. We press the button, and the view keeps zooming in. With repeatable buttons, when we hold the button in, the same action is carried out over and over, until we release the button. An example of its use would be a button to lower the landing-gear. With non-repeatable buttons, when we push it, a single action is carried out, and nothing else happens. There are two categories of buttons, repeatable and non-repeatable. There is almost no end to what we can do with buttons, limited usually by the number of buttons on the joystick, what we need, and what we can remember of the allocation of button actions. The actual "instruction" is between the and tags. Here, the "instructions" we give are in the Nasal language, so we have This is the code for the throttle control, for the others, just replace throttleAxis with propellerAxis, mixtureAxis or carbHeatAxis. These do not have optional settings, after all you want a smooth linear response. Throttle, propeller-pitch, mixture and carburetor-heat. Don't forget to change the the name between and. As you move them to their extreme positions, their value gradually increases (decreases) to +1.0 or -1.0, depending on the direction of movement.Īnd not faster in any way, therefore I prefer using power since it's then easier to change the value if needed.įor aileron and rudder you replace >/controls/flight/elevator with /controls/flight/aileron and /controls/flight/rudder. For a start, all three these axes have a center-zero action. The optional lines need quite a bit of explanation. All the other lines are for the benefit of FG. The other lines are compulsory.Įlevator let's us know that this axis controls the elevator. Not necessary to specify the button number again, as you can't use inside another section.Īxes are the controls on a joystick which con be moved over a whole arc of operation.Įven though the hat hat-switch is classed as an axis, for the purpose of writing code for it, it is a set of buttons. Lines 9 to 13: Same as above, except that it refers to what happens when the button is released. The up part co9mes from the idea of pushing a button down, and it moves up when you take your finger off it. Line 8: (Modification up.) This is the start of the section to handle what happens when the button is released. Line 7: The end of what happens when the button is pressed. Here there is only one command, but there can be many. The text between and are the nasal commands to be performed. Line 5: nasal means that the following line(s) is(are) written in the programming language nasal. Notice that there can be a few lines before the tag. Line 4: This is the start of the code which defines what happens when the button is pressed. If repeatable is false, the button action is one-shot, and won't execute again until the button is released and pressed again. Line 3: true means that as long as the button is held in the following action will be executed. Line 2: A (short) description of what the button does. Line 1: specifies that this is the code for a button, and the n="4" means that this is the code for the button which your system reports as number 4. Ignoring the actual meaning of the code, let's got through it line by line.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |