Skip to content

Modder's Readme

Omega Terra Coriel edited this page Oct 6, 2022 · 15 revisions

Event Repeater

What is Event Repeater?

Event Repeater is a framework mod which lets you repeat events, dialogue questions, and mail letters in-game without needing to create duplicate versions. You use it by adding certain properties to the manifest.json and content.json for your Content Pack.


Explanation of Mod Use

Declaring Dependency

In order to ensure flawless compatibility, you need to declare Event Repeater as a dependency in your Content Pack's manifest.json. You simply need to paste the following code at the bottom:

 "Dependencies": [
   {
      "UniqueID": "misscoriel.eventrepeater",
      "IsRequired": true,
   },
 ]

Conditional Event Repeating using Content Patcher

As of 6.5.0, Event Repeater can use Content Patcher-style edits to repeat events, mail, and responses. This means you can place Content Patcher conditions and tokens.

{
    "Action": "EditData",
    "Target": "Mods/EventRepeater/MailToRepeat",
    "Entries": {
         "mailKey1": "null",
    }
}

The code above states a repeat without conditions. However, you can use a variety of Content Patcher's conditions using a When statement. You are able to set a repeating event, mail, or response by using the following targets:

Mods/EventRepeater/EventstoRepeat
Mods/EventRepeater/MailtoRepeat
Mods/EventRepeater/ResponsestoRepeat

For further information on conditions and tokens, please read Pathoschild's Modder Documentation for Content Patcher.

Repeating Events

