DECLARE SUB ViewEmployed ()
DECLARE SUB ViewTiles (scroll!)
DECLARE FUNCTION rmenu! (menu$(), X!, Y!)
DECLARE FUNCTION AINPUT$ (prompt$, Init$)
DECLARE SUB CheckLevels ()
DECLARE SUB MiniDigit (X!, Y!, t$, C!)
DECLARE SUB RefreshInv ()
DECLARE FUNCTION YesNo% (MSGT$, yes$, no$)

DECLARE SUB BankLoop (bscroll!, selbi!, vbmode!)
DECLARE SUB CheckTabs ()
DECLARE SUB Deposit (ID!, amt!, bid!)
DECLARE SUB Deposit2 (ID%, amt AS LONG, bid%)
DECLARE FUNCTION EmptySlots! ()
DECLARE FUNCTION EmptySlotsB! ()
DECLARE FUNCTION GetBankNo% (ID!)
DECLARE FUNCTION GetID% (ID$)
DECLARE FUNCTION GetInvNo% (ID!)
DECLARE SUB Mix (mixtype!, idA$, idB$, RtnAmt!)
DECLARE SUB ObjectInfo (ID!)
DECLARE FUNCTION Possess& (ID!)
DECLARE FUNCTION PossessB& (ID!) '[ returns amount of ID in bank ]
DECLARE FUNCTION PossessSubType! (grp!, subg!, DoICare!)
DECLARE SUB ViewBank (bscroll!, selbi!)
DECLARE SUB ViewInventory ()
DECLARE SUB ViewInventory2 ()
DECLARE SUB ViewOptions ()
DECLARE SUB ViewSkills ()
DECLARE SUB ViewWorn ()
DECLARE SUB Wear (ID!, ininv!)
DECLARE SUB Withdraw (ID!, amt!, bid!)

'$INCLUDE: 'cdm.bi' 'ITEMS
' FutureTileEngine
'$INCLUDE: 'future.bi'

SUB AddRock (X, Y, r$, RT)
END SUB

SUB BankLoop (bscroll, selbi, vbmode)
REDIM mcur(1300)
REDIM mcurB(1300)
REDIM menu$(10)
  DO
   Future.UpdateMouse
   IF Future.MouseB% = 2 THEN
    DO
     Future.UpdateMouse
    LOOP UNTIL Future.MouseB% = 0
    mx% = Future.MouseX%
    my% = Future.MouseY%
    mxs = INT(mx% / 36)
    mys = INT(my% / 36)
    seli2 = ((mys * 6) - (6 - mxs)) + (bscroll * 6)
    IF seli2 > 0 AND seli2 < 101 THEN
     IF bankID(seli2) > 0 THEN
     menu$(1) = "Cancel"
     menu$(2) = " Withdraw 1"
     menu$(3) = " Withdraw 5"
     menu$(4) = " Withdraw 10"
     menu$(5) = " Withdraw X"
     menu$(6) = " Withdraw All"
     a = rmenu(menu$(), INT(mx% / 15), INT(my% / 15))
     SELECT CASE a
      CASE 2
       amt = 1
       IF bankAmt(seli2) > 0 THEN
        Withdraw seli2, amt, 0
       END IF
      CASE 3  ' this is where it crashes. just use all or 1
       IF bankAmt(seli2) < 5 THEN amt = bankAmt(seli2) ELSE amt = 5
       Withdraw seli2, amt, 0
      CASE 4
       IF bankAmt(seli2) < 10 THEN amt = bankAmt(seli2) ELSE amt = 10
       Withdraw seli2, amt, 0
      CASE 5
       amt = VAL(AINPUT$("Amount:", ""))
       IF bankAmt(seli2) < amt THEN amt = bankAmt(seli2)
       Withdraw seli2, amt, 0
      CASE 6
       Withdraw seli2, bankAmt(seli2) + 0, 0
     END SELECT
    END IF
    ViewBank bscroll, selbi
    END IF
   END IF
   IF Future.MouseB% = 1 THEN
    mx% = Future.MouseX%
    my% = Future.MouseY%
    mxs = INT(mx% / 36)
    mys = INT(my% / 36)
    IF mx% > 252 + 36 AND mx% < 252 + 72 THEN
     IF my% > 36 + 32 AND my% < 36 + 68 THEN
      DO
       Future.UpdateMouse
      LOOP UNTIL Future.MouseB% = 0
      vbmode = 0
      EXIT DO
     END IF
    END IF
    selbi = (mys * 6) - (6 - mxs)
    selbi = selbi + (bscroll * 6)
    IF selbi < 1 OR selbi > 100 THEN selbi = 1
    item = selbi
    IF bankID(item) > 0 THEN
     iconP% = obj(bankID(item)).Icon
     IF obj(bankID(item)).Group = 4 THEN
      SELECT CASE bankAmt(item)
       CASE 1 TO 5
        iconP% = 5
       CASE 6 TO 21
        iconP% = 6
       CASE IS > 22
        iconP% = 7
      END SELECT
     END IF
     Future.MouseOff
     SetPage Secondary%
      Future.FILLBOX 0, 0, 50, 50, 0
      Future.XMSArrayPut 0, 0, icons%, iconP%
      Future.GET 0, 0, 32, 32, mcur()
     SetPage Primary%
     mx% = Future.MouseX%
     my% = Future.MouseY%
     Future.GET mx%, my%, mx% + 32, my% + 32, mcurB()
     DO
      Future.PUT mx%, my%, mcur()
      WAIT &H3DA, 8
      omx% = mx%
      omy% = my%
      Future.UpdateMouse
      mx% = Future.MouseX%
      my% = Future.MouseY%
      Future.PUT omx%, omy%, mcurB()
      Future.GET mx%, my%, mx% + 32, my% + 32, mcurB()
      Future.PUT mx%, my%, mcur()
     LOOP UNTIL Future.MouseB% = 0
     Future.MouseOn
     mx% = Future.MouseX% + 16
     my% = Future.MouseY% + 16
     mxs = INT(mx% / 36)
     mys = INT(my% / 36)
     sels = (mys * 6) - (6 - mxs)
     sels = sels + (bscroll * 6)
     IF sels > 0 AND sels < 37 THEN
      SWAP bankID(selbi), bankID(sels)
      SWAP bankAmt(selbi), bankAmt(sels)
      selbi = sels
     END IF
     ViewBank bscroll, selbi
    END IF
   END IF
   jkl$ = INKEY$
   SELECT CASE jkl$
    CASE CHR$(0) + "H"
     IF bscroll > 0 THEN bscroll = bscroll - 1
     ViewBank bscroll, selbi
    CASE CHR$(0) + "P"
     IF bscroll < 17 THEN bscroll = bscroll + 1
     ViewBank bscroll, selbi
    CASE CHR$(27)
     vbmode = 2
     EXIT DO
    CASE " "
     vbmode = 0
     EXIT DO
   END SELECT
  LOOP
