2006-01-13 05:27 PM
2006-01-13 05:52 PM
2006-01-13 06:01 PM
TomWaltz wrote:I start with ROOM_NAME being "Test Name", and after the routine runs, ROOM_NAME is still "Test Name" -- no change at all. It has clearly attempted something because the floor plan preview in the GDL editor blinks when I execute this routine.
How does it not work? What results do you get from it?
2006-01-13 09:33 PM
Jay wrote:Jay,
!!ROUTINE FOR CAPITALIZING THE ROOM NAME IF GLOB_MODPAR_NAME = `pCapitalize` THEN NameLen = STRLEN(ROOM_NAME) NewName = "" SubChar = "" FOR Idx = 1 TO NameLen - 1 NameChar = STRSUB(ROOM_NAME, Idx, 1) GOSUB 1000 IF SubChar = "" THEN NewName = NewName + NameChar ELSE NewName = NewName + SubChar ENDIF NEXT Idx ... ENDIF
2006-01-13 09:48 PM
Karl wrote:Oops. I originally had it set to "" at the beginning of the 1000 loop, but it still had the same result -- nothing.
One thing I see in a quick scan is that SubChar is set to "" outside of the loop, so after it ias assigned once in your 1000 Sub, it will never be "" again ... hence your IF will always be concatenating SubChar... so if you had "ab123c", your routine would produce "ABBBBC".
Karl wrote:Thanks! I never noticed that. A wish granted before I even posted it!
Tip for code on ac-talk ... there is a 'code' button in the format bar when you enter a message - keeps the indentation of the original.
2006-01-13 09:52 PM
IF GLOB_MODPAR_NAME = `pCapitalize` THEN NameLen = STRLEN(ROOM_NAME) NewName = "" FOR Idx = 1 TO NameLen - 1 NameChar = STRSUB(ROOM_NAME, Idx, 1) IF NameChar = "a" THEN NameChar = "A" IF NameChar = "b" THEN NameChar = "B" IF NameChar = "c" THEN NameChar = "C" <...> IF NameChar = "x" THEN NameChar = "X" IF NameChar = "y" THEN NameChar = "Y" IF NameChar = "z" THEN NameChar = "Z" NewName = NewName + NameChar NEXT Idx pCapitalize = 0 PARAMETERS ROOM_NAME = NewName PARAMETERS pCapitalize = pCapitalize, ROOM_NAME = ROOM_NAME ENDIFThis still doesn't work.
2006-01-13 10:17 PM
2006-01-14 12:59 AM
TomWaltz wrote:Right. pCapitalize is a Boolean parameter. Turning it on triggers the capitalization, at the end of the capitalization the programming switches pCapitalize back to 'off'.
OR, did you actually turn on pCapitalize in the Parameters window to trigger GLOB_MODPAR_NAME?
2006-01-16 08:37 AM
pCapitalize = 0 PARAMETERS ROOM_NAME = NewName PARAMETERS pCapitalize = pCapitalize, ROOM_NAME = ROOM_NAMEbut:
pCapitalize = 0 ROOM_NAME = NewName PARAMETERS pCapitalize = pCapitalize, ROOM_NAME = ROOM_NAMEHaven't proofed, but this should do it.
2006-01-16 08:48 AM
1000: IF NameChar = "a" THEN SubChar = "A" IF NameChar = "b" THEN SubChar = "B" IF NameChar = "c" THEN SubChar = "C" ...is a bit raw.
low=ROOM_NAME result="" downT=" abcdefghijklmnopqrstufwxyz" upT=" ABCDEFGHIJKLMNOPQRSTUVWXYZ" FOR i=1 TO STRLEN(low) subT=STRSUB(low,i,1) posT=STRSTR(downT,subT) IF posT THEN result=result+STRSUB(upT,posT,1) ELSE result=result+subT ENDIF NEXT i