This article covers the following platforms
MSFS 2024
MSFS 2020
ATS
FSX
Prepar3D
settings_define lets users customize settings for your script. Pass it an object that describes each option, as in the example below. Supported setting types are checkbox, text, select, and color.
If your script changes a setting internally, call settings_define(...) again to notify Flow of the change.
this.store = {
script_enabled: true,
intro_message: false,
outro_message: 'hello!',
message_color: '#FF66FFFF',
}
settings_define({
intro_message: {
type: 'checkbox',
label: 'Option 1 label',
value: this.store.intro_message,
description: 'This is a description text (totally optional)',
changed: (value) => {
this.store.intro_message = value;
this.$api.datastore.export(this.store);
// Any code you want to execute when the option is changed
}
},
outro_message: {
type: 'text',
label: 'Option 2 label',
value: this.store.outro_message,
description: 'This is a text box!',
changed: (value) => {
this.store.outro_message = value;
this.$api.datastore.export(this.store);
// Any code you want to execute when the option is changed
}
},
message_color: {
type: 'color',
label: 'Option3 label',
value: this.store.message_color,
description: 'This is a color selector!',
changed: (value) => {
this.store.message_color = value;
this.$api.datastore.export(this.store);
// Any code you want to execute when the option is changed
}
}
})