ERASE menu$
END SUB

SUB CheckRocks
FOR i = 1 TO 50
 IF ASC(rockR(i).r$) > 97 THEN
  IF TIME >= rockR(i).RT THEN
   SetPage Secondary%
   Future.PSET rockR(i).X + 0, rockR(i).Y + 0, ASC(rockR(i).r$)
   SetPage Primary%
   UpdateTempMap (unit(selu).map)
   IF unit(selu).map = currentmap THEN Drawmap currentmap, 1, 0, 0
   rockR(i).r$ = ""
  END IF
 END IF
NEXT i
END SUB

SUB CheckTabs
   Future.UpdateMouse
   IF Future.MouseB% = 1 THEN
    DO
     Future.UpdateMouse
    LOOP UNTIL Future.MouseB% = 0
     mx% = Future.MouseX%
     my% = Future.MouseY%
     addX = 278
     WhichTab = INT((my% - 5) / 36)
     IF mx% > addX AND mx% < addX + 32 THEN
      IF WhichTab > 0 AND WhichTab < 7 THEN
       vuBoxNo = WhichTab
       IF Mapedit = 1 THEN vuBoxNo = -vuBoxNo
       vuBoxState = 1
      END IF
     END IF
   END IF
END SUB

SUB Deposit (ID, amt, bid)
RefreshInv
' find inv obj
i = ID
IF obj(invID(ID)).Group = 4 THEN
  bid = EmptySlotsB
  like = GetBankNo%(invID(ID))
  IF like = 0 THEN
   IF bid > 0 THEN
    invAmt(i) = invAmt(i) - amt
    bankID(bid) = invID(i)
    bankAmt(bid) = bankAmt(bid) + amt
    IF invAmt(i) = 0 THEN invID(i) = 0
   ELSE
    MSG "Your bank is full"
   END IF
  ELSE
    invAmt(i) = invAmt(i) - amt
    bankID(like) = invID(i)
    bankAmt(like) = bankAmt(like) + amt
    IF invAmt(i) = 0 THEN invID(i) = 0
  END IF
ELSE
 like = GetBankNo%(invID(ID))
 IF like = 0 THEN
  like = EmptySlotsB
 END IF
 IF like > 0 THEN
  same = invID(ID)
  bankID(like) = same
   FOR i = 1 TO amt
   FOR V = 1 TO 36
    IF same = invID(V) THEN
     invAmt(V) = 0
     invID(V) = 0
     bankAmt(like) = bankAmt(like) + 1
     EXIT FOR
    END IF
   NEXT V
   NEXT i
 ELSE
  MSG "Your bank is full"
 END IF
END IF
END SUB

SUB Deposit2 (ID AS INTEGER, amt AS LONG, bid AS INTEGER)
RefreshInv
' find inv obj
i = ID

  bid = EmptySlotsB
  like = GetBankNo%(ID + 0)
  IF like = 0 THEN
   IF bid > 0 THEN
    bankID(bid) = ID
    bankAmt(bid) = bankAmt(bid) + amt
'    MSG "Added Amt:" + STR$(Amt) + " to new pile in bank"
   ELSE
    MSG "Your bank is full"
   END IF
  ELSE
    bankID(like) = ID
    bankAmt(like) = bankAmt(like) + amt
'    MSG "Added Amt:" + STR$(Amt) + " to existing pile in bank"
  END IF


END SUB

FUNCTION EmptySlots
FOR i = 1 TO 36
 IF invID(i) = 0 THEN
  num = num + 1
 END IF
NEXT i
EmptySlots = num
END FUNCTION

FUNCTION EmptySlotsB
FOR i = 1 TO 100
 IF bankID(i) = 0 THEN
  num = i
  EXIT FOR
 END IF
NEXT i
EmptySlotsB = num
END FUNCTION

SUB ForgeBar (bar$, UsedWhat$, xpb)
 RefreshInv
 metal$ = LEFT$(bar$, 2)
 REDIM itemID$(14)
 REDIM bars(14)
 REDIM fID(36)
 i = 0
 i = i + 1: itemID$(i) = metal$ + "dg": bars(i) = 1
 i = i + 1: itemID$(i) = metal$ + "sw": bars(i) = 2
 i = i + 1: itemID$(i) = metal$ + "ls": bars(i) = 2
 i = i + 1: itemID$(i) = metal$ + "ax": bars(i) = 1
 i = i + 1: itemID$(i) = metal$ + "sc": bars(i) = 2
 i = i + 1: itemID$(i) = metal$ + "2h": bars(i) = 3
 i = i + 1: itemID$(i) = metal$ + "mh": bars(i) = 2
 i = i + 1: itemID$(i) = metal$ + "fh": bars(i) = 2
 i = i + 1: itemID$(i) = metal$ + "p8": bars(i) = 5
 i = i + 1: itemID$(i) = metal$ + "ma": bars(i) = 4
 i = i + 1: itemID$(i) = metal$ + "lg": bars(i) = 3
 i = i + 1: itemID$(i) = metal$ + "ss": bars(i) = 3
 i = i + 1: itemID$(i) = metal$ + "ks": bars(i) = 4
 FOR i = 1 TO 13
  fID(i) = GetID%(itemID$(i))
 NEXT i
redrawforge:
Future.MouseOff
 x1 = 33
 y1 = 16
 x2 = 360
 Y2 = 328
 Future.FILLBOX x1, y1, x2, Y2, 8
 Future.BOX x1, y1, x2, Y2, 7
 Future.PRINT x1 + 5, y1 + 1, RTRIM$(obj(GetID%(bar$) + 0).oname$) + ": Choose an item to forge...", 12, -1
 Future.PRINT x1 + 5, Y2 - 20, " Digit shows no. of bars required", 15, -1
 FOR X = 1 TO 6
 FOR Y = 1 TO 6
  x2 = X * 36
  Y2 = Y * 36
  item = (Y * 6) - (6 - X)
  IF fID(item) > 0 THEN
   iconP% = obj(fID(item)).Icon
   Future.XMSArrayPut x2 + 0, Y2 + 0, icons%, iconP%
   MiniDigit x2, Y2 + 22, STR$(bars(item)), 14
  END IF
  NEXT Y
 NEXT X
Future.MouseOn


