Home AMX User Forum NetLinx Studio

LEVEL_EVENT on 2 Dimensional Array possible?

Is this possible? I'm currently getting a syntax error on the LEVEL_EVENT [myArray,1]
Will i need to make this LEVEL_EVENT[myArray[1],1]? Is there a better way?

DEFINE_DEVICE
dvTP1=10001:1:0
dvTP2=10002:1:0
DEFINE_VARIABLE
volatile dev myArray[2][3]
volatile integer lvlSlider[2] = {1,2}
volatile integer x
volatile integer port = 0
DEFINE_START
for(x=1;x<=2;x++)
{
    for(y=1;y<=3;y++)
    {
        port++;
        myArray[x].number = 33001
        myArray[x].port = port
        myArray[x].system = 0
    }
}
REBUILD_EVENT()
DEFINE_EVENT
LEVEL_EVENT [myArray,1]
{
    stack_var integer tp
    stack_var integer dv
    tp = get_last(myArray)
    dv = get_last(myArray[tp])
    send_level dvTP[tp],lvlSlider[dv],level.value
}
</code>DEFINE_DEVICE
dvTP1=10001:1:0
dvTP2=10002:1:0
DEFINE_VARIABLE
volatile dev myArray[2][3]
volatile integer lvlSlider[2] = {1,2}
volatile integer x
volatile integer port = 0
DEFINE_START
for(x=1;x<=2;x++)
{
    for(y=1;y<=3;y++)
    {
        port++;
        myArray[x].number = 33001
        myArray[x].port = port
        myArray[x].system = 0
    }
}
REBUILD_EVENT()
DEFINE_EVENT
LEVEL_EVENT [myArray,1]
{
    stack_var integer tp
    stack_var integer dv
    tp = get_last(myArray)
    dv = get_last(myArray[tp])
    send_level dvTP[tp],lvlSlider[dv],level.value
}

Comments

  • LEVEL_EVENT[myArray[x],1] is the only option

  • sentry07sentry07 Posts: 77

    The device in any _EVENT block can't be an array. You can, however, define more than one _EVENT header for a block of code.

    LEVEL_EVENT [myArray[1],1]
    LEVEL_EVENT [myArray[2],1]
    LEVEL_EVENT [myArray[3],1]
    {
        stack_var integer tp
        stack_var integer dv
        tp = get_last(myArray)
        dv = get_last(myArray[tp])
        send_level dvTP[tp],lvlSlider[dv],level.value
    }
    
  • danportugaldanportugal Posts: 14

    Thanks gents.

Sign In or Register to comment.