Knob XP scripting
-
- Posts: 581
- Joined: Mon Sep 07, 2020 8:49 am
Re: Knob XP scripting
Something else I dont understand...
I created a completely new mode / script in the same modes folder, gave it a unique name and change the title at the top of the script.
To make sure all is starting from scratch, I quit out of Xplane and restarted.
After loading up the plugins settings menu, I do not see that new mode in the list.
That is making me think the KnobXP plugin is still running the very first scripts and nothing is changing.
It seems to me the Knobster is not reading the new / revised scripts.... but I cannot discern that for sure."
So why doesnt that new mode show in the settings list?
I created a completely new mode / script in the same modes folder, gave it a unique name and change the title at the top of the script.
To make sure all is starting from scratch, I quit out of Xplane and restarted.
After loading up the plugins settings menu, I do not see that new mode in the list.
That is making me think the KnobXP plugin is still running the very first scripts and nothing is changing.
It seems to me the Knobster is not reading the new / revised scripts.... but I cannot discern that for sure."
So why doesnt that new mode show in the settings list?
-
- Posts: 5346
- Joined: Thu Jul 27, 2017 12:22 am
Re: Knob XP scripting
I'm on it, I will try to clarifyKaellis991 wrote: ↑Mon Sep 05, 2022 8:24 pm Something else I dont understand...
I created a completely new mode / script in the same modes folder, gave it a unique name and change the title at the top of the script.
To make sure all is starting from scratch, I quit out of Xplane and restarted.
After loading up the plugins settings menu, I do not see that new mode in the list.
That is making me think the KnobXP plugin is still running the very first scripts and nothing is changing.
It seems to me the Knobster is not reading the new / revised scripts.... but I cannot discern that for sure."
So why doesnt that new mode show in the settings list?
Indeed things have to be clarified, with an example from scratch added to the WIKI (@Ralph, just for memo)
-
- Posts: 5346
- Joined: Thu Jul 27, 2017 12:22 am
Re: Knob XP scripting
Well, I have set it up, so the ACTIVE NAV2 Frequency is running using the Knobster in a Thranda aircraft bringing a basic radio/nav
I've created a NAV2_THRD.json file with this in it :
Edited default.json file to add the related line, notice NAV2_FREQ is deleted :
So on Flight start with the JustFlight PA28 Arrow III, it creates the PA28 Arrow.json file (delete it if already existing, to start from scratch), with the part below in it, notice NAV2_FREQ is present, but disabled :
I've created a NAV2_THRD.json file with this in it :
Code: Select all
{
"name": "NAV2 frequency Thranda",
"minor_cw_cmd": "sim/radios/actv_nav2_fine_up",
"minor_ccw_cmd": "sim/radios/actv_nav2_fine_down",
"major_cw_cmd": "sim/radios/actv_nav2_coarse_up",
"major_ccw_cmd": "sim/radios/actv_nav2_coarse_down",
"button_released_cmd": "sim/radios/nav2_standy_flip",
"order": 304000
}
Code: Select all
}, {
"name": "NAV1_FREQ",
"enabled": true
}, {
"name": "NAV1_OBS",
"enabled": false
}, {
"name": "NAV2_THRD",
"enabled": true
}, {
"name": "NAV2_OBS",
"enabled": false
}, {
"name": "SPEEDBRAKE",
"enabled": false
}, {
Code: Select all
}, {
"name": "NAV1_FREQ",
"enabled": true,
"order": 303000
}, {
"name": "NAV2_FREQ",
"enabled": false,
"order": 304000
}, {
"name": "NAV2_THRD",
"enabled": true,
"order": 304000
}, {
"name": "ADF1_FREQ",
"enabled": false,
"order": 305000
Last edited by SimPassion on Mon Sep 05, 2022 8:54 pm, edited 1 time in total.
-
- Posts: 5346
- Joined: Thu Jul 27, 2017 12:22 am
Re: Knob XP scripting
It works, however, we still have to share with @Ralph, @russ and @Corjan, as there's some condition which trigger X-Plane CTDs while using KnobXP with improper configuration files
-
- Posts: 581
- Joined: Mon Sep 07, 2020 8:49 am
Re: Knob XP scripting
So what wasnt clear to me was that the PA28 Arrow.json file is where xplane / Knobster is reading from to populate the settings list.
Whenever, a new mode is created, there also have to be some code added to the aircraft.json file to make the connection to the appropriate new mode.
I had the right coding in the new mode I created, but I didnt understand how to remove the current codes and replace it with the new ones.
It's working now.
Thanks
Whenever, a new mode is created, there also have to be some code added to the aircraft.json file to make the connection to the appropriate new mode.
I had the right coding in the new mode I created, but I didnt understand how to remove the current codes and replace it with the new ones.
It's working now.
Thanks
-
- Posts: 5346
- Joined: Thu Jul 27, 2017 12:22 am
Re: Knob XP scripting
The default.json is the initial from which KnobXP is reading and the X-Plane / Plugins / KnobXP / Settings is allowing the selection for inclusion in the current aircraftKaellis991 wrote: ↑Mon Sep 05, 2022 9:09 pm So what wasnt clear to me was that the PA28 Arrow.json file is where xplane / Knobster is reading from to populate the settings list.
Whenever, a new mode is created, there also have to be some code added to the aircraft.json file to make the connection to the appropriate new mode.
I had the right coding in the new mode I created, but I didnt understand how to remove the current codes and replace it with the new ones.
It's working now.
Thanks
[EDIT] Just also added NAV2 Freq to the list by enabled it :
-
- Posts: 581
- Joined: Mon Sep 07, 2020 8:49 am
Re: Knob XP scripting
So that's the procedure...
1. Create the New mode in modes folder with the appropriate dataref / commands
2. Delete specific [aircraft].json file
3. Add the code for the new mode in the default.json file
4. Restart Xplane....and a new specific [aircraft].json file will be created
Now I can add Com2 to my Knobster
1. Create the New mode in modes folder with the appropriate dataref / commands
2. Delete specific [aircraft].json file
3. Add the code for the new mode in the default.json file
4. Restart Xplane....and a new specific [aircraft].json file will be created
Now I can add Com2 to my Knobster
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Knob XP scripting
Hi,
Loading a .json is simply loading a table. You can have many different tables and call any table at any time.
You need to note that .json files need to be available at runtime. They do not have to be loaded at runtime. Only when called. Always check if any table or .json has a value.
A table can be created within code and used to "OVERWRITE" the static_data_load() data.
For this you will need to understand the LUA table functions.
Keith
Loading a .json is simply loading a table. You can have many different tables and call any table at any time.
You need to note that .json files need to be available at runtime. They do not have to be loaded at runtime. Only when called. Always check if any table or .json has a value.
A table can be created within code and used to "OVERWRITE" the static_data_load() data.
For this you will need to understand the LUA table functions.
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card
-
- Posts: 581
- Joined: Mon Sep 07, 2020 8:49 am
Re: Knob XP scripting
Lua is still a challenge. My simplistic outline is about as good as my understanding gets right now...Keith Baxter wrote: ↑Mon Sep 05, 2022 9:36 pm Hi,
Loading a .json is simply loading a table. You can have many different tables and call any table at any time.
You need to note that .json files need to be available at runtime. They do not have to be loaded at runtime. Only when called. Always check if any table or .json has a value.
A table can be created within code and used to "OVERWRITE" the static_data_load() data.
For this you will need to understand the LUA table functions.
Keith
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Knob XP scripting
Hi
Lua is not that complex when you start to understand.
Lets do a simple table. my_table = {"Jack", "Fred", Jane"}
If this was a .json, then after the static_data_load(), my_table would = {"Jack", "Fred", Jane"}
Now lets change the value of the 2nd index "Fred" to "Tom"
my_table = {"Jack", "Tom", Jane"}
If we call ....print(my_table[2]) we would receive a print value of Tom.
This would not change the value in the .json. Only the value in the loaded table my_table()
Keith
Lua is not that complex when you start to understand.
Lets do a simple table. my_table = {"Jack", "Fred", Jane"}
If this was a .json, then after the static_data_load(), my_table would = {"Jack", "Fred", Jane"}
Now lets change the value of the 2nd index "Fred" to "Tom"
my_table = {"Jack", "Tom", Jane"}
If we call ....print(my_table[2]) we would receive a print value of Tom.
This would not change the value in the .json. Only the value in the loaded table my_table()
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card