Future.MouseOn

  DO
   Future.UpdateMouse
   IF Future.MouseB% = 1 THEN
    DO
     Future.UpdateMouse
    LOOP UNTIL Future.MouseB% = 0
    mx% = Future.MouseX%
    my% = Future.MouseY%
    mxs = INT(mx% / 36)
    mys = INT(my% / 36)
    forge = (mys * 6) - (6 - mxs)
    IF forge < 1 OR forge > 13 THEN forge = 1
    IF fID(forge) > 0 THEN
     IF Skill(3).amt >= obj(fID(forge)).Level THEN
     ' enough bars to make it
     a& = Possess(INT(GetID%(bar$)))
     b% = bars(forge)
     MSG STR$(a&) + ">=" + STR$(b%) + "?"
     IF a& >= b% THEN
      '- Make it
       'a. Take bars

       barstaken = bars(forge)
       MSG "Taking " + STR$(barstaken) + bar$
       FOR i = 1 TO 36
        IF obj(invID(i)).ID$ = bar$ THEN
         invID(i) = 0
         invAmt(i) = 0
         barstaken = barstaken - 1
        END IF
        IF barstaken = 0 THEN EXIT FOR
       NEXT i
       IF barstaken <> 0 THEN MSG "Still got " + STR$(barstaken) + " to go!"

       ' b. Give Item
       Give obj(fID(forge)).ID$, 1
      ' IF RIGHT$(bar$, 2) = "ax" THEN MID$(bar$, 3, 2) = "sw"
       UsedWhat$ = bar$
       xpb = obj(fID(forge)).xp * bars(forge)
       IF bars(forge) = 1 THEN s$ = "" ELSE s$ = "s"
       MSG "You hammer the bar" + s$ + " and make 1 " + LTRIM$(RTRIM$(obj(fID(forge)).oname$))
       EXIT DO
     ELSE
      MSG "Not enough bars"
      EXIT DO
     END IF
     ELSE
      MSG "You need to be level" + STR$(obj(fID(forge)).Level) + " to make that"
     END IF
    END IF
   END IF
   jkl$ = INKEY$
   SELECT CASE jkl$
    CASE CHR$(27)
     EXIT DO
   END SELECT
  LOOP
 ERASE itemID$, bars, fID
END SUB

FUNCTION GetBankNo% (ID)
FOR i = 1 TO 100
 IF bankID(i) = ID THEN
  GetBankNo% = i
  EXIT FOR
 END IF
NEXT i
END FUNCTION

FUNCTION GetID% (ID$)
FOR i = 1 TO maxobs
 IF obj(i).ID$ = ID$ THEN
  ob = i
  EXIT FOR
 END IF
NEXT i
IF ob = 0 THEN MSG "`" + ID$ + "`" + " is not an object ID"
GetID% = ob
END FUNCTION

FUNCTION GetInvNo% (ID) '[ returns index of ID in inventory ]
FOR i = 1 TO 36
 IF invID(i) = ID THEN
  GetInvNo% = i
  EXIT FOR
 END IF
NEXT i
END FUNCTION

SUB Give (ID$, amt)
FOR i = 1 TO 36
 IF invID(i) = 0 THEN
  freeslot = i
  EXIT FOR
 END IF
NEXT i
idno = GetID%(ID$)
invno = GetInvNo%(idno)
IF obj(idno).Group = 4 THEN
 'stack
 IF invno > 0 THEN
  invAmt(invno) = invAmt(invno) + amt
 ELSE
  invID(freeslot) = idno
  invAmt(freeslot) = amt
 END IF
ELSE
  ' since i only use amt as 1 when
  ' an object isnt stackable...
  invID(freeslot) = idno
  invAmt(freeslot) = amt
  'MSG "gave id#" + STR$(idno)
END IF
END SUB

SUB Mix (mixtype, idA$, idB$, RtnAmt)
'==========================================================
' Mixes two objects, and provides the amount of return
' in rtnamt. mixtypes are as follows...
' 1=obj+obj=obj
' 2=obj+obj=unit (e.g cow, fire)
' 3=obj+unit=obj (e.g. meat+fire=cooked meat)
'==========================================================
    IF idA$ = "flor" OR idB$ = "flor" THEN
     pordo = YesNo%("Make bread dough or pastry?", "Dough", "Pastry")
    END IF
    IF idA$ = "milk" OR idB$ = "milk" THEN
     cocoa = GetInvNo%(INT(GetID%("coco")))
     IF cocoa > 0 THEN
      caket = YesNo%("Make chocolate or normal dough?", "Choc", "Normal")
     END IF
    END IF