All events must be within the RepeatEvents field. This field may be at the beginning or end of your content.json, however it must not be in the Changes field:

   "Format": "1.13",
   "RepeatEvents": [
     63351,
     48,
     95994615,
   ],
   "Changes": [ ...

The above code is an example of it being above "Changes" but after "Format". It should work... though if not:

   "Format": "1.13",
   "Changes": [
    _Content Patcher information goes here_
   ],
   "RepeatEvents": [
    63351,
    48,
    95994615,
   ]

The above code shows "RepeatEvents" after "Changes". This is the recommended configuration.

   "Format": "1.13",
   "Changes": [
      _Some Content Patcher Data_
   "RepeatEvents": [
      63351,
      48,
      95994615,
    ],
   ]

The code above is invalid and will cause the Content Pack to crash.


Within the field of "RepeatEvents" you must put the EventID of the events you wish to have repeated. Each EventID must be separated by a comma, even if there is only one EventID:

  "RepeatEvents": [
    69696969,
    112,
    7989001,
   ]

The code above indicates that event 69696969, 112, and 7989001 will remove itself from your seen event list. Stardew Valley uses SeenEvent to remember what events you've seen and will not let you repeat them unless it was hardcoded to do so. Event Repeater will search for the listed EventIDs and remove them from the list to allow them to be played again at the beginning of the following day. Should an EventID be found withing the SeenEvent list, the SMAPI Console will output the following:

  "Repeatable Event Found! Resetting for the next time! Event ID: <EventID>"

This means that the EventID can be executed again once it's Event Preconditions are met.

(Note: Event Preconditions are explained and are available at the Stardew Valley Wiki)

Repeating Mail Messages

Unless hardcoded, Stardew Valley only allows mail to be sent once a playthrough. Event Repeater can repeat any mail message using the `"RepeatMail" field:

  "RepeatMail": [
    "pennySpa",
    "wizardParty",
    "secretUnderpants",
   ]

The field has the same rules that apply to "RepeatEvents" and thus must be before or after the "Changes" field. The field is to be populated by the MailIDs that you wish to be mailed more than once. This is usually combined with an event to send the mail, so be sure to repeat the corresponding EventID within the "RepeatEvents" field.

If a MailID is found within your MailRecieved list, Event Repeater will remove the MailID and the SMAPI Console will output the following:

Repeatable Mail found!  Resetting: <MailID>

As before stated. Once the MailID has been reset, it will wait for the next time you meet the qualifications of receiving the message.


Repeating Responses to Questions

This pertains mostly for out of event Questions asked in an NPC's regular dialogue. The function checks for the ResponseIDs within dialogueQuestionsAnswered. These ResponseIDs are always numeric and are stored to allow NPCs to speak of certain things depending on your answer. You can locate your ResponseIDs in any dialogue that uses the $q and $r commands within the dialogue. The "RepeatEvents" field should look as follows:

  "RepeatResponse": [
    7989000,
    7989001,
   ]

The above code covers only one question, as typically a question will carry two ResponseIDs. When these IDs are found within dialogueQuestionsAnswered, Event Repeater will remove them and output the following in the SMAPI Console:

Repeatable Response Found! Resseting: <ResponseID>

This will allow the question to reset the next time it is valid to come up. Using this will allow a modder to cause special events or even change a dialogue chain for the player each time they answer differently.


All three Fields can be placed in any order; So long as they are not within each other:

  "RepeatEvents": [
    7989000,
  ],
  "RepeatMail": [
    partyInvite,
  ],
  "RepeatResponses": [
    7989000,
    7989001,
  ]

Console Commands Explanation

List Commands

These commands are designed for Modders for testing and evaluation. They hold little use for regular players unless being assisted for troubleshooting:

 showevents

This command will list all EventIDs stored in Game1.player.eventsSeen in the SMAPI Console. These EventIDs will be listed in order of when you saw them. You can use this command in order to find the EventID from a modded event or from the default game. You may also troubleshoot your own mod to see if a specific EventID is being counted as seen.

showmail

Like showevents, this command will list all MailIDs stored in Game1.player.mailReceived and output them in the SMAPI Console. As a note, there are certain things that can be counted as MailIDs, such as Introductions from NPCs, that will be in this list. You can use this command to seek out issues with Mail or find the ID of a message you recently received.

showresponse

This command will look similar to how showevents appears. It will list all responses from questions gathered in Game1.player.dialogueQuestionsAnswered.

Forget Commands

These commands are designed to remove IDs from the game:

eventforget

This command will allow you to manually remove an EventID from the eventSeen list during the game. Modders can use this command to test an event multiple times in order to see how multiple paths you can take work without reloading a save. The proper syntax would be eventforget <EventID> Update: You man now use all to remove all events seen by the farmer. This will NOT remove the initial event. This is to prevent possible problems. You may also use last to forget the previously seen event.

mailforget

This command will allow you to manually remove a MailID from the mailReceived list during the game. If you meet the conditions to receive the mail again it can be mailed and in your mailbox next day. The correct syntax would be mailforget <MailID>

responseforget

This command allows you to manually remove a ResponseID from the dialogueQuestionsAnswered list during the game. This doesn't have an immediate effect due to having to wait for the question to pop up again. The correct syntax would be responseforget <ResponseID>

Injector commands

These commands are designed to inject IDs into the game for testing purposes and perhaps cheating:

sendme

This command tells the game to send you the MailID you put in. You do not need to meet the message requirements. It will be in the mailbox the next day. Proper syntax would be sendme <MailID>

responseadd

No longer works as of 6.3.2

inject

This command adds the ability to insert IDs manually to _mail, events, _or response IDs. The injector will check to see if the ID already exists to prevent errors. The following code blocks shows the console command at work:

inject event 79891000

This injects the eventID 79891000 if it is not already within Game1.player.eventSeen.

inject mail fakeMail

This injects the mailID fakeMail if it is not already within Game1.player.mailReceived.

inject response 79891000

This injects the responseID 79891000 if it is not already within Game1.player.dialogueQuestionsAnswered.

Miscellaneous Commands

These commands were created in 6.4.5. They assist in event diagnosis or general game quality of life.

showinfo

This is a toggle command to enable or disable Hud Messages. The Hud Messages will show the Event ID of a currently running event as well as a few alerts.

stopevent

This command interrupts an event. It does not set any event flags, but labels the event as seen. After a short amount of time, it will forget that event. This command will also create an EventDumpXXX.txt, where XXX is the eventID (Example: EventDump79891000.txt), as well as both a SMAPI error and a label in the Text File indicating where in the event you stopped the event.

emergencyskip

This command interrupts an event as if it was skippable. This will not break game progression.

Manual Repeater

These commands allow a user to create a file that repeats events they like from other mods instead of forgetting the events manually.

repeateradd

This command, if not given an event ID, will save the last seen event in the manual repeater. Event IDs in the manual repeater will repeat as if they were put in an RepeateEvents block. You may also put an event id such as repeateradd 79891000.

repeatersave

This command saves the manual repeater list to a text file that can be accessed later. You must declare a filename, such as repeatersave example. The recent command will save the file as example.txt.

repeaterload

This command, in association to a file name, will load a saved text file back into the manual repeater. repeaterload example will load example.txt stated from the recent explanation.