Jump to content
Sign in to follow this  
riouken

getarray not able to pull array.

Recommended Posts

I am trying to pull an array from the userconfig folder, but it just seems to be pulling back an empty array,I am not getting any errors though. Here is what I have so far.

userconfig:

//// RSLO: Riouken's Selectable Load Outs
// 
// Created by: Oliver 15thMEU(SOC)
//

// Load out 1

RSLO_lo1_weapons_user = ["ACE_M249Para_M145"];
RSLO_lo1_ammo_user = ["ACE_200Rnd_556x45_T_M249","ACE_200Rnd_556x45_T_M249","ACE_200Rnd_556x45_T_M249","ACE_200Rnd_556x45_T_M249"];

// Load out 2

RSLO_lo2_weapons_user = [];
RSLO_lo2_ammo_user = [];

// Load out 3

RSLO_lo3_weapons_user = [];
RSLO_lo3_ammo_user = [];

here is the addon config :

// RSLO

class CfgPatches
{
class RSLO
	{
		units[] = { };
		weapons[] = { };
		requiredVersion = QUOTE(REQUIRED_VERSION);
		requiredAddons[] = { };
		version = 1.00;
		versionStr = QUOTE(VERSION);
		versionAr[] = {VERSION_AR};
		author[] = {"Oliver 15thMEU(SOC)"};
	};
};

class Extended_Init_EventHandlers
{
class All
{
	RSLO_Init = "if (isNil ""RSLO_Init_Var"") then {RSLO_Init_Var = [] execVM ""\RSLO\init.sqf"";};";
};
};

class RSLO_USER_LOADOUTS
{
#include "\userconfig\RSLO\RSLO.hpp"
};

and here is the init for the addon:

//// RSLO: Riouken's Selectable Load Outs
// 
// Created by: Oliver 15thMEU(SOC)
//

waitUntil { !isNull(findDisplay 46); };

sleep 0.1;

_RSLO_lo1_weapons = getArray (configFile >> "RSLO_USER_LOADOUTS" >> "RSLO_lo1_weapons_user");
_RSLO_lo1_ammo = getArray (configFile >> "RSLO_USER_LOADOUTS" >> "RSLO_lo1_ammo_user");
_RSLO_lo2_weapons = getArray (configFile >> "RSLO_USER_LOADOUTS" >> "RSLO_lo2_weapons_user");
_RSLO_lo2_ammo = getArray (configFile >> "RSLO_USER_LOADOUTS" >> "RSLO_lo2_ammo_user");
_RSLO_lo3_weapons = getArray (configFile>> "RSLO_USER_LOADOUTS" >> "RSLO_lo3_weapons_user");
_RSLO_lo3_ammo = getArray (configFile >> "RSLO_USER_LOADOUTS" >> "RSLO_lo3_ammo_user");

waitUntil { !isNull player };

sleep 3;

hint format["%1",_RSLO_lo1_weapons];

the hint just gives me a "[]"

any idea what im doing wrong?

Share this post


Link to post
Share on other sites

In your current implementation your arrays are problably interpreted as strings. (Try getText to confirm)

Config arrays are defined as:

property[] = {entry1, entry2, {entry1, entry2} };

Userconfig stuff to fetch user configuration is rather deprecated though due to injection/security issues, while it is also error prone.

At ACE mod we phased it out completely except for changes to the config that really can only be accomplished through this method, while we've put measures in place that limit security risks.

Instead we are using loadFile "\userconfig\ace\somefile", and parse the string manually.

Edited by Sickboy

Share this post


Link to post
Share on other sites

Thanks for all the info Sickboy, I will test this out and see what I can get working.

----------------------------------------------------

Off topic but I am loving the new six updater, thanks for all the work on it and ACE 2.

------------------------------------------------------------------------------

Update, That was exactly the problem Sickboy! thanks for the help, I have it working now!, I'm going to start doing some testing now and if I run into problems I may have to rewrite with your ideas from ACE 2.

Edited by Riouken
Update

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×