CLOSE : OPEN "data\mix.dat" FOR INPUT AS #1
 DO UNTIL EOF(1)
  INPUT #1, mixmode, id1$, id2$, id3$, amt1, amt2, amt3
  WhichWay = 0
  SELECT CASE mixmode
   CASE 3
    ' only goes one way, obj first
    ' dont need to check for enuf of 'unit' (id2$)
    ' checking is predone in Modeguy
    ' Only check if it matches
    IF id1$ = idA$ AND VAL(id2$) = VAL(idB$) THEN
     item1 = GetInvNo%(INT(GetID%(id1$)))
     ob = GetID%(id3$)
     IF invAmt(item1) >= amt1 THEN
      IF Skill(obj(ob).Skill).amt >= obj(ob).Level THEN
       invAmt(item1) = invAmt(item1) - amt3
       Skill(obj(ob).Skill).xp = Skill(obj(ob).Skill).xp + obj(ob).xp + 1
       IF obj(ob).Group = 4 THEN
        Give id3$, amt3
       ELSE
        FOR i = 1 TO amt3
         Give id3$, 1
        NEXT i
       END IF
      ELSE
       MSG "You need to be level " + STR$(obj(ob).Level) + " " + RTRIM$(LTRIM$(Skill(obj(ob).Skill).sname$))
      END IF
     ELSE
      MSG "Not enough " + RTRIM$(LTRIM$(obj(GetID%(id1$)).oname$)) + " for that"
     END IF
    END IF
   CASE 2
    IF id1$ = idA$ AND id2$ = idB$ THEN
     WhichWay = 1
     item1 = GetInvNo%(INT(GetID%(id1$)))
     item2 = GetInvNo%(INT(GetID%(id2$)))
    END IF
    IF id2$ = idA$ AND id1$ = idB$ THEN
     WhichWay = 2
     SWAP amt1, amt2
     SWAP id1$, id2$
     item1 = GetInvNo%(INT(GetID%(id1$)))
     item2 = GetInvNo%(INT(GetID%(id2$)))
    END IF
    IF WhichWay > 0 THEN
     IF invAmt(item1) >= amt1 THEN
      IF invAmt(item2) >= amt2 THEN
       invAmt(item1) = invAmt(item1) - amt1
       invAmt(item2) = invAmt(item2) - amt2
       IF VAL(id3$) = 19 THEN MSG "You take the wood and light a fire"
        FOR i = 1 TO amt3
         CreateGuy unit(selu).X + 0, unit(selu).Y + 0, 1, 0, VAL(id3$), 1, 0, 0, 700, 0, "", 0' fire
        NEXT i
      ELSE
       MSG "Not enough " + RTRIM$(LTRIM$(obj(GetID%(id2$)).oname$)) + " for that"
      END IF
     ELSE
      MSG "Not enough " + RTRIM$(LTRIM$(obj(GetID%(id1$)).oname$)) + " for that"
     END IF
    END IF
   CASE 1
     IF caket = 1 THEN
      IF id3$ = "ckdo" THEN GOSUB skip
     ELSE
      IF id3$ = "cckd" THEN GOSUB skip
     END IF
     IF pordo = 1 THEN
      IF id3$ = "psty" THEN GOSUB skip
     ELSE
      IF id3$ = "douh" THEN GOSUB skip
     END IF
    IF id1$ = idA$ AND id2$ = idB$ THEN
     WhichWay = 1
     item1 = GetInvNo%(INT(GetID%(id1$)))
     item2 = GetInvNo%(INT(GetID%(id2$)))
    END IF
    IF id2$ = idA$ AND id1$ = idB$ THEN
     WhichWay = 2
     SWAP amt1, amt2
     SWAP id1$, id2$
     item1 = GetInvNo%(INT(GetID%(id1$)))
     item2 = GetInvNo%(INT(GetID%(id2$)))
    END IF
    IF WhichWay > 0 THEN
    ob = GetID%(id3$)
    IF Skill(obj(ob).Skill).amt >= obj(ob).Level THEN
     IF invAmt(item1) >= amt1 THEN
      sug2 = 0
      IF id3$ = "uapi" OR id3$ = "uypi" THEN
       sugr = GetInvNo%(INT(GetID%("sugr")))
       IF sugr > 0 THEN
        sug2 = sugr
       ELSE
        MSG "You need sugar to make fruit pies"
        GOSUB skip
       END IF
      END IF
      egg2 = 0
      sug2 = 0
      IF id3$ = "ukck" OR id3$ = "ucck" THEN
       sugr = GetInvNo%(INT(GetID%("sugr")))
       eggs = GetInvNo%(INT(GetID%("eggs")))
       cocoa = GetInvNo%(INT(GetID%("coco")))
       IF sugr > 0 THEN
        sug2 = sugr
       ELSE
        MSG "You need sugar to make cakes"
        GOSUB skip
       END IF
       IF eggs > 0 THEN
        egg2 = eggs
       ELSE
        MSG "You need an egg to make cakes"
        GOSUB skip
       END IF
      END IF
      coco2 = 0
      IF id3$ = "cckd" THEN
       cocoa = GetInvNo%(INT(GetID%("coco")))
       IF cocoa > 0 THEN
        coco2 = cocoa
       ELSE
        MSG "You need cocoa "
        GOSUB skip
       END IF
      END IF

      IF invAmt(item2) >= amt2 THEN
       invAmt(item1) = invAmt(item1) - amt1
       invAmt(item2) = invAmt(item2) - amt2
       invID(sug2) = 0
       invID(egg2) = 0
       invID(coco2) = 0
       n$ = RTRIM$(LTRIM$(obj(GetID%(id3$)).oname$))
       MSG "You get" + STR$(amt3) + " " + n$
       RtnAmt = amt3
       IF obj(GetID%(id3$)).Group = 4 THEN
        Give id3$, amt3
       ELSE
        IF id3$ = "douh" OR id3$ = "psty" OR id3$ = "ckdo" OR id3$ = "cckd" THEN
         Give "bckt", 1
         Give "ppot", 1
        END IF
        IF id3$ = "wcly" THEN Give "bckt", 1
        FOR i = 1 TO amt3
         Give id3$, 1
        NEXT i
       END IF
      ELSE
       MSG "Not enough " + RTRIM$(LTRIM$(obj(GetID%(id2$)).oname$)) + " for that"
      END IF
     ELSE
      MSG "Not enough " + RTRIM$(LTRIM$(obj(GetID%(id1$)).oname$)) + " for that"
     END IF
    ELSE
     MSG "You need to be level " + STR$(obj(ob).Level) + " " + RTRIM$(LTRIM$(Skill(obj(ob).Skill).sname$))
    END IF
    END IF
  END SELECT
skip:
 LOOP
 CheckLevels
 RefreshInv
END SUB

SUB ObjectInfo (ID)
 x1 = 100
 y1 = 100
 x2 = 300
 Y2 = 310
 Future.FILLBOX x1, y1, x2, Y2, 8
 Future.BOX x1, y1, x2, Y2, 7
 Future.PRINT x1 + 10, y1 + 1, LTRIM$(RTRIM$(obj(ID).oname$)), 14, -1
 i = i + 1: Future.PRINT x1 + 10, y1 + (i * 17) + 1, "Used in " + RTRIM$(LTRIM$(Skill(obj(ID).Skill).sname$)) + STR$(obj(ID).Skill), 7, -1
 i = i + 1: Future.PRINT x1 + 10, y1 + (i * 17) + 1, "Level to use:" + STR$(obj(ID).Level), 7, -1
 i = i + 1: Future.PRINT x1 + 10, y1 + (i * 17) + 1, "Avg. Price (GP):" + STR$(obj(ID).cost), 7, -1
 i = i + 1: Future.PRINT x1 + 10, y1 + (i * 17) + 1, "Market Value %" + STR$(obj(ID).demand), 7, -1
 amt& = Possess&(ID)
 i = i + 1: Future.PRINT x1 + 10, y1 + (i * 17) + 1, "Total Amt:" + STR$(amt&), 7, -1
 Pause
END SUB

FUNCTION Possess& (ID) '[ returns amount of ID in inventory ]
FOR i = 1 TO 36 'Possess%
 IF invID(i) = ID THEN
  num& = num& + invAmt(i)
 END IF
NEXT i
Possess& = num&
END FUNCTION

FUNCTION PossessB& (ID)
FOR i = 1 TO 100
 IF bankID(i) = ID THEN
  num& = num& + bankAmt(i)
 END IF
NEXT i
PossessB& = num&
END FUNCTION

FUNCTION PossessSubType (grp, subg, DoICare) ' [ returns index in inv. of  last item of group grp and subgroup subg. checks subg only when doicare is 1]

' Chooses highest-level usable object of group grp
' If DoICare=1 then the subgroup can be specified also as subg

FOR i = 1 TO 36
 inv = invID(i)
 IF obj(inv).Group = grp THEN
  IF DoICare = 1 THEN
   IF obj(inv).SubGroup = subg THEN
    IF obj(inv).Level > obj(item).Level AND Skill(obj(item).Skill).amt >= obj(item).Level THEN
     item = inv
    END IF
   END IF
  ELSE
   IF obj(inv).Level > obj(item).Level AND Skill(obj(item).Skill).amt >= obj(item).Level THEN
    item = inv
   END IF
  END IF
 END IF
NEXT i
 PossessSubType = item
END FUNCTION

SUB ShowBank
REDIM mcur(1300)
REDIM mcurB(1300)
REDIM menu$(10)
vbmode = 1
bscroll = 0
selbi = 1
DO
IF vbmode = 0 THEN
 ViewInventory2
  DO
   Future.UpdateMouse
   IF Future.MouseB% = 2 THEN
    DO
     Future.UpdateMouse
    LOOP UNTIL Future.MouseB% = 0
    mx% = Future.MouseX%
    my% = Future.MouseY%
    mxs = INT(mx% / 36)
    mys = INT(my% / 36)
    seli2 = (mys * 6) - (6 - mxs)
    
    IF seli2 > 0 AND seli2 < 37 THEN
     IF invID(seli2) > 0 THEN
     menu$(1) = "Cancel"
     menu$(2) = " Deposit 1"
     menu$(3) = " Deposit 5"
     menu$(4) = " Deposit 10"
     menu$(5) = " Deposit X"
     menu$(6) = " Deposit All"
     a = rmenu(menu$(), INT(mx% / 15), INT(my% / 15))
     accumnt = 0
     FOR i = 1 TO 36
      IF invID(i) = invID(seli2) THEN
       accumnt = accumnt + invAmt(i)
      END IF
     NEXT i
     SELECT CASE a
      CASE 2
       amt = 1
       IF accumnt > 0 THEN
        Deposit seli2, amt, 0
       END IF
      CASE 3
       IF accumnt < 5 THEN amt = accumnt ELSE amt = 5
       Deposit seli2, amt, 0
      CASE 4
       IF accumnt < 10 THEN amt = accumnt ELSE amt = 10
       Deposit seli2, amt, 0
      CASE 5
       amt = VAL(AINPUT$("Amount:", ""))
       IF accumnt < amt THEN amt = accumnt
       Deposit seli2, amt, 0
      CASE 6
       Deposit seli2, accumnt, 0
     END SELECT
    END IF
    ViewInventory2
    END IF
   END IF
   IF Future.MouseB% = 1 THEN
    mx% = Future.MouseX%
    my% = Future.MouseY%
    mxs = INT(mx% / 36)
    mys = INT(my% / 36)
    IF mx% > 252 + 36 AND mx% < 252 + 72 THEN
     IF my% > 36 + 32 AND my% < 36 + 68 THEN
      DO
       Future.UpdateMouse
      LOOP UNTIL Future.MouseB% = 0
      vbmode = 1
      EXIT DO
     END IF
    END IF
    seli = (mys * 6) - (6 - mxs)
    IF seli < 1 OR seli > 36 THEN seli = 1
    item = seli
    IF invID(item) > 0 THEN
     iconP% = obj(invID(item)).Icon
     IF obj(invID(item)).Group = 4 THEN
      SELECT CASE invAmt(item)
       CASE 1 TO 5
        iconP% = 5
       CASE 6 TO 21
        iconP% = 6
       CASE IS > 22
        iconP% = 7
      END SELECT
     END IF
     Future.MouseOff
     SetPage Secondary%
      Future.FILLBOX 0, 0, 50, 50, 0
      Future.XMSArrayPut 0, 0, icons%, iconP%
      Future.GET 0, 0, 32, 32, mcur()
     SetPage Primary%
     mx% = Future.MouseX%
     my% = Future.MouseY%
     Future.GET mx%, my%, mx% + 32, my% + 32, mcurB()
     DO
      Future.PUT mx%, my%, mcur()
      WAIT &H3DA, 8
      omx% = mx%
      omy% = my%
      Future.UpdateMouse
      mx% = Future.MouseX%
      my% = Future.MouseY%
      Future.PUT omx%, omy%, mcurB()
      Future.GET mx%, my%, mx% + 32, my% + 32, mcurB()
      Future.PUT mx%, my%, mcur()
     LOOP UNTIL Future.MouseB% = 0
     Future.MouseOn
     mx% = Future.MouseX% + 16
     my% = Future.MouseY% + 16
     mxs = INT(mx% / 36)
     mys = INT(my% / 36)
     sels = (mys * 6) - (6 - mxs)
     IF sels > 0 AND sels < 37 THEN
      SWAP invID(seli), invID(sels)
      SWAP invAmt(seli), invAmt(sels)
      seli = sels
     END IF
     ViewInventory2
    END IF
   END IF
   jkl$ = INKEY$
   SELECT CASE jkl$
    CASE " "
     vbmode = 1
     EXIT DO
    CASE "b"
     bankID(seli) = invID(seli)
     bankAmt(seli) = invAmt(seli)
    CASE CHR$(13)
     Deposit seli, invAmt(seli) + 0, 0
     ViewInventory2
    CASE CHR$(27)
     vbmode = 2
     EXIT DO
   END SELECT
  LOOP
ELSEIF vbmode = 1 THEN
 ViewBank bscroll, selbi
 BankLoop bscroll, selbi, vbmode
END IF
LOOP UNTIL vbmode = 2
Drawmap currentmap, 1, 0, 0
END SUB

SUB ViewBank (bscroll, selbi)
Future.MouseOff
x1 = 33
y1 = 16
x2 = 360
Y2 = 328
Future.FILLBOX x1, y1, x2, Y2, 8
Future.BOX x1, y1, x2, Y2, 7
Future.PRINT x1 + 40, y1 + 1, " Bank", 12, -1
FOR Y = 1 TO 6
 FOR X = 1 TO 6
  x2 = X * 36
  Y2 = Y * 36
  item = ((Y * 6) - (6 - X)) + (bscroll * 6)
  IF item < 100 THEN
  IF bankID(item) > 0 THEN
   iconP% = obj(bankID(item)).Icon
   IF obj(bankID(item)).Group = 4 THEN
    SELECT CASE bankAmt(item)
     CASE 1 TO 5
      iconP% = 5
     CASE 6 TO 21
      iconP% = 6
     CASE IS > 22
      iconP% = 7
    END SELECT
   END IF
   Future.XMSArrayPut x2 + 0, Y2 + 0, icons%, iconP%
   IF bankAmt(item) > 1 THEN
    IF bankAmt(item) < 1000 THEN
     hw = CINT(LEN(STR$(bankAmt(item))) / 2)
     MiniDigit x2 + 5 - hw, Y2 + 22, STR$(bankAmt(item)), 14
    ELSE
     MiniDigit x2, Y2 + 22, STR$(CINT(bankAmt(item) / 1000)) + "K", 14
    END IF
   END IF
   IF item = selbi THEN Future.BOX x2, Y2, x2 + 32, Y2 + 32, 4
  END IF
  END IF
 NEXT X
NEXT Y

 X = 252
  x2 = X
  Y2 = 36
  Future.XMSArrayPut x2 + x1, Y2 + y1, icons%, 21

Future.MouseOn

END SUB

SUB ViewInventory
Future.MouseOff
x1 = 33
y1 = 16
x2 = 360
Y2 = 328
Future.FILLBOX x1, y1, x2, Y2, 8
Future.BOX x1, y1, x2, Y2, 7

Future.PRINT x1 + 40, y1 + 1, " Inventory", 12, -1
Future.PRINT x1 + 5, Y2 - 38, " Right-click to mix objects", 15, -1
Future.PRINT x1 + 5, Y2 - 20, " Press enter to wield or eat", 15, -1
FOR X = 1 TO 6
 FOR Y = 1 TO 6
  x2 = X * 36
  Y2 = Y * 36
  item = (Y * 6) - (6 - X)
  IF invID(item) > 0 THEN
   iconP% = obj(invID(item)).Icon
   IF obj(invID(item)).Group = 4 THEN
    IF invAmt(item) < 1000 THEN
     hw = CINT(LEN(STR$(invAmt(item))) / 2)
     MiniDigit x2 + 5 - hw, Y2 + 22, STR$(invAmt(item)), 14
    ELSE
     MiniDigit x2, Y2 + 22, STR$(CINT(invAmt(item) / 1000)) + "K", 14
    END IF
    SELECT CASE invAmt(item)
     CASE 1 TO 5
      iconP% = 5
     CASE 6 TO 21
      iconP% = 6
     CASE IS > 22
      iconP% = 7
    END SELECT
   END IF
   Future.XMSArrayPut x2 + 0, Y2 + 0, icons%, iconP%
   IF item = seli THEN Future.BOX x2, Y2, x2 + 32, Y2 + 32, 4
  END IF
 NEXT Y
NEXT X

 X = 252
 FOR Y = 1 TO 6
  x2 = X
  Y2 = Y * 36
  Future.XMSArrayPut x2 + x1, Y2 + y1, icons%, Y + 20
 NEXT Y

Future.MouseOn
END SUB

SUB ViewInventory2
Future.MouseOff
x1 = 33
y1 = 16
x2 = 360
Y2 = 328
Future.FILLBOX x1, y1, x2, Y2, 8
Future.BOX x1, y1, x2, Y2, 7
Future.PRINT x1 + 40, y1 + 1, " Inventory", 12, -1
FOR X = 1 TO 6
 FOR Y = 1 TO 6
  x2 = X * 36
  Y2 = Y * 36
  item = (Y * 6) - (6 - X)
  IF invID(item) > 0 THEN
   iconP% = obj(invID(item)).Icon
   IF obj(invID(item)).Group = 4 THEN
    IF invAmt(item) < 1000 THEN
     hw = CINT(LEN(STR$(invAmt(item))) / 2)
     MiniDigit x2 + 5 - hw, Y2 + 22, STR$(invAmt(item)), 14
    ELSE
     MiniDigit x2, Y2 + 22, STR$(CINT(invAmt(item) / 1000)) + "K", 14
    END IF
    SELECT CASE invAmt(item)
     CASE 1 TO 5
      iconP% = 5
     CASE 6 TO 21
      iconP% = 6
     CASE IS > 22
      iconP% = 7
    END SELECT
   END IF
   Future.XMSArrayPut x2 + 0, Y2 + 0, icons%, iconP%
   IF item = seli THEN Future.BOX x2, Y2, x2 + 32, Y2 + 32, 4
  END IF
 NEXT Y
NEXT X

 X = 252
  x2 = X
  Y2 = 36
  Future.XMSArrayPut x2 + x1, Y2 + y1, icons%, 45
Future.MouseOn

END SUB

SUB ViewOptions
Future.MouseOff
x1 = 33
y1 = 16
x2 = 360
Y2 = 328
Future.FILLBOX x1, y1, x2, Y2, 8
Future.BOX x1, y1, x2, Y2, 7
Future.PRINT x1 + 40, y1 + 1, " Options", 10, -1

 MiniDigit 36, 19, "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", 1
 'Future.PUT x1 + 2, y1 + 2, playerBKG()

 Future.PRINT x1 + 10, y1 + 35, STR$(FreeXMSmemory& / 1024) + " KB XMS", 15, -1
 Future.PRINT x1 + 10, y1 + 55, STR$(FRE(-2)) + " bytes STACK", 15, -1
 Future.PRINT x1 + 10, y1 + 75, "Time:" + STR$(TIME), 15, -1

 FOR i = 1 TO maxunits
  IF unit(i).Rank > 0 THEN uc = uc + 1
 NEXT i
 Future.PRINT x1 + 10, y1 + 95, "Units" + STR$(uc) + STR$(maxunits), 15, -1
 SELECT CASE good - evil
  CASE IS > 100
   rating$ = "Positively Holy"
   C& = 14
  CASE 70 TO 100
   rating$ = "Saintly"
   C& = 10
  CASE 40 TO 69
   rating$ = "Righteous and Meek"
   C& = 10
  CASE 20 TO 39
   rating$ = "Faithful and Humble"
   C& = 10
  CASE 5 TO 19
   rating$ = "Good-hearted"
   C& = 2
  CASE -4 TO 4
   rating$ = "Undecided"
   C& = 17
  CASE -20 TO -5
   rating$ = "Astray"
   C& = 12
  CASE -40 TO -21
   rating$ = "Wicked"
   C& = 12
  CASE -70 TO -41
   rating$ = "Horribly Evil"
   C& = 4
  CASE -100 TO -71
   rating$ = "Black-hearted"
   C& = 4
  CASE IS < -100
   rating$ = "Abomination Personified"
   C& = 4
 END SELECT



 Future.PRINT x1 + 10, y1 + 115, rating$, C&, -1
 Future.PRINT x1 + 10, y1 + 135, "bAc:" + STR$(bAc), 2, -1
 Future.PRINT x1 + 10, y1 + 155, "Next Free file#:" + STR$(FREEFILE), 2, -1
 Future.PRINT x1 + 10, y1 + 175, "onEdgeWorld:" + onEdgeWorld$, 15, -1
 Future.PRINT x1 + 10, y1 + 195, "onEdgeMap:" + onEdgeMap$, 15, -1
 Future.PRINT x1 + 10, y1 + 215, "Economy %" + STR$(market!), 15, -1

 X = 252
 FOR Y = 1 TO 6
  x2 = X
  Y2 = Y * 36
  Future.XMSArrayPut x2 + x1, Y2 + y1, icons%, Y + 20
 NEXT Y
