Changes

Jump to navigation Jump to search
84 bytes added ,  13:07, 15 September 2019
Line 407: Line 407:  
</source>
 
</source>
   −
The first method (Game1.player.mailbox.Add) adds the letter directly into the mailbox for the current day.  This is best accomplished in your OnNewDay event code.  Mail added directly to the mailbox does not seem to be remembered even after a save.  This is from my personal observation.  Each time Stardew Valley started, my mod would send the letter again.  That has some uses.
+
The first method (Game1.player.mailbox.Add) adds the letter directly into the mailbox for the current day.  This is best accomplished in your "DayStaring" event code.  Mail added directly to the mailbox is not "remembered" as being sent even after a save.  This is useful in some scenarios depending on your need.
   −
The second method (Game1.addMailForTomorrow) will, as the name implies, add the letter to the player's mailbox on the next day.  This method remembers the mail (Id) making it possible not to send the same letter over and over.  Again this is very useful as well.
+
The second method (Game1.addMailForTomorrow) will, as the name implies, add the letter to the player's mailbox on the next day.  This method remembers the mail (Id) sent making it possible not to send the same letter over and over.
   −
There may be a way to put the letter directly into the mailbox and have it be remembered, maybe using the next collection (mailRecieved) to be covered, but that has not been confirmed so I don't want to lead you astray.  Presumption is you have to add your mail manually if you want it to be remembered.
+
You may be able to put the letter directly into the mailbox and also have it be remembered using the next collection (mailRecieved) to be covered, but I have not confirmed that so I don't want to lead you astray.  Presumption is you have to add your mail manually if you want it to be remembered when using the add directly to mailbox method.
    
If you want Stardew Valley to forget that a specific letter has already been sent, you can remove it from the mailReceived collection.  You can iterate through the collection as well using a foreach should you need to remove mail en mass.
 
If you want Stardew Valley to forget that a specific letter has already been sent, you can remove it from the mailReceived collection.  You can iterate through the collection as well using a foreach should you need to remove mail en mass.
Line 419: Line 419:  
</source>
 
</source>
   −
That is all there is to send a simple letter.  Attaching items, although mentioned in the source code comments above, will need some additional explanation at a future time.
+
That is all there is to sending a simple letter.  Attaching items, although mentioned in the source code comments above, will need some additional explanation at a future time.  Creating mail content dynamically, in respond to game conditions, is a little more complicated and will be covered in the future as well.
    
==Open source==
 
==Open source==
49

edits

Navigation menu