Community Forum

addConfig.lua issue

Forum Overview >> Scripting

CategoryScripting
Created26.01.2019 23:33


Anthony Roark (iwasthere83) 26.01.2019 23:33
Running into issue with " if ConfigurationUtil.configurations[configName] == nil then" in the below text. It doesn't like the word "configurations" in the line. I don't believe configurations is valid anymore. Any direction on where to look to change "ConfigurationUtil.configurations" and to what would be great. Thanks!

while true do
local configKey = "modDesc.newConfigurations.newConfiguration(" .. tostring(configNumber) .. ")";

if not hasXMLProperty(modDesc, configKey) then
break;
end;

local isColorConfig = Utils.getNoNil(getXMLBool(modDesc, configKey .. "#isColorConfig"), false);
local configName = getXMLString(modDesc, configKey .. "#configName");

if configName ~= nil and configName ~= "" then
if ConfigurationUtil.configurations[configName] == nil then
if isColorConfig then
ConfigurationUtil.registerConfigurationType(configName, g_i18n:getText("configuration_" .. configName), nil, Vehicle.getConfigColorSingleItemLoad, Vehicle.getConfigColorPostLoad, ConfigurationUtil.SELECTOR_COLOR); --## config to change color on vehicle
else
ConfigurationUtil.registerConfigurationType(configName, g_i18n:getText("configuration_" .. configName), nil, nil, nil, ConfigurationUtil.SELECTOR_MULTIOPTION); --## config to change parts on vehicle
end;
end;
else
print("ERROR AddConfig.lua: Missing the name for the new Config in '" .. configKey .. "'! Stopping register this config now!");
end;

configNumber = configNumber + 1;
end;

Anthony Roark (iwasthere83) 27.01.2019 05:55
****UPDATE*** addConfig.lua is working mostly now. No errors, I am able to add new designConfig changes but it is NOT updating the "objectChange" for the new designConfig.

Code in question:
ObjectChangeUtil.updateObjectChanges(self.xmlFile, "vehicle." .. configName .. "Configurations." .. configName .. "Configuration", configId, self.components, self);

Kevin I. (Ifkonator2) 27.01.2019 18:57
I'm converting this Script by my self. But that will take a lot of time. I also add new functions. Please wait, until i release a Mod with that Script.

Anthony Roark (iwasthere83) 28.01.2019 00:59
Why not help each other? I just need it add new Configuration types which is working. Its just objectchange line above that isn't working. I am even willing to keep mine private to allow you to release it if you are the original owner. If not you don't have the right to ask me to wait.

Gtx | Andy (GtX_Andy) 28.01.2019 10:58
@Anthony..

You have no right to convert it and release outside of personal use anyway as it is not your script. Not to mention if you need help then you should never release it as you make the original look bad with your errors, And he has said he wants to add new features. ;-)

`Ifkonator` is the author as listed at the top of the script. So wait for him as he has told you. He will not need your help now as he was able to write it without it to start with. Just because it is not out the first 2 months of game does not mean he can not, he just has a life outside of scripting.

If you are not aware scripts are not made with any program like GE and are protected under international creative content laws. Aside from this just show some human respect to the original creator who used their time an talent to do the work and ask first!!!!.

NO Respect these days...

Anthony Roark (iwasthere83) 28.01.2019 15:15
I am more than willing to respect the original author of the mod and by that I mean keep it private as he wishes. I have zero issues keeping it private. So my keyboard warrior friend, chill out. I am simply wishing to gain knowledge, understanding and help. Clearly you need to read my statement above again. Please keep the forums clean of trolling.

Kevin I. (Ifkonator2) 30.01.2019 16:40
I can't help you, because your Problem is not so easy to fix. You need an complete new Function for this. When i release the V1 of my 'Transportpack' you will have the Script.

Also the function:

ConfigurationUtil.registerConfigurationType();

Is no longer valid. This will you don't add an new configuration. The Script need an comlpete rewrite, therefore i cant help you now.. I do my best, do get this so fast as possible done..

Did you know, that you can change the title of an default configuration? Simlpy add ' title="Your_new_title" ' in the 'main' TAG of an Configuration. Example for Design Configuration: (also $l10n_ works!)

<designConfigurations title="Decals">
<designConfiguration name="$l10n_configuration_valueWhite" price="0">
<objectChange node="decalsDoorRight_01" visibilityActive="true" visibilityInactive="false"/>
<objectChange node="decalsDoorLeft_01" visibilityActive="true" visibilityInactive="false"/>
<objectChange node="decalsDoorBack_01" visibilityActive="true" visibilityInactive="false"/>
</designConfiguration>
<designConfiguration name="$l10n_configuration_valueColor" price="0">
<objectChange node="decalsDoorRight_02" visibilityActive="true" visibilityInactive="false"/>
<objectChange node="decalsDoorLeft_02" visibilityActive="true" visibilityInactive="false"/>
<objectChange node="decalsDoorBack_02" visibilityActive="true" visibilityInactive="false"/>
</designConfiguration>
</designConfigurations>

So, you can use default configurations an rename them, util im finish. I think, this make a lot without my Script possible.

Anthony Roark (iwasthere83) 31.01.2019 17:28
Yeah I updated that line. I am able to register tons of new configurations just in f17 but the objectchange doesn't not register the new configurations. I can show you screen shows of them being registered and usable if you want. For the record I am looking forward to your work :)

It just appears that this line doesn't not pick up the new registered config changes:
ObjectChangeUtil.updateObjectChanges(self.xmlFile, "vehicle." .. configName .. "Configurations." .. configName .. "Configuration", configId, self.components, self);

Updated code below:

while true do
local configKey = "modDesc.newConfigurations.newConfiguration(" .. tostring(configNumber) .. ")";

if not hasXMLProperty(modDesc, configKey) then
break;
end;

local isColorConfig = Utils.getNoNil(getXMLBool(modDesc, configKey .. "#isColorConfig"), false);
local configName = getXMLString(modDesc, configKey .. "#configName");

if configName ~= nil and configName ~= "" then
if g_configurationManager.configurations[configName] == nil then
if isColorConfig then
g_configurationManager:addConfigurationType(configName, g_i18n:getText("configuration_" .. configName), nil, Vehicle.getConfigColorSingleItemLoad, Vehicle.getConfigColorPostLoad, ConfigurationManager.SELECTOR_COLOR); --## config to change color on vehicle

printDebug("Register color configuration '" .. configName .."' successfully.", 1, true);
else
g_configurationManager:addConfigurationType(configName, g_i18n:getText("configuration_" .. configName), nil, nil, nil, ConfigurationManager.SELECTOR_MULTIOPTION); --## config to change parts on vehicle

printDebug("Register desing configuration '" .. configName .."' successfully.", 1, true);
end;
end;
else
printError("Missing the name for the new Config in '" .. configKey .. "'! Stopping register this config now!", false, false);
end;

configNumber = configNumber + 1;
end;

Mark Cheshier (mcheshier) 12.06.2021 09:02
I'm having a similar issue. I'm new to modding so please excuse any dumb questions please.

I follow all of the steps to use AddConfig (newConfig) and it shows up in game just fine. However, when I select my options (node true / false) it doesn't change anything no matter what I do.

I have my AddConfig script in place. I've added the "addconfig" specialization, I've added the specialization under the vehicle type, I've added the configuration name" in the l10n options, and I've also got the line in the newConfigurations section. I don't know what I'm doing wrong.

Please help.

Bilbo Beutlin (BBeutlin) 12.06.2021 11:10
Did you ever notice that this thread is over 2 yrs. old?
Meanwhile are several ready-to-use "AddConfig" scripts available in web.

Mark Cheshier (mcheshier) 12.06.2021 16:42
Did you ever notice that I said I'm "new to modding?" Instead of being an ahole maybe you could point me in the right direction.

Bilbo Beutlin (BBeutlin) 12.06.2021 17:30
"new to modding" doesn't excuse "too lazy to search oneself".
Or are you banned from Google? Wouldn't surprised me in view of your vocabulary.
No etiquette - no help.

Mark Cheshier (mcheshier) 12.06.2021 19:42
I've been searching for days but I'm not sure if it's the latest version or not. All I know is it still isn't working and there isn't much on Youtube or documentation about AddConfig scripts. Seriously, if you have enough time to respond with childish trolling then make yourself useful. I hope Giants sees this.

Mark Cheshier (mcheshier) 15.06.2021 02:47
I finally figured out how to do this and what I was doing wrong. I'll put together a tutorial for anyone that's interested. There's not much out there for instructions.

Jake Lamb (JakeLamb) 14.10.2021 19:06
Mark I'm having the same issue as you it is not changing the visibility. What was the solution that you found. I doubt you will see this but if you do thanks for the help in advance

Jake Lamb (JakeLamb) 15.10.2021 23:41
Anyone found any other alternatives

Matt Lagasse (Reaper9488) 23.10.2021 07:32
Okay so I got my Addconfig.Lua working. And by that I mean the options I added show up ingame. The problem I am having is that once those changes are applied to the mod and I save the game. When I return to the savegame all the Addconfig options are no longer showing. They are showing as enabled in the Store options but not visually on the vehicle anymore. what did I do wrong?


Note: Log in to post. Create a new account here.