C: FX driver using aircraft.cfg smoke entries
From FSDeveloper Wiki
There are 99 available [smoke] entries available in the aircraft.cfg file and they don't have to be smoke-style fx; they can be any type of fx you like. One of the more common usages is to drive fx that are being used for aircraft lighting. The following function is a simple method of having a one-line fx driver:
void setFX(bool action, int number) { // Assign a character string char fx_number[20]; // Ensure the string is clean memset(fx_number,0,20); // Set the fx to 'on' if (action == true) { sprintf_s(fx_number, 20, "%d (>K:SMOKE_ON)", number); execute_calculator_code(fx_number, NULL, NULL, NULL); } // Set the fx to 'off' if (action == false) { sprintf_s(fx_number, 20, "%d (>K:SMOKE_OFF)", number); execute_calculator_code(fx_number, NULL, NULL, NULL); } return; }
In you code you call it by
setFX(true, 14)
where 'action' is true (on) or false (off) and the number is the corresponding entry in the aircraft.cfg file. To make your code easier to read you can assign a description to the fx number e.g.
const int landing_lights = 14;
so the call then becomes
setFX(true, landing_lights) // Landing lights on