OFPEC Forum
Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: Terox on 25 Oct 2009, 13:58:20
-
I would like to dynamically apply a path in a Description.EXT class attributes having defined that path in a #define statement in the Description.ext. structure
Specifically I need to be able to apply a variable as part of a string path for cfgRadio sounds
I have tried various configurations of __EXEC and __EVAL statements, but all to no avail
Example
_strSHOT = __EVAL("(TX_ACTION_CORE) + 'Sounds\secop_artillery_30.wss'" );
sound[] = {_strSHOT, db +0, 1.0};
Here is a cut down code example as it stands now
// DESCRIPTION.EXT
#define TX_ACTION_CORE "Tx_Actions\"
#define TX_ACTION_USER "Tx_UserSetup\"
class Tx_Actions
{
Path_SetupFolder = TX_ACTION_USER; // Used to get a dynamic path for scripts
Path_CoreFolder = TX_ACTION_CORE; // Used to get a dynamic path for scripts
// class Tx_Arty
// {
// Irrelevant code
// };
};
class Cfgradio
{
sounds[] =
{
Tx_arty_shot,
};
class Tx_arty_shot
{
name = "Tx_arty_shot";
sound[] = { "Tx_actions\sounds\secop_artillery_30.wss", db +0, 1.0};
title = " << ARTY >> Shot !!!!";
};
};
So I would be greatly appreciative if someone could supply me with a working example of how best to do this...
Thanks in advance
-
Shouldn't it be:
_strSHOT = __EVAL(TX_ACTION_CORE + "Sounds\secop_artillery_30.wss");
Otherwise you can create a macro:
#define TX_ACTION_USER_(X) TX_ACTION_USER##X
sound[] = { TX_ACTION_USER_("\sounds\secop_artillery_30.wss"), db +0, 1.0};
-
I tried both of your example syntax's, neither played the sound, just the beep that ends all radio sound files
#define TX_ACTION_CORE "Tx_Actions\"
#define TX_ACTION_USER "Tx_UserSetup\"
#define TX_ACTION_DESC_(X) TX_ACTION_CORE##X
class Tx_arty_shot
{
name = "Tx_arty_shot";
sound[] = { TX_ACTION_DESC_("sounds\secop_artillery_30.wss"), db +0, 1.0};
// sound[] = {"Tx_Actions\sounds\secop_artillery_30.wss", db +0, 1.0};
title = " << ARTY >> Shot !!!!";
};
and
_strSHOT = __EVAL(TX_ACTION_CORE + "Sounds\secop_artillery_30.wss");
class Tx_arty_shot
{
name = "Tx_arty_shot";
sound[] = { _strSHOT , db +0, 1.0};
// sound[] = {"Tx_Actions\sounds\secop_artillery_30.wss", db +0, 1.0};
title = " << ARTY >> Shot !!!!";
};
Any more suggestions ??
-
Without it you can hear the sound?
I suggest you to try to play with the macro, define, EVAL in a situation
you can easily verify that it works or brakes. Aka to see the result
and see errors in the rpt.
-
Have you tried this?
class Tx_arty_shot
{
name = "Tx_arty_shot";
sound[] = { __EVAL(TX_ACTION_CORE + "Sounds\secop_artillery_30.wss"), db +0, 1.0};
// sound[] = { __EVAL(str TX_ACTION_CORE + "Sounds\secop_artillery_30.wss"), db +0, 1.0};
title = " << ARTY >> Shot !!!!";
};
-
sound[] = { __EVAL(TX_ACTION_CORE + "Sounds\secop_artillery_30.wss"), db +0, 1.0};
Thx Mandoble, that works a treat :good: