Home AMX User Forum AMX General Discussion
Options

Multi-state General Question

Guys:

I have a set of buttons with three states. I'd like to be able to light up the buttons based on conditional statements, but I can't seem to get it to work right.

State 1 - off (white)
State 2 - Blue
State 3 - Red

For whatever reason, when I use Send_Level nothing works, and when I assign the button to either 1, 2, or 3 I only get 3 no matter what. Am I missing something?
INTEGER nCAL_STATE[] ={
1,
2,
3
}

    FOR(x=1; x<=MAX_LENGTH_ARRAY(uMTG); x++)
    {
	IF(LENGTH_ARRAY(uMTG[x].cID) > 0)
	{
	    IF(uMTG[x].cID == uMTG[x].cID)
	    {
		
		START_INDEX = fnPROCESS_TIME(ATOI(uMTG[x].cSTART_HOUR), ATOI(uMTG[x].cSTART_MINUTE))
		END_INDEX = fnPROCESS_TIME(ATOI(uMTG[x].cEND_HOUR), ATOI(uMTG[x].cEND_MINUTE))

		START_TIME = fnPROCESS_INDEX(START_INDEX)
		END_TIME = fnPROCESS_INDEX(END_INDEX)
		
		IF(uMTG[x].cLEVEL == "'Classified'")
		{
		   [dvTP_Locked, x] = nCAL_STATE[3]
		}
		ELSE IF(uMTG[x].cLEVEL == "'Unclassified'")
		{
		    [dvTP_Locked, x] = nCAL_STATE[2]
		}

		IF(x == START_INDEX)
		{
		    SEND_COMMAND dvTP_Locked, "'^TXT-',ITOA(START_INDEX),',0,',uMTG[START_INDEX].cSUBJECT, ' (', DATE,' ',START_TIME,' - ',END_TIME,')'"
		}
	    }
	}
	ELSE
	{
	    OFF[dvTP_Locked, x]
	    SEND_COMMAND dvTP_Locked, "'^TXT-',ITOA(x),',0,'"
	}
    }

Matt

Comments

  • Options
    ericmedleyericmedley Posts: 4,177
    A Multi-state general button and a multi-state level are two different things. Which are you trying to use? To do what you describe the level will allow you to dispaly the differnt states as desired.
  • Options
    GregGGregG Posts: 251
    For plain multi-state general buttons, turning the button channel off will run through all states ending with showing state 1, and turning it on will run through all the states ending in the last one of the series. These are mainly designed for buttons that animate when touched.

    To send a multistate general button (non-level type) to a certain frame/state you can use the ^ANI command.
    Assuming the button has vtext address 100, this command will force it to show state #2:
    SEND_COMMAND dvTP_Locked,"'^ANI-100,0,2,1'"
    
Sign In or Register to comment.