Future.MouseOn

END SUB

SUB ViewSkills
Future.MouseOff
x1 = 33
y1 = 16
x2 = 360
Y2 = 328
Future.FILLBOX x1, y1, x2, Y2, 8
Future.BOX x1, y1, x2, Y2, 7
Future.PRINT x1 + 40, y1 + 1, " Skills", 12, -1

 Future.PRINT x1 + 10, y1 + 15, "  Skill      Level     XP", 14, -1
 FOR i = 1 TO 12
  startl = Skill(i).Level
  Future.PRINT x1 + 10, y1 + 20 + (i * 16), RTRIM$(LTRIM$(Skill(i).sname$)), 15, -1
  Future.PRINT x1 + 98, y1 + 20 + (i * 16), STR$(Skill(i).amt) + "/" + LTRIM$(STR$(Skill(i).Level)), 15, -1
  MiniDigit x1 + 175, y1 + 20 + (i * 16), STR$(Skill(i).xp), 14
  MiniDigit x1 + 205, y1 + 20 + (i * 16), STR$(xPl(startl + 1).xp), 15
  'xPl(startl + 1).XP

 NEXT i

 X = 252
 FOR Y = 1 TO 6
  x2 = X
  Y2 = Y * 36
  Future.XMSArrayPut x2 + x1, Y2 + y1, icons%, Y + 20
 NEXT Y
Future.MouseOn

END SUB

SUB ViewTabs
REDIM mcur(1300)
REDIM mcurB(1300)
DO
SELECT CASE vuBoxNo
 CASE -1
  ViewTiles 0
 CASE 1
  ViewInventory
  DO
   Future.UpdateMouse
   IF vuBoxNo <> 1 THEN EXIT DO
   IF Future.MouseB% = 2 THEN
    DO
     Future.UpdateMouse
    LOOP UNTIL Future.MouseB% = 0
    mx% = Future.MouseX%
    my% = Future.MouseY%
    mxs = INT(mx% / 36)
    mys = INT(my% / 36)
    IF mx% < 250 THEN
     seli2 = (mys * 6) - (6 - mxs)
     IF seli2 < 1 OR seli2 > 36 THEN seli2 = 1
     Mix 0, obj(invID(seli)).ID$, obj(invID(seli2)).ID$, rtn
     IF obj(invID(seli)).ID$ = "tdbx" OR obj(invID(seli2)).ID$ = "tdbx" THEN
      vuBoxState = 0
      EXIT DO
     ELSE
      ViewInventory
     END IF
    END IF
   END IF
   IF Future.MouseB% = 1 THEN
    mx% = Future.MouseX%
    my% = Future.MouseY%
    mxs = INT(mx% / 36)
    mys = INT(my% / 36)
   IF mx% < 250 THEN
    seli = (mys * 6) - (6 - mxs)
    IF seli < 1 OR seli > 36 THEN seli = 1
    item = seli
    IF invID(item) > 0 THEN
     iconP% = obj(invID(item)).Icon
     IF obj(invID(item)).Group = 4 THEN
      SELECT CASE invAmt(item)
       CASE 1 TO 5
        iconP% = 5
       CASE 6 TO 21
        iconP% = 6
       CASE IS > 22
        iconP% = 7
      END SELECT
     END IF
     Future.MouseOff
     SetPage Secondary%
      Future.FILLBOX 0, 0, 50, 50, 0
      Future.XMSArrayPut 0, 0, icons%, iconP%
      Future.GET 0, 0, 32, 32, mcur()
     SetPage Primary%
     mx% = Future.MouseX%
     my% = Future.MouseY%
     Future.GET mx%, my%, mx% + 32, my% + 32, mcurB()
     DO
      Future.PUT mx%, my%, mcur()
      WAIT &H3DA, 8
      omx% = mx%
      omy% = my%
      Future.UpdateMouse
      mx% = Future.MouseX%
      my% = Future.MouseY%
      Future.PUT omx%, omy%, mcurB()
      Future.GET mx%, my%, mx% + 32, my% + 32, mcurB()
      Future.PUT mx%, my%, mcur()
     LOOP UNTIL Future.MouseB% = 0
     Future.MouseOn
     mx% = Future.MouseX% + 16
     my% = Future.MouseY% + 16
     mxs = INT(mx% / 36)
     mys = INT(my% / 36)
     sels = (mys * 6) - (6 - mxs)
     IF sels > 0 AND sels < 37 THEN
      SWAP invID(seli), invID(sels)
      SWAP invAmt(seli), invAmt(sels)
      seli = sels
     END IF
     IF mxs = 8 AND mys = 3 THEN
      ObjectInfo invID(sels)
     END IF
     IF mxs = 8 AND mys = 2 THEN
      Wear invID(sels), sels
      'MSG STR$(invID(sels)) + STR$(sels) + obj(invID(sels)).id$
     END IF
     RefreshInv
     ViewInventory
    END IF
    END IF
   END IF
   CheckTabs
   jkl$ = INKEY$
   SELECT CASE jkl$
    CASE CHR$(27), " "
     vuBoxState = 0
     EXIT DO
    CASE CHR$(13)
     sels = seli
     IF obj(invID(sels)).Group = 6 THEN
      IF obj(invID(sels)).SubGroup = 3 THEN
       MSG "You eat the " + RTRIM$(obj(invID(sels)).oname$) + "."
       heal = obj(invID(sels)).Level + 2
       unit(1).HP = unit(1).HP + heal
       IF unit(1).HP > unit(1).THP THEN unit(1).HP = unit(1).THP
       Skill(11).amt = unit(1).HP
       invID(sels) = 0
       invAmt(sels) = 0
      END IF
      IF obj(invID(sels)).SubGroup = 4 THEN
       MSG "You drink the " + RTRIM$(obj(invID(sels)).oname$) + "."
       alco = obj(invID(sels)).xp + 1
       bAc = bAc + alco
       IF soberTime >= TIME THEN
        soberTime = soberTime + (alco * 10)
       ELSE
        soberTime = TIME + (alco * 10)
       END IF
       Skill(6).amt = INT(bAc * 3)
       invID(sels) = 0
       invAmt(sels) = 0
      END IF
     ELSE
      Wear invID(sels), sels
     END IF
     RefreshInv
     ViewInventory
    CASE "d"
     invID(seli) = 0
     invAmt(seli) = 0
    CASE ":"
     FOR i = 6 TO 70
      bankID(i) = INT(RND * 120) + 1
      bankAmt(i) = INT(RND * 50) + 1
     NEXT i
   END SELECT
  LOOP
 CASE 2
  ViewWorn
  DO
   CheckTabs
   jkl$ = INKEY$
   SELECT CASE jkl$
    CASE CHR$(27)
     vuBoxState = 0
     EXIT DO
    CASE CHR$(13)
     Give obj(worn(4).ID).ID$, 1
     worn(4).ID = 0
     ViewWorn
     'worn(4).id=0
    CASE "1"
     style = 0
     ViewWorn
    CASE "2"
     style = 1
     ViewWorn
    CASE "3"
     style = 2
     ViewWorn
   END SELECT
   IF vuBoxNo <> 2 THEN EXIT DO
  LOOP
 CASE 3
  ViewSkills
  DO
   CheckTabs
   jkl$ = INKEY$
   SELECT CASE jkl$
    CASE CHR$(27)
     vuBoxState = 0
     EXIT DO
   END SELECT
   IF vuBoxNo <> 3 THEN EXIT DO
  LOOP
 CASE 4
  ViewEmployed
  vuBoxState = 0
  vuBoxNo = 0
 CASE 6
  ViewOptions
  DO
   Future.UpdateMouse
   IF Future.MouseB% = 1 THEN
    SELECT CASE Future.MouseY%
     CASE 31 TO 47
      IF Future.MouseX% > 43 AND Future.MouseX% < 203 THEN
      ' AddPlayer
      END IF
    END SELECT
   END IF
   CheckTabs
   jkl$ = INKEY$
   SELECT CASE jkl$
    CASE "s"
     FOR i = 1 TO maxunits
      Y = Y + 1
      Future.PRINT 1 + X, 1 + (Y * 16), STR$(unit(i).Rank) + " " + RTRIM$(unit(i).Name$) + STR$(unit(i).X) + STR$(unit(i).Y) + STR$(unit(i).Icon), 14, 0
      IF Y = 25 THEN X = X + 200: Y = 0
     NEXT i
    CASE " "
     ViewOptions
    CASE CHR$(27)
     vuBoxState = 0
     EXIT DO
   END SELECT
   IF vuBoxNo <> 6 THEN EXIT DO
  LOOP
 CASE ELSE
  MSG "Invalid box as yet"
  vuBoxNo = 1
END SELECT
LOOP UNTIL vuBoxState = 0
mru = invID(seli)
Drawmap currentmap, 1, 0, 0
END SUB

SUB ViewTiles (scroll)
Future.MouseOff
x1 = 33
y1 = 16
x2 = 360
Y2 = 328
Future.FILLBOX x1, y1, x2, Y2, 8
Future.BOX x1, y1, x2, Y2, 7

Future.PRINT x1 + 40, y1 + 1, " Tiles", 12, -1
Future.PRINT x1 + 40, y1 + 17, " Press a key to chnage tiles", 15, -1
Future.MouseOn

END SUB

SUB ViewWorn
Future.MouseOff
x1 = 33
y1 = 16
x2 = 360
Y2 = 328
Future.FILLBOX x1, y1, x2, Y2, 8
Future.BOX x1, y1, x2, Y2, 7
Future.PRINT x1 + 40, y1 + 1, "Wielded or Worn", 12, -1
x2 = 150
FOR i = 1 TO 8
  Y2 = i * 38
  item = 0
  IF worn(i).ID <> 0 THEN item = worn(i).ID
  IF item > 0 THEN
   iconP% = obj(item).Icon
   SELECT CASE i
    CASE 4
     y0 = -38
     x0 = 38
   END SELECT
   Future.XMSArrayPut x2 + x0, Y2 + y0, icons%, iconP%
  END IF
NEXT i

 X = 252
 FOR Y = 1 TO 6
  x2 = X
  Y2 = Y * 36
  Future.XMSArrayPut x2 + x1, Y2 + y1, icons%, Y + 20
 NEXT Y

 i = 1
 IF style = 2 THEN sc& = 10 ELSE sc& = 121
 Future.PRINT x1 + 20, Y2 - (17 * i), "Defensive", sc&, -1
 i = i + 1
 IF style = 1 THEN sc& = 10 ELSE sc& = 121
 Future.PRINT x1 + 20, Y2 - (17 * i), "Strong", sc&, -1
 i = i + 1
 IF style = 0 THEN sc& = 10 ELSE sc& = 121
 Future.PRINT x1 + 20, Y2 - (17 * i), "Accurate", sc&, -1



Future.MouseOn

END SUB

SUB Wear (ID, ininv)
' special cases
 canwear = 0
 'MSG STR$(invID(ininv)) + STR$(id) + STR$(ininv) + obj(invID(ininv)).id$
 RefreshInv
 ID$ = obj(ID).ID$
 IF RIGHT$(ID$, 2) = "ax" THEN canwear = 4
 IF RIGHT$(ID$, 2) = "pk" THEN canwear = 4
 IF canwear < 1 THEN
  FOR i = 1 TO 8
   IF obj(ID).Group = worn(i).Group THEN
    IF obj(ID).SubGroup = worn(i).SubGroup THEN
     canwear = i
     SELECT CASE i
      CASE 1 TO 3
       IF Skill(7).amt < obj(ID).Level THEN canwear = 0: MSG "Not high enough defence"
      CASE 4
       IF Skill(5).amt < obj(ID).Level THEN canwear = 0: MSG "Not high enough attack"
     END SELECT
     IF canwear > 0 THEN EXIT FOR
    END IF
   END IF
  NEXT i
 END IF
 IF canwear < 1 THEN
  MSG "This item cannot be wielded or worn"
 ELSE
  invno = GetInvNo%(INT(GetID%(ID$)))
  invID(invno) = 0
  invAmt(invno) = 0
  id2 = worn(canwear).ID
  worn(canwear).ID = ID
  IF id2 > 0 THEN
   Give obj(id2).ID$, 1
   MSG "gave " + obj(id2).ID$
  END IF
  MSG "You wear it"
  ID = 0
 END IF
 RefreshInv
END SUB

SUB Withdraw (ID, amt, bid)
RefreshInv
IF obj(bankID(ID)).Group = 4 THEN
 IF EmptySlots > 0 THEN
  Give obj(bankID(ID)).ID$, amt
  bankAmt(ID) = bankAmt(ID) - amt
  IF bankAmt(ID) <= 0 THEN bankID(ID) = 0
 END IF
ELSE
IF EmptySlots >= amt THEN
 FOR i = 1 TO amt
  Give obj(bankID(ID)).ID$, 1
 NEXT i
 bankAmt(ID) = bankAmt(ID) - amt
 IF bankAmt(ID) <= 0 THEN bankID(ID) = 0
ELSE
 MSG "Not enough room in inventory"
END IF
END IF
END SUB

