* LOCATION * Allows user to change location field in their BBS account. This is an example * of how you can accept and change information in the user's account from * inside your TDBS program. Since the user's name and location field share the * same 60 character storage field in the USERLOG.BBS file the user's location * input is limited to the available space. A special routine is used to allow * limiting the user input. SET ESCAPE OFF && don't allow user to abort SET EXACT ON && compares check length too loc = TRIM(ULOCATION()) && get location from user's account long = 50 - LEN(TRIM(UNAME())) && how long can it be? IF UANSI() && does user have ANSI ability? SET COLOR TO BG+/N && bright cyan on black ENDIF ? "Location Change Utility" IF UANSI() && does user have ANSI ability? SET COLOR TO BG && cyan on black ENDIF IF UIBM() && does user have IBM graphic ability? ? REPLICATE(CHR(196),60) && show line ELSE && otherwise ? REPLICATE("-",60) && show dashes ENDIF IF UANSI() && does user have ANSI ability? SET COLOR TO BG+ && bright cyan ENDIF ? "You may type a new location up to " ?? LTRIM(STR(long)) && turn number into string ?? " characters in length." ? "Press the Enter key when you are done or press" ? "the Escape key to abort." IF UANSI() && does user have ANSI ability? SET COLOR TO GR+ && yellow (bright brown) ENDIF ? ? "Your location is now: " IF UANSI() && does user have ANSI ability? SET COLOR TO W+ && bright white ENDIF ?? loc && show current location setting IF UANSI() && does user have ANSI ability? SET COLOR TO GR+ && yellow (bright brown) ENDIF ? "Type a new location : " IF UANSI() && does user have ANSI ability? SET COLOR TO W+ && bright white ENDIF k = 0 && variable to hold key press hold = "" && variable to hold new location DO WHILE k <> 13 && loop until Enter key (13) k = INKEY(120) && wait 120 seconds for key press IF k # 13 && key not Enter key? IF k = 27 && is it Escape key? k = 13 && make it look like Enter key hold = "" && blank out new location LOOP && go back to top of loop ENDIF IF k = 8 && is key backspace? IF LEN(TRIM(hold)) > 0 && is there something to backspace? hold = LEFT(hold, LEN(hold) - 1) && remove one character ?? CHR(8) && show backspace key ENDIF ELSE IF LEN(hold) < long && is new location not too long? hold = hold + UPPER(CHR(k)) && add character pressed ?? UPPER(CHR(k)) && show character pressed ELSE && otherwise ?? CHR(7) && ring bell ENDIF ENDIF ENDIF ENDDO IF UANSI() && does user have ANSI ability? SET COLOR TO G+ && bright green ENDIF IF .NOT. EMPTY(hold) && new location not empty? dummy = ULREPLACE(ULOCATION,hold) && put it into the user's record ? ? "Your location has been updated." && tell user about it ELSE QUIT && leave program ENDIF ? WAIT && wait for key press RETURN && return from procedure