 Rem File: Cmd089.bas
 Rem Sub: Move.Object
 Rem $Include: 'dndbbs.inc'
 On Error Goto Main.Error
 If Chained<>-2 Then
    Color 15,0
    Print "DNDBBS Command 089 -- Move.Object."
    Color 7,0
    End
 Endif
 Call Move.Object
Main.Resume:
 Chain DND.Path+"DNDBBS.EXE"
 End
Main.Error:
 Resume Main.Resume

Sub Move.Object
 On Local Error Goto ErrorTrap45
 Call Parse
 If Parser Then
    Call Numeric
 Endif
 Call Check.Room.Items
 If Temp7!<=SFalse Then
    Strng="You can't move that!"
    Call IO.O
    Exit Sub
 Endif
 If TreasureRecord.Movable=False Then
    Strng="You can't move that!"
    Call IO.O
    Exit Sub
 Endif
 If TreasureRecord.Launchable=False Then
    Strng="You can't move that!"
    Call IO.O
    Exit Sub
 Endif
 Out4=Out3
 TempD!=Temp5!
 TempE=Temp6
 TempF!=Temp7!
 User.Command=Parsed.Command2
 Call Get.Direction
 If TempA Then
    Strng2=Direction(TempA)
 Endif
 If TempA=False Then
    ' custom room direction#1
    Call Read.Record(RoomFile,Room)
    Out3=Rtrim$(RoomRecord.Custom1)
    If Out3=String$(12,Chr$(0)) Then
       Out3=Nul
    Endif
    If Len(Out3) Then
       If Ucase$(Out3)=Parsed.Command2 Then
          TempA=13
          Strng2=Lcase$(Out3)
       Endif
    Endif
 Endif
 If TempA=False Then
    ' custom room direction#2
    Call Read.Record(RoomFile,Room)
    Out3=Rtrim$(RoomRecord.Custom2)
    If Out3=String$(12,Chr$(0)) Then
       Out3=Nul
    Endif
    If Len(Out3) Then
       If Ucase$(Out3)=Parsed.Command2 Then
          TempA=14
          Strng2=Lcase$(Out3)
       Endif
    Endif
 Endif
 If TempA Then
    Next.Room=RoomRecord.Direct(TempA)
    If Next.Room=SFalse Then
       Strng="You can't move it there!"
       Call IO.O
       Exit Sub
    Endif
    Out2=UserRecord.CodeName
    Out2=Lcase$(Out2)
    Out2=Rtrim$(Out2)
    Out2=Out2+" just moved something "
    Strng=Strng2
    Strng=Rtrim$(Strng)
    Out2=Out2+Strng+"."
 Else
    Parsed.Command1=User.Command
    Call Check.Room.Items
    If Temp7!>=SFalse Then
       Strng="You can't move it there!"
       Call IO.O
       Exit Sub
    Endif
    If ObjectRecord.JailTrap Then
       Strng="Trapped portal!"
       Call IO.O
       Exit Sub
    Endif
    Call Return.Room(Var!)
    If Var!=SFalse Then
       Strng="You can't move it there!"
       Call IO.O
       Exit Sub
    Endif
    If ObjectRecord.Closed Then
       If Pass.Door=False Then
          Strng="You can't, it's closed!"
          Call IO.O
          Exit Sub
       Endif
    Endif
    Strng2=ObjectRecord.PortalPassword
    Strng2=Rtrim$(Strng2)
    If Len(Strng2) Then
       Strng="Enter portal password: "
       Call IO.I
       Out2=Ucase$(Out2)
       Out2=Rtrim$(Out2)
       Out2=Ltrim$(Out2)
       Call Crypto(Strng2)
       Strng2=Rtrim$(Strng2)
       If Strng2<>Out2 Then
          Strng="Incorrect portal password.."
          Call IO.O
          Exit Sub
       Endif
    Endif
    If ObjectRecord.Relocks Then
       ObjectRecord.DoorLock=2
       ObjectRecord.Closed=True
       Call Write.Record(ObjectFile,Temp7!)
    Endif
    Pass.Door=False
    Next.Room=Var!
    Out2=UserRecord.CodeName
    Out2=Lcase$(Out2)
    Out2=Rtrim$(Out2)
    Out2=Out2+" just moved something to "+Out3+"."
 Endif
 Call Delete.List.Node(TempD!)
 Swap Room,Next.Room
 MessWorkRecord6.Room=Room
 MessWorkRecord6.User=SFalse
 MessWorkRecord6.Index=TempF!
 MessWorkRecord6.Charges=TempE
 MessWorkRecord6.Plus=False
 Call Add.List.Node(TempD!)
 Swap Room,Next.Room
 Strng="You move "+Out4+"."
 Call IO.O
 If Node>False Then
    Call Send.Mess(8,SFalse,Room,Out2)
 Endif
 Action.Recurse=0
 Call Enter.Room
ErrorResume45:
 Exit Sub
ErrorTrap45:
 Resume ErrorResume45
End Sub
