FANDOM


Created by Taz.

Using "RC_Core.rcm"
; By Naddaz on TAZCO

Function Main()

Player = Actor()
Target = ContextActor()
PName$ = Name(Player)
TName$ = Name(Target)


        HasMail$ = OpenFile(+ PName + "Mail.txt") ;attach name to player mail.
    
         If (HasMail = 0) ;there is no mail for player, make file.
            OutPut(Player, "You have no new mail.", 230, 145, 23)
            CloseFile(HasMail) ;close opened mail file
        Else 
             CloseFile(HasMail)
            ChatBox$ = OpenDialog(Player, Target, +PName + " Mail")
            DialogOutPut(Player, ChatBox, "You have new mail, would you like to see it?", 230, 145, 23)
            POption% = DialogInput(Player, ChatBox, "No,Yes")
                If (POption = 1) ;Player will check later
                    CloseDialog(Player, Chatbox)
                    Return
                Endif
                  HasMail$ = OpenFile(+ PName + "Mail.txt") ;attach name to player mail.
             ;Player wants to see there mail show them!!
               PMail$ = Readline(HasMail) 
               CloseDialog(Player, ChatBox)
               ChatBox$ = OpenDialog(Player, Target, +PName + " Mail")
               DialogOutPut(Player, ChatBox, + PMail, 230, 145, 23)
               
                DialogOutPut(Player, ChatBox, "if you don`t delete this message you will not be able to receive another.", 230, 145, 23)
               POption% = DialogInput(Player, ChatBox, "Delete Message,Close")
               
                CloseFile(HasMail)
              ; CloseFile(PMail)
                If (POption = 1) ;delete msg
                    
                    DeleteFile(+ PName + "Mail.txt")
                    DialogOUtput(player, ChatBox, "Message has been deleted.", 230, 145, 23)
                    DialogInput(Player, ChatBox, "Close")
                    CloseDialog(Player, ChatBox)
                    Return             
                Else ; close without deleteing msg
                
                Endif
               
                DoEvents(1000)
               CloseDialog(Player, ChatBox)
                
                CloseFile(HasMail)
        
         Endif
      
         CloseFile(HasMail)



End Function