!t, ^txt
vining
Posts: 4,368
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!
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 ; }
0
Comments
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:
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.
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!
ICYDK ? You can use a 0 as a wildcard to specify all states. So you could replace:
with: