Comrades in Arms Discussion Board

Full Version: Reading userconfig or other file location from within mission
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey guys, hope you are all keeping well.

I have been trying to find a way to read (not write) a file from a mission outside of the mission folder.

I have seen in Arma2 you could use a global script folder and when performing and execVM call, it will check your mission route, then the arma2/scripts folder.

Just wanted to know if there was any way of doing something like this in Arma 3?

Doesnt have to be a script,  Im trying to allow players to upload a config file, my mission will read this file and set the load out and some mission objects based on this config file.  (calling a script file or a cfg or txt will all be able to work, just need to know if it is possible to access a file outside of the mission).

or, if not, any other work around options?

I currently just let them copy and paste the details into a large multi line textbox and save it once in the profileNamespace (but the content has the chance of being quite large and I dont want to keep appending to the profileNamespace)

Thank you

Treendy
I don't think that is possible anymore, for security reasons.
Alwarren Wrote:I don't think that is possible anymore, for security reasons.

ok, that may explain why i havent been able to find anything.  Its a shame, was hoping to read from the userconfig folder, never mind : (

Instead, i will read a config file from within the mission folder, at least that way someone can create the config file, add it to the pbo and upload it (just means, if anyone uploads an update of the mission, they will need to remember the config file)

... or, I seem to remember we can call a webservice (or just read a url content), maybe i could allow a url then read any config from that

I will have a think, but im thinking the url option may be the best solution

Thanks for getting back though : )
It depends on what you want to do, really. For my missions, I have configuration data stored via CBA (which, obviously, becomes a requirement then). It allows people to set the view range for my missions on a per-map basis:

in description.ext:
Code:
class Extended_PreInit_EventHandlers {
FHQMission = "call compile preprocessFileLineNumbers ""scripts\XEH_preinit.sqf"";";
};

then in scripts\XEH_preinit.sqf:
Code:
_settingName = "FHQ_ViewDistance_" + worldName;

[
_settingName,
"SLIDER",
worldName + " View Distance",
"FHQ Mission Settings",
[200, 8000, viewDistance, 0],
nil,
{
params ["_value"];
setViewDistance _value;
}
] call CBA_Settings_fnc_init;

_settingName = "FHQ_ObjectViewDistance_" + worldName;

[
_settingName,
"SLIDER",
worldName + " Object View Distance",
"FHQ Mission Settings",
[200, 8000, getObjectViewDistance select 0, 0],
nil,
{
params ["_value"];
setObjectViewDistance _value;
}
] call CBA_Settings_fnc_init;

_settingName = "FHQ_ShadowViewDistance_" + worldName;

[
_settingName,
"SLIDER",
worldName + " Shadow View Distance",
"FHQ Mission Settings",
[10, 200, getObjectViewDistance select 1, 0],
nil,
{
params ["_value"];
setObjectViewDistance [getObjectViewDistance select 0, _value];
}
] call CBA_Settings_fnc_init;
Note that my _settingNames are generic, i.e. they will be available in every mission that uses this XEH. If you name them mission-specific, you can have mission-specific settings. The variable named e.g. FHQ_ShadowViewDistance_Altis will become a global variable in your mission.
As I said, it depends on what exactly you want to do with the userconfig/settings file.
Thanks, not sure that will do the job (unless someone can edit these values?) (I am guessing the "scripts" folder you mention is within your mission folder)

Im looking at doing the following (I have a few work arounds, but idealy would be nice if they can just upload a file)

So... a group CiA for example, may have specific requirements for your teams loadouts... uniform, weapons, ammo, eqipement etc...

I will be allowing to upload a config file, my mission will read this, and adjust the teams loadout to what the config file has been set to

e.g.
[Loadout1,[
   ["Teamleader","U_B_CombatUniform_mcam", "LMG_Mk200_F", BackpackClassName, BackPackContent etc....]
   ["Rifleman","U_B_CombatUniform_mcam", "LMG_Mk200_F", BackpackClassName, BackPackContent etc....]
  ]
[Loadout2, [
   ["Teamleader","U_B_CombatUniform_mcam", "LMG_Mk200_F", BackpackClassName, BackPackContent etc....]
   ["Rifleman","U_B_CombatUniform_mcam", "LMG_Mk200_F", BackpackClassName, BackPackContent etc....]
  ]
]


So my mission will read this, allow them to pick from a drop down box "Loadout 1 or Loadout 2", then load the mission with the selected items applied to the units
The values can be edited. In this case, every user can, but you can make them editable by the admin only as well. 

But sadly, you require more than this system can offer.