Home   Help Search Login Register  

Author Topic: Useage of preprocessor commands for dynamic path (SOLVED)  (Read 2724 times)

0 Members and 1 Guest are viewing this topic.

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
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: [Select]
// 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 »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline i0n0s

  • Moderator
  • *****
Re: Useage of preprocessor commands for dynamic path
« Reply #1 on: 25 Oct 2009, 14:18:35 »
Shouldn't it be:
Code: [Select]
_strSHOT = __EVAL(TX_ACTION_CORE + "Sounds\secop_artillery_30.wss");
Otherwise you can create a macro:
Code: [Select]
#define TX_ACTION_USER_(X) TX_ACTION_USER##X

sound[] = { TX_ACTION_USER_("\sounds\secop_artillery_30.wss"), db +0, 1.0};

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re: Useage of preprocessor commands for dynamic path
« 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: [Select]
#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: [Select]
_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 ??


Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline kju

  • Members
  • *
    • PvPScene - The ArmA II multiplayer community
Re: Useage of preprocessor commands for dynamic path
« 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.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Useage of preprocessor commands for dynamic path
« Reply #4 on: 26 Oct 2009, 22:31:03 »
Have you tried this?
Code: [Select]
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                  !!!!";
};

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re: Useage of preprocessor commands for dynamic path
« 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:
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123