REM > !Territory.Utils.Choose

DIM Terr$(20), Terr%(20), b% 100

PRINT "Please choose a territory:"

z% = 0
 FOR t% = 1 TO 100
  SYS &43044, t% TO ;f%
   IF (f% AND %100) THEN
    Terr%(z%) = t%
    SYS &43043, t%, b%, 100 TO , Terr$(z%)
    PRINT " "+CHR$(65 + z%)+" "+Terr$(z%)
    z% += 1
   ENDIF
 NEXT

PRINT
PRINT "Choosing " + Terr$(0) + " in ";
x% = POS: y% = VPOS
PRINT "5 seconds"
s% = 5
 REPEAT
  g% = INKEY(100)
   IF g% = -1 THEN
    s% -= 1
     IF s% = 0 THEN
      PRINT TAB(0, y%) Terr$(0) + " territory chosen                        "'
      OSCLI"Set Territory$Name " + Terr$(0)
      OSCLI"SetEval Territory " + STR$Terr%(0)
      END
     ENDIF
    PRINT TAB(x%, y%) STR$s%
   ELSE
    IF g% > 96 THEN g% -= 32
   ENDIF
 UNTIL (g% > 64) AND (g% < (65 + z%))

PRINT TAB(0, y%) Terr$(g% - 65)+" territory chosen                        "'

OSCLI"Set Territory$Name " + Terr$(g% - 65)
OSCLI"SetEval Territory " + STR$Terr%(g% - 65)
