Welcome, Guest Thursday 24th April 2014, 04:16:52
   Home   Help Search Login Register  

OFPEC Forum

Author Topic: Useage of preprocessor commands for dynamic path (SOLVED)  (Read 316 times)
0 Members and 1 Guest are viewing this topic.
Terox
Former Staff
****
Offline Offline

Follow the Sappers!


WWW
« 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

Code:
// 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
« Last Edit: 27 Oct 2009, 22:11:47 by Terox » Logged

Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123
i0n0s
Moderator
*****
Offline Offline



« Reply #1 on: 25 Oct 2009, 14:18:35 »

Shouldn't it be:
Code:
_strSHOT = __EVAL(TX_ACTION_CORE + "Sounds\secop_artillery_30.wss");

Otherwise you can create a macro:
Code:
#define TX_ACTION_USER_(X) TX_ACTION_USER##X

sound[] = { TX_ACTION_USER_("\sounds\secop_artillery_30.wss"), db +0, 1.0};
Logged
Terox
Former Staff
****
Offline Offline

Follow the Sappers!


WWW
« Reply #2 on: 25 Oct 2009, 17:42:13 »

I tried both of your example syntax's, neither played the sound, just the beep that ends all radio sound files

Code:
#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
Code:
_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 ??


Logged

Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123
kju
*
Offline Offline



WWW
« Reply #3 on: 26 Oct 2009, 20:24:18 »

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.
Logged

Mandoble
Editors Depot
Administrator
*****
Offline Offline



WWW
« Reply #4 on: 26 Oct 2009, 22:31:03 »

Have you tried this?
Code:
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                  !!!!";
};
Logged

Terox
Former Staff
****
Offline Offline

Follow the Sappers!


WWW
« Reply #5 on: 27 Oct 2009, 22:11:31 »

Quote
      sound[] = { __EVAL(TX_ACTION_CORE + "Sounds\secop_artillery_30.wss"), db +0, 1.0};

Thx Mandoble, that works a treat  Good
Logged

Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123
Pages: [1]   Go Up
  Send this topicPrint  
 
Jump to: