Home AMX User Forum NetLinx Studio

Dynamic call

Hi all,

Is there any way to make dynamic calls in Netlinx?

I have a structure which definition is as follow:
STRUCTURE _sCMD
{
char _command[16]
char _parameters[32]
char _feedback[32]
integer _cmd_type
char _dynamicCall[32] // will contain the name of a define_call procedure already defined...
_elt _guiElt
}

I wrote a define_call procedure like this:
DEFINE_CALL 'test1'
{
send_string 0, '### CALL OF TEST 1'
}

In the initialisation of one varilable of type _sCMD, I do that:
...
vProtocolCommands[1]._dynamicCall = 'test1' //name of the define_call procedure I want to call later
...

What I want to do, on a button event for example, is to call the test1 procedure this way:
call vProtocolCommands[vCurrentCMD]._dynamicCall

Is it possible to do that on Netlinx?
I tried also call "vProtocolCommands[vCurrentCMD]._dynamicCall" and then I have the following error message: C10548: SUBCALLSTATEMENT3 unsupported

Thanks

Comments

  • ericmedleyericmedley Posts: 4,177
    nope...

    Something akin to

    CALL 'test1'

    where you put a string variable in the place of the 'test1'

    ex: Call s_My_Calls_List[n_Call_ID]

    would be nice but is not so.;
  • hilalhilal Posts: 2
    ericmedley wrote: »
    nope...

    Something akin to

    CALL 'test1'

    where you put a string variable in the place of the 'test1'

    ex: Call s_My_Calls_List[n_Call_ID]

    would be nice but is not so.;

    too bad... this would have been very helpful...

    thanks anyway ;-)
  • mpullinmpullin Posts: 949
    NetLinx is kind of misleading with its use of quotation marks sometimes. This is one of them. The CALL that is made on that line is determined at compile time, not run time -- the name is not a string. You can't dynamically start/cancel a wait, either.
  • a_riot42a_riot42 Posts: 1,624
    mpullin wrote: »
    NetLinx is kind of misleading with its use of quotation marks sometimes. This is one of them. The CALL that is made on that line is determined at compile time, not run time -- the name is not a string. You can't dynamically start/cancel a wait, either.

    Pointers to functions would be nice, however, without pointers it isn't possible.
    Paul
  • shr00m-dewshr00m-dew Posts: 394
    Why not use a function?

    define_Function DYN_CALL (call)
    {
    switch(call)
    {
    case test1:
    {
    //do test one call
    }
    }
    }

    DYN_CALL(vProtocolCommands[vCurrentCMD]._dynamicCall)
  • mpullinmpullin Posts: 949
    shr00m-dew wrote: »
    Why not use a function?
    Because that would be outside the scope of this thread :p
Sign In or Register to comment.