CtrlCfg.gph : Apply control=config items by code
7 posts
• Page 1 of 1
CtrlCfg.gph : Apply control=config items by code
As the Interactive Configuration supports "One Click Presets" for quite some time now I wanted to be able to reuse the same config item= string format to apply the settings defined in the item by code too.
I am using this technique in my "The Division rev2 Data" preset companion script already and have now created a header file for easier usage.
For a working example download the "CtrlCfg_Example" from the Online Resource.
Usage:
Download the Headerfile "CtrlCfg.gph" from the Online Resource.
Place this file into the same directory where your script file is.
Add this line to your script:
#include "CtrlCfg.gph"
Basic (not complete/non working) example of an Interactive Configuration control=config entry to show the syntax of an item from a config control:
If you want to apply item = All Yes: 0101000A , all you need to do is calling the function like this:
This will apply the settings and reload the scripts slot.
Or you can put all items into a single array and load a specific entry like this:
This will apply the settings and reload the scripts slot.
You can disable the automatic save and reload by adding more arguments to the function call:
For a working example download the "CtrlCfg_Example" from the Online Resource.
For an easy way to create the config=control item strings you can use the IC-Bytetable tool.
For an example go to this post and scroll it a bit down to the section "Example : Create Interactive Configuration : One Click presets"
You can also use the small "bar with arrow" like icon (left one, shows "Copy Configuration" on mouse hover) in the title bar of the "Interactive Configuration" in GTuner IV and remove the leading "GIVICFG:" part.
I am using this technique in my "The Division rev2 Data" preset companion script already and have now created a header file for easier usage.
For a working example download the "CtrlCfg_Example" from the Online Resource.
Usage:
Download the Headerfile "CtrlCfg.gph" from the Online Resource.
Place this file into the same directory where your script file is.
Add this line to your script:
#include "CtrlCfg.gph"
Basic (not complete/non working) example of an Interactive Configuration control=config entry to show the syntax of an item from a config control:
- Code: Select all
/*
[Presets]
shortdesc = "Presets"
control = config
item = All Yes: 0101000A
item = All No: 00000000
item = Yes/No: 0100000A
item = No/Yes: 00010000
item = First Yes: #00:01
item = Second No: #01:00
item = Third Max: #02:2710
*/
If you want to apply item = All Yes: 0101000A , all you need to do is calling the function like this:
- Code: Select all
CtrlCfgSet("0101000A");
This will apply the settings and reload the scripts slot.
Or you can put all items into a single array and load a specific entry like this:
- Code: Select all
char *Presets[] = {
"0101000A", // item = All Yes: // 0
"00000000", // item = All No: // 1
"0100000A", // item = Yes/No: // 2
"00010000", // item = No/Yes: // 3
"#00:01", // item = First Yes: // 4
"#01:00", // item = Second No: // 5
"#02:2710", // item = Third Max: // 6
};
CtrlCfgSet(Presets[1]); // <- this line would be used by your script to load item All No: // 1
This will apply the settings and reload the scripts slot.
You can disable the automatic save and reload by adding more arguments to the function call:
- Code: Select all
CtrlCfgSet("#00:01",TRUE); // this disables pmem_save() and disables scripts slot reload
CtrlCfgSet("#00:01",FALSE,TRUE); // this does pmem_save() but NOT the script reload
For a working example download the "CtrlCfg_Example" from the Online Resource.
For an easy way to create the config=control item strings you can use the IC-Bytetable tool.
For an example go to this post and scroll it a bit down to the section "Example : Create Interactive Configuration : One Click presets"
You can also use the small "bar with arrow" like icon (left one, shows "Copy Configuration" on mouse hover) in the title bar of the "Interactive Configuration" in GTuner IV and remove the leading "GIVICFG:" part.
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: CtrlCfg.gph : Apply control=config items by code
Thank you for your help with my checkbox bit offset. I have been thinking more about the one click and being able to capture you settings. I know that users can drag while holding CTRL to maintain their settings. I was just wondering if here was a way to setup user's ability to have their own configuration without having to modify the code.
For example, the user creates a file with the GIVICFG configuration stored. The script/gamepack would then be able to read that file to get the data for a one click configuration.
Is this even possible or worth the effort?
For example, the user creates a file with the GIVICFG configuration stored. The script/gamepack would then be able to read that file to get the data for a one click configuration.
Is this even possible or worth the effort?
-
UK_Wildcats - Brigadier General
- Posts: 2243
- Joined: Thu Jan 08, 2015 6:53 pm
Re: CtrlCfg.gph : Apply control=config items by code
I don't know of a way to have that included in the script itself.
There is the copy and paste buttons for that. The user can create the configuration and save the string to some different location. When applying the settings to the same script again he can copy it to clipboard and use the paste button to apply them to the script. No coding required for that, just copy&paste.
In GTuner Air you can do that. Save the same script with different settings.
I am missing this option GTuner IV. You have to do the copy paste there or edit the script when it is shared as source.
There is the copy and paste buttons for that. The user can create the configuration and save the string to some different location. When applying the settings to the same script again he can copy it to clipboard and use the paste button to apply them to the script. No coding required for that, just copy&paste.
In GTuner Air you can do that. Save the same script with different settings.
I am missing this option GTuner IV. You have to do the copy paste there or edit the script when it is shared as source.
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: CtrlCfg.gph : Apply control=config items by code
I was thinking that there would be a way to save it to file on the SD card or a memory slot that the script could then read.
-
UK_Wildcats - Brigadier General
- Posts: 2243
- Joined: Thu Jan 08, 2015 6:53 pm
Re: CtrlCfg.gph : Apply control=config items by code
That would be great to save and load some presets from the SD card.
Console tuner since my 1st controller.
Scripting, a game in the game.
Believe or dare, It's Titanic!
Scripting, a game in the game.
Believe or dare, It's Titanic!
-
Prototype - Major General
- Posts: 3252
- Joined: Sun Dec 16, 2012 1:43 pm
Re: CtrlCfg.gph : Apply control=config items by code
prototype wrote:That would be great to save and load some presets from the SD card.
I think we should discuss this all in a new topic.
UK_Wildcats_Fans wrote:..cut...
I was just wondering if here was a way to setup user's ability to have their own configuration without having to modify the code.
For example, the user creates a file with the GIVICFG configuration stored. The script/gamepack would then be able to read that file to get the data for a one click configuration.
One click configuration to use requires GTuner IV or GTuner Air.
Storing different settings for one script is exactly what GTuner Air allows to do in a bit different way. You have to download the same script again, configure and save it with a custom name.
This could be extended with some copy function to avoid having it to download again and edit option to select another input translator file from the online resource (in case of an update of the IT).
GTuner IV does not have this feature at the moment. I would like to see this feature in GTuner IV too.
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: CtrlCfg.gph : Apply control=config items by code
Scachi wrote:prototype wrote:That would be great to save and load some presets from the SD card.
I think we should discuss this all in a new topic.
I'm agree that deserve a dedicated topic...
Scachi wrote:GTuner IV does not have this feature at the moment. I would like to see this feature in GTuner IV too.
...on Github's requests !
Scachi wrote:Storing different settings for one script is exactly what GTuner Air allows to do in a bit different way.
Yes like the copy/paste but by saving the settings to the SD card to reload them
Console tuner since my 1st controller.
Scripting, a game in the game.
Believe or dare, It's Titanic!
Scripting, a game in the game.
Believe or dare, It's Titanic!
-
Prototype - Major General
- Posts: 3252
- Joined: Sun Dec 16, 2012 1:43 pm
7 posts
• Page 1 of 1
Return to User's Script Documentation
Who is online
Users browsing this forum: No registered users and 199 guests