Home AMX User Forum AMX General Discussion

Inconsistent DEVCHAN Event behavior

Howdy Everyone!

So I've got an array of devchans. Not too complicated. However, once I put it into a multidimensional array, odd things start happening. Here is the code:
DEFINE_VARIABLE

DEVCHAN SOURCE_BUTTONS[1][2]


DEFINE_START

SOURCE_BUTTONS[1][1] = {dTP1,3};
SOURCE_BUTTONS[1][2] = {dTP1,4};
REBUILD_EVENT()


DEFINE_EVENT

BUTTON_EVENT[SOURCE_BUTTONS[1]]
{
    PUSH:
    {
	SEND_STRING 0,"'Button number ',BUTTON.INPUT.CHANNEL,' was pressed with SOURCE_BUTTONS[1]'";
    }
}

BUTTON_EVENT[SOURCE_BUTTONS[1][1]]
BUTTON_EVENT[SOURCE_BUTTONS[1][2]]
{
    PUSH:
    {
	SEND_STRING 0,"'Button number ',BUTTON.INPUT.CHANNEL,' was pressed with SOURCE_BUTTONS[1][x]'";
    }
}
^^Shown is not the full code used, just a small modified portion for demonstration


The BUTTON_EVENT[SOURCE_BUTTONS[1][1]] and BUTTON_EVENT[SOURCE_BUTTONS[1][2]] event works perfectly, but the BUTTON_EVENT[SOURCE_BUTTONS[1]] never fires. They're both using the same parts of the array which were assigned at the same time. Both utilize the REBUILD_EVENT() command.

Am I going crazy or should this work??

--Mitch

For reference, this is working perfectly in the same test program just a few lines after the above code:
DEFINE_VARIABLE

DEVCHAN TEMP_BUTTON[]  =
{
    {dTP1,1},
    {dTP1,2}
}

DEFINE_EVENT

BUTTON_EVENT[TEMP_BUTTON]
{
    PUSH:
    {
	SEND_STRING 0,"'Button number ',BUTTON.INPUT.CHANNEL,' was pressed with TEMP_BUTTON'";
    }
}
Sign In or Register to comment.