Home AMX User Forum NetLinx Studio

!t, ^txt

I'm modifying my HomeWorks code to populate a new style pop up and In the following function I originally tried to use the !T command but was getting very odd results. The first loop was populating the buttons name from the Name Array of the second loop and the 2nd loop wouldn't populate at all.

I started thinking and remembered a recent post by Joe H. regarding the !T vs ^TXT above button numbers above 256 or something. I tracked down the thread and gave it a re-read and figure, ok, that's part of the problem. I changed both loops to the ^TXT and everything work fine.

Why didn't the first loop work? The VT address started at 21 for a total of 24 buttons. The second loop started at 501 for a total of 48 buttons so I can see that not working.

Dazed and confused!
DEFINE_CONSTANT//VT ADDRESS POINTERS

VT_HWI_SCENES = 21 ;
VT_HWI_DMMERS = 501 ;


DEFINE_FUNCTION CHAR fnHWI_DisplayNames(DEV iTP)
     
     {
     STACK_VAR INTEGER i ;
     
     for(i = 1 ; i <= MAX_NUM_SCENES ; i ++)
	  {
	  if(length_string(cSCENE_NAMES[i]))
	       {
	       //SEND_COMMAND iTP,"'!T',(VT_HWI_SCENES - 1) + i,cSCENE_NAMES[i]" ;
	       SEND_COMMAND iTP,"'^TXT-',itoa((VT_HWI_SCENES - 1) + i),',1&2,',cSCENE_NAMES[i]" ;
	       }
	  else
	       {
	       //SEND_COMMAND iTP,"'!T',(VT_HWI_SCENES - 1) + i,HWI_EMPTY_SCENE" ;
	       SEND_COMMAND iTP,"'^TXT-',itoa((VT_HWI_SCENES - 1) + i),',1&2,',HWI_EMPTY_SCENE" ;
	       }
	  }
     for( i = 1 ; i <= MAX_NUM_DIMMERS ; i ++)
	  {
	  if(length_string(cDIMMER_NAMES[i]))
	       {
	       //SEND_COMMAND iTP,"'!T',(VT_HWI_DMMERS - 1) + i,cDIMMER_NAMES[i]" ;
	       SEND_COMMAND iTP,"'^TXT-',itoa((VT_HWI_DMMERS - 1) + i),',1&2,',cDIMMER_NAMES[i]" ;
	       }
	  else
	       {
	       //SEND_COMMAND iTP,"'!T',(VT_HWI_DMMERS - 1) + i,HWI_EMPTY_DIMMER" ;
	       SEND_COMMAND iTP,"'^TXT-',itoa((VT_HWI_DMMERS - 1) + i),',1&2,',HWI_EMPTY_DIMMER" ;
	       }
	  }
     
     RETURN TRUE ;
     }

Comments

  • Actually, we tried the suggestion Joe made in that thread, and changed the address to a number below 256, but it still didn't work.
    // This didn't work:
    
    SEND_COMMAND dvTP,"'!T',400,itoa(nCountDown),"
    
    // Trying this didn't work:
    
    
    SEND_COMMAND dvTP,"'!T',10,itoa(nCountDown),"
    
    
    // So we decided to live to fight another day by using this:
    
    SEND_COMMAND dvTP, "'^TXT-10,0,',ITOA(nCountDown)"
    
    

    Maybe our problem was that comma after the ITOA(nCOUNTDOWN) !

    Maybe in your case, the number of characters exceeds the limits set by the G3 syntax:

    "’!T’,<variable text address>,’<new button text>’"
    Shorthand version of ’TEXT’ command.
    <variable text address> = 1 - 255
    <new button text> = 1 - 60 characters
    Example:
    SEND_COMMAND TP,"’!T’,1,’VCR PLAY’"
  • Joe HebertJoe Hebert Posts: 2,159
    Rollover
    vining wrote:
    The first loop was populating the buttons name from the Name Array of the second loop and the 2nd loop wouldn't populate at all.

    ...Why didn't the first loop work? The VT address started at 21 for a total of 24 buttons. The second loop started at 501 for a total of 48 buttons so I can see that not working.
    Good puzzle. I believe the answer is that the first loop (the scene names) did populate correctly; however, the second loop overwrote what the first loop wrote because the address codes rolled over.

    For example, when the second loop (the dimmer names) tried to send text to address code 533 it really sent data to address code 21 which is the first scene name button. Why? Because the !T command can only address one byte and if you lop off 533 to one byte you get 21.

    533 = $215
    Lopping off to one byte you get $15 or 21.
  • viningvining Posts: 4,368
    Joe Hebert wrote:
    Good puzzle. I believe the answer is that the first loop (the scene names) did populate correctly; however, the second loop overwrote what the first loop wrote because the address codes rolled over.
    Wow! In my wildest dreams I never would have come up with that conclusion, I would have just kept banging my head against the wall until I passed out.

    On the first loop buttons 23 & 24 did populate with the correct values from the first Name array (which significantly added to my confusion) so the roll over stopped @ 548 ($224) lopped of to $24 which = 36 and the VT range on the first loop was 21 - 45 (21+24). Scene names 16 - 22 were empty so they didn't populate any way. So Scene button 1-15 populated with the name from the dimmer name array, 16-22 were blank and 23 & 24 populated with the correct scene names.

    Now this is the kind of stuff that causes people to dirink in excess!

    Thanks for the insight Joe!
  • Joe HebertJoe Hebert Posts: 2,159
    You?re welcome, vining.

    ICYDK ? You can use a 0 as a wildcard to specify all states. So you could replace:
    SEND_COMMAND iTP,"'^TXT-',itoa((VT_HWI_SCENES - 1) + i),',[b]1&2[/b],',cSCENE_NAMES[i]" ;
    

    with:
    SEND_COMMAND iTP,"'^TXT-',itoa((VT_HWI_SCENES - 1) + i),',[b]0[/b],',cSCENE_NAMES[i]" ;
    
Sign In or Register